Do not test for avr family.
[bertos.git] / bertos / net / http.h
index 6b5b3bc1721c81654ebdf145c65cc4a73ceb2d76..53d8100d1ded6ebc9d092f73f87ff2265dc017f1 100644 (file)
 #include <lwip/tcpip.h>
 #include <lwip/dhcp.h>
 
-typedef int (*http_gci_handler_t)(char *revc_buf, struct netconn *client);
+typedef int (*http_handler_t)(struct netconn *client, const char *name, char *revc_buf, size_t revc_len);
 
 typedef struct HttpCGI
 {
-       const char *name;
-       http_gci_handler_t handler;
+       unsigned type;          ///< Strategy to find string in the cgi table.
+       const char *name;       ///< Request string from GET request
+       http_handler_t handler; ///< Callback to process the special request
 } HttpCGI;
 
+
+#define CGI_MATCH_NONE   0
+#define CGI_MATCH_NAME   1  ///< Select item in table only if string match
+#define CGI_MATCH_EXT    2  ///< Select item in table if the extention match
+
 void http_sendOk(struct netconn *client);
 void http_sendFileNotFound(struct netconn *client);
-void http_server(struct netconn *server, struct HttpCGI *gci);
+void http_sendInternalErr(struct netconn *client);
+
+void http_poll(struct netconn *server);
+void http_init(http_handler_t default_callback, struct HttpCGI *table);
 
 #endif /* NET_HTTP_H */