From aa80b95124752095533cff761c3287d756ca26cd Mon Sep 17 00:00:00 2001 From: Marc Lasch Date: Wed, 12 Aug 2015 00:09:46 +0200 Subject: not working now --- .gitignore | 1 + Makefile | 2 +- src/apiHandler.cpp | 15 +++++++++++++++ src/apiHandler.h | 22 ++++++++++++++++++++++ src/server.cpp | 9 +++++---- 5 files changed, 44 insertions(+), 5 deletions(-) create mode 100644 src/apiHandler.cpp create mode 100644 src/apiHandler.h diff --git a/.gitignore b/.gitignore index 6b97cea..f693558 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .project .cproject +.settings bin *.o *.swp diff --git a/Makefile b/Makefile index 9c682b5..3f4d92f 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -OBJ=src/server.o mongoose/mongoose.o +OBJ=src/server.o src/apiHandler.o mongoose/mongoose.o OUT=bin/server CFLAGS += -Wall -DNO_CGI -DNO_POPEN -DUSE_IPV6 diff --git a/src/apiHandler.cpp b/src/apiHandler.cpp new file mode 100644 index 0000000..231fd6c --- /dev/null +++ b/src/apiHandler.cpp @@ -0,0 +1,15 @@ +#include "apiHandler.h" + +using namespace std; + +apiHandler::apiHandler(struct mg_connection *conn) { + MyConnection = conn; +} + +apiHandler::~apiHandler(void) { } + +int apiHandler::processRequest(void) { + + return MG_FALSE; + +} diff --git a/src/apiHandler.h b/src/apiHandler.h new file mode 100644 index 0000000..6909fdd --- /dev/null +++ b/src/apiHandler.h @@ -0,0 +1,22 @@ +#ifndef _APIHANDLER_ +#define APIHANDLER + +#include +#include +#include +#include +#include "mongoose.h" + +using namespace std; + +class apiHandler { +private: + struct mg_connection *MyConnection; + +public: + apiHandler(struct mg_connection*); + ~apiHandler(void); + int processRequest(); +}; + +#endif diff --git a/src/server.cpp b/src/server.cpp index 222e8ea..3efb51d 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -1,16 +1,16 @@ #include #include #include "mongoose.h" +#include "apiHandler.h" using namespace std; int event_handler(struct mg_connection *conn, enum mg_event ev) { + apiHandler MyApiHandler(conn); + switch (ev) { case MG_AUTH: return MG_TRUE; - case MG_REQUEST: - if (conn->uri) { - cout<request_method<<" "<uri<