#ifndef _WEBSERVER_H #define _WEBSERVER_H #include "InputOutput.h" #include "ReportCommand.h" #include "define.h" //_DEBUG #include "define_platform.h" //includes winsock2.h or socket.h #include "debug.h" class WebServer: public InputOutput { bool m_run; const unsigned int m_port; SOCKET m_sc; pthread_t m_runThread; void sendXSLT(const char *sheet) const; //threaded listen int listenasync(); static THREAD_CALLBACK_TYPE staticlistenasync(LPVOID lpParam); static void staticrunCleanup( LPVOID lpParam); //lpParam = the Spider this public: enum handshake { html, xml, xsl }; WebServer(ReportCommand *_rc, unsigned int _port = 80); ~WebServer() {} //exceptions class InvalidSocket {}; class InvalidRequest {}; int listen(const int mode = ASYNC); //asynchronous int shutdown(); int send(const char *responsepart) const; int sendHandshake(const int hs = html, const char *param = 0) const; }; #endif