/* ==================================================================== * ÆÄ ÀÏ : AgentProcess.h * ¸ñ Àû : * ÀÛ ¼º ÀÚ : °ûöÁß * ÀÛ ¼º ÀÏ : 09/07/09 * ÁÖÀÇ»çÇ× : * =================================================================== */ #ifndef __AGENT_PROCESS_H__ #define __AGENT_PROCESS_H__ //#ifndef WINVER //#define WINVER 0x0500 //#endif // //#ifndef _WIN32_WINNT //#define _WIN32_WINNT 0x0500 //#endif #pragma once #include "iocpserver.h" #include "protocol.h" #include "serverProtocol.h" #include "commonnetworkmsgstruct.h" enum eSERVER_TYPE { SRV_TYPE_AGENT = 0, SRV_TYPE_LOGIN, SRV_TYPE_THEMA, SRV_TYPE_PVE, }; /// ¼­¹ö Á¤º¸ struct sServiceCtr { DWORD status; char serviceName[MAX_PATH]; char ip[50]; }; class AgentProcess : public cIocpServer { private: typedef tPointerArray PArray; PArray mSrvList; private: // ¼­ºñ½º °ü·Ã ¸Þ¼Òµå void ErrorLook ( char* msg, DWORD lastError ); bool DoStartSvc ( char* serviceName ); bool DoStopSvc ( char* serviceName ); bool StopDependentServices ( SC_HANDLE hManager, SC_HANDLE hService ); private: bool PostServerEvent ( LPCTSTR format, ... ); private: // ¼­¹ö°ü·Ã ¸Þ¼Òµå - º¸Á¶. bool BatchComplete ( PerSocketContext* socketContext, void* ptr ); private: // ¼­¹ö°ü·Ã ¸Þ¼Òµå - ÁÖ. bool RecvComplete ( PerSocketContext* socketContext, PerIoContext* ioContext, DWORD bytesTransferred ); bool CallbackComplete ( PerSocketContext* socketContext, PerIoContext* ioContext, DWORD bytesTransferred ); public: // Ŭ·¡½º »ý¼º ¹× °ø¿ë ¸Þ¼Òµå. AgentProcess(void); bool Initialize ( char* addr="", unsigned short port=10000, unsigned short numWorkerThread=2 ); void Shutdown ( DWORD maxWait=INFINITE ); DWORD BackendThread ( ); void BackendThreadFps ( DWORD currentTick ); MSGROOT* GetMsgRoot ( void** handle, PerSocketContext* perSocketContext, char category=0, char protocol=0 ); bool SendMsgRoot ( void* handle, unsigned long length ); void InitSrvList ( ); void AddServieCtrl ( const char* name, const char* ip ); void UpdateServiceCtrl ( sServiceCtr* pSrv ); public: // Ŭ·¡½º ÆÄ±« ¸Þ¼Òµå. virtual ~AgentProcess(void); }; #endif // __AGENT_PROCESS_H__