Changes made for RPC

Revision:
1:6b7472d5e9ee
Parent:
0:7a2421e63e74
Child:
2:8653bbcf7e58
--- a/HTTPServer.h	Sun May 26 20:13:28 2013 +0000
+++ b/HTTPServer.h	Sun May 26 22:49:42 2013 +0000
@@ -3,10 +3,18 @@
 #define __HTTPSERVER_H__
 #include "mbed.h"
 #include "HTTPConnection.h"
+#include "HTTPRequestHandler.h"
+
+#include <map>
+using std::map;
+#include <string>
+using std::string;
 
 #include <TCPSocketConnection.h>
 #include <TCPSocketServer.h>
 
+typedef void (*HTTPRequestHandlerFunction)(HTTPMessage&, TCPSocketConnection&);
+
 /** Class HTTPServer for WiFly Interface Library
  *
  */
@@ -16,7 +24,8 @@
     public:
         HTTPServer(Serial* pDbg = NULL);
         ~HTTPServer();
-/*        
+
+
         struct handlersComp //Used to order handlers in the right way
         {
             bool operator() (const string& handler1, const string& handler2) const
@@ -30,7 +39,7 @@
                 return ((&handler1)>(&handler2));
             }
         };
-  */      
+
         ///Adds a handler
         /**
         Appends a handler to the handlers list
@@ -39,7 +48,10 @@
         */
 //        template<typename T>
 //        void addHandler(const char* path) //Template decl in header
-//        { m_lpHandlers[path] = &T::inst; }
+//        { m_pHandlers[path] = &T::inst; }
+        
+        void addHandler(const char* path, HTTPRequestHandlerFunction hdlFunc)
+        { m_pHandlers[path] = hdlFunc; }
         
         ///Starts listening
         /**
@@ -62,7 +74,9 @@
     bool    m_bServerListening;
         
     Serial* m_pDbg;
-   
+    void HandleRequest(HTTPMessage& con, TCPSocketConnection&);
+
+    map<string, HTTPRequestHandlerFunction> m_pHandlers;
  };
  
  #endif //__HTTPSERVER_H__
\ No newline at end of file