Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: MbedJSONValue WIZnetInterface mbed
HTTPServer.h
00001 #ifndef HTTP_SERVER 00002 #define HTTP_SERVER 00003 00004 #include <map> 00005 00006 #include "mbed.h" 00007 #include <string> 00008 #include "RequestHandler.h" 00009 #include "EthernetInterface.h" 00010 00011 typedef enum _HTTP_RESULT 00012 { 00013 HTTP_INVALID_URI = -3, 00014 HTTP_INVALID_DATA = -2, 00015 HTTP_INVALID_HANDLE = -1, 00016 HTTP_SUCCESS = 1 00017 }HTTP_RESULT; 00018 00019 00020 static char HTTPBUF[1024] ={0,}; 00021 static char rest_result[1024] = {0,}; 00022 00023 class HTTPServer 00024 { 00025 public : 00026 00027 HTTPServer(); 00028 virtual ~HTTPServer(); 00029 00030 bool init(int port); 00031 00032 void run(); 00033 00034 void add_request_handler(char *name, RequestHandler* handler); 00035 00036 private : 00037 00038 HTTP_RESULT handle_request(char *buffer); 00039 00040 TCPSocketServer socket; 00041 std::map<char*, RequestHandler*, bool(*)(char*, char*)> handlers; 00042 //char rest_result[2048]; 00043 00044 }; 00045 00046 #endif 00047
Generated on Mon Jul 18 2022 15:28:46 by
1.7.2