#ifndef _SERVER_CORE_SERVER_MODULE_ #define _SERVER_CORE_SERVER_MODULE_ #include #include #ifndef __linux__ // #include #define WIN32_LEAN_AND_MEAN #include #include #include #else #include #include #include #include #include #include #include #include #include #include #endif #include #include #include #include #include "../../components/base/basicTypes.h" #include "../../components/base/basicThread.h" #include "../../components/base/basicLogCollection.h" #include "../../components/base/basicLogCollection.h" #include "../../components/base/basicSettingsProvider.h" #include "../../components/base/basicEngine.h" #include "../../components/base/basicEventHeap.h" #include "../protocol/protocol.h" #include "netClientHandler.h" #define NWS_SETTINGS_HOST "NW_HOSTNAME_IP" #define NWS_SETTINGS_PORT "NW_LISTEN_PORT" //typedef _Primitive_Ring<_Core_Channel> ChannelsRing; typedef std::vector vectorNetHandlers; #define UNIX_PATH_MAX 108 void signal_void_handler( int SIG ); class networkServer: public basicThread, public basicEventHandler{ private: basicLogCollection *m_pLog; vectorNetHandlers m_vHandlersPool; basicEngine *m_pDetectorKernel; config_setting_t *m_pSettings; struct sockaddr *MainSocketAddress; CSTR m_pHostName; uint16_t m_nPortNumber; #ifdef __linux__ int MainSocket; #else SOCKET MainSocket; #endif U8 m_bConnectionType; protected: void m_fThreadProc( void ); public: explicit networkServer( config_setting_t *Settings = NULL ); virtual ~networkServer(); bool BootUp( void ); // Config By Settings provided in constructor, on fail uses next BootUp bool BootUp( U16 Port ); // Uses Default Hostname and Port as parameter, on fail (getlocalhost) uses next Bootup bool BootUp( CSTR HOST_NAME, U16 Port ); // Uses parameters #ifdef __linux__ bool BootUp( CSTR UNIX_SOCKET_NAME ); #endif bool attachEngine( basicEngine *ptr ); void dispatchEvent( basicEvent *Evt ); }; #endif