summaryrefslogtreecommitdiffstats
path: root/src/uscxml/server/HTTPServer.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/uscxml/server/HTTPServer.h')
-rw-r--r--src/uscxml/server/HTTPServer.h68
1 files changed, 34 insertions, 34 deletions
diff --git a/src/uscxml/server/HTTPServer.h b/src/uscxml/server/HTTPServer.h
index 597c749..a387e1f 100644
--- a/src/uscxml/server/HTTPServer.h
+++ b/src/uscxml/server/HTTPServer.h
@@ -11,42 +11,42 @@
namespace uscxml {
class HTTPServlet;
-
+
class HTTPServer {
public:
- class Request {
- public:
- Request() : curlReq(NULL) {}
- std::string type;
- std::map<std::string, std::string> headers;
- std::string content;
- std::string remoteHost;
- unsigned short remotePort;
- std::string httpMajor;
- std::string httpMinor;
- std::string uri;
- struct evhttp_request* curlReq;
- };
-
- class Reply {
- public:
- Reply(Request req) : status(200), type(req.type), curlReq(req.curlReq) {}
- int status;
- std::string type;
- std::map<std::string, std::string> headers;
- std::string content;
- struct evhttp_request* curlReq;
- };
-
- struct CallbackData {
+ class Request {
+ public:
+ Request() : curlReq(NULL) {}
+ std::string type;
+ std::map<std::string, std::string> headers;
+ std::string content;
+ std::string remoteHost;
+ unsigned short remotePort;
+ std::string httpMajor;
+ std::string httpMinor;
+ std::string uri;
+ struct evhttp_request* curlReq;
+ };
+
+ class Reply {
+ public:
+ Reply(Request req) : status(200), type(req.type), curlReq(req.curlReq) {}
+ int status;
+ std::string type;
+ std::map<std::string, std::string> headers;
+ std::string content;
+ struct evhttp_request* curlReq;
+ };
+
+ struct CallbackData {
HTTPServlet* servlet;
evhttp_request* httpReq;
};
- static HTTPServer* getInstance(int port = 8080);
- static void reply(const Reply& reply);
-
- static bool registerServlet(const std::string& path, HTTPServlet* servlet); ///< Register a servlet, returns false if path is already taken
+ static HTTPServer* getInstance(int port = 8080);
+ static void reply(const Reply& reply);
+
+ static bool registerServlet(const std::string& path, HTTPServlet* servlet); ///< Register a servlet, returns false if path is already taken
static void unregisterServlet(HTTPServlet* servlet);
private:
@@ -58,7 +58,7 @@ private:
static void run(void* instance);
void determineAddress();
-
+
static void httpRecvReqCallback(struct evhttp_request *req, void *callbackData);
std::map<std::string, HTTPServlet*> _servlets;
@@ -72,7 +72,7 @@ private:
std::string _address;
static HTTPServer* _instance;
-
+
static tthread::recursive_mutex _instanceMutex;
tthread::thread* _thread;
tthread::recursive_mutex _mutex;
@@ -83,8 +83,8 @@ private:
class HTTPServlet {
public:
- virtual void httpRecvRequest(const HTTPServer::Request& request) = 0;
- virtual void setURL(const std::string& url) = 0; /// Called by the server with the actual URL
+ virtual void httpRecvRequest(const HTTPServer::Request& request) = 0;
+ virtual void setURL(const std::string& url) = 0; /// Called by the server with the actual URL
};
}