Jun Furutani / libMiMic

Fork of libMiMic by Ryo Iizuka

Revision:
3:0a94993be1f6
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cpp/Httpd.cpp	Thu Apr 04 08:22:57 2013 +0000
@@ -0,0 +1,24 @@
+#include "Httpd.h"
+#include "HttpdConnection.h"
+namespace MiMic
+{
+    void Httpd::onRequestHandler(NyLPC_TcHttpdConnection_t* i_connection)
+    {
+        HttpdConnection c(i_connection);
+        ((struct Httpd2*)(i_connection->_parent_httpd))->_parent->onRequest(c);
+    }
+    Httpd::Httpd(int i_port_number)
+    {
+        NyLPC_cHttpd_initialize((NyLPC_TcHttpd_t*)(&this->_inst),(NyLPC_TUInt16)i_port_number);
+        this->_inst._parent=this;
+        this->_inst.super.function.onRequest=onRequestHandler;
+    }
+    Httpd::~Httpd()
+    {
+        NyLPC_cHttpd_finalize((NyLPC_TcHttpd_t*)(&this->_inst));
+    }
+    void Httpd::loop()
+    {
+        NyLPC_cHttpd_loop((NyLPC_TcHttpd_t*)(&this->_inst));
+    }
+}
\ No newline at end of file