WIZwikiREST-io Reference code for WIZnet Academy
Dependencies: DHT MbedJSONValue_v102 WIZnetInterface mbed-src
Fork of WIZwiki-REST-io_v103 by
HTTPServer.h
- Committer:
- joon874
- Date:
- 2016-09-05
- Revision:
- 8:60d99da6eeb2
- Parent:
- 4:0b5a199e91f3
File content as of revision 8:60d99da6eeb2:
#ifndef HTTP_SERVER #define HTTP_SERVER #include <map> #include "mbed.h" #include <string> #include "RequestHandler.h" #include "EthernetInterface.h" #define DEBUG_HTTP typedef enum _HTTP_RESULT { HTTP_INVALID_URI = -3, HTTP_INVALID_DATA = -2, HTTP_INVALID_HANDLE = -1, HTTP_SUCCESS = 1 }HTTP_RESULT; static char HTTPBUF[600] = {0,}; static char rest_result[300] = {0,}; class HTTPServer { public : HTTPServer(); virtual ~HTTPServer(); bool init(int port); void run(); void add_request_handler(char *name, RequestHandler* handler); private : HTTP_RESULT handle_request(char *buffer); TCPSocketServer socket; std::map<char*, RequestHandler*, bool(*)(char*, char*)> handlers; //char rest_result[2048]; }; #endif