12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- #ifndef __SERVER_PTR_20160920__
- #define __SERVER_PTR_20160920__
- #pragma once
- #include "HPSocket4C.h"
- #include "helper.h"
- class CServerPtr
- {
- CServerPtr(void);
- public:
- ~CServerPtr(void);
- static CServerPtr* GetInstance()
- {
- if ( m_spThis == NULL )
- {
- m_spThis = new CServerPtr();
- }
- return m_spThis;
- }
- public:
- void SetAppState(EnAppState state);
- private:
- static En_HP_HandleResult __stdcall OnPrepareListen(SOCKET soListen);
- static En_HP_HandleResult __stdcall OnAccept(HP_CONNID dwConnID, SOCKET soClient);
- static En_HP_HandleResult __stdcall OnSend(HP_CONNID dwConnID, const BYTE* pData, int iLength);
- static En_HP_HandleResult __stdcall OnReceive(HP_CONNID dwConnID, const BYTE* pData, int iLength);
- static En_HP_HandleResult __stdcall OnClose(HP_CONNID dwConnID, En_HP_SocketOperation enOperation, int iErrorCode);
- static En_HP_HandleResult __stdcall OnShutdown();
- private:
- TPkgInfo* FindPkgInfo(HP_CONNID dwConnID);
- void RemovePkgInfo(HP_CONNID dwConnID);
- private:
- static const USHORT PORT;
- static const LPCTSTR ADDRESS;
- EnAppState m_enState;
- CString m_strAddress;
- static CServerPtr* m_spThis;
- HP_TcpPackServer m_pServer;
- HP_TcpServerListener m_pListener;
- public:
- static BOOL Start();
- static BOOL Stop();
- static void Release();
- static BOOL Disconnect(IN const DWORD& dwConnId);
- public:
- // µÇ¼µÇ³ö;
- static void Req_Login(IN HP_CONNID dwConnID, IN const BYTE* pReceiveData, IN INT nReceiveLength, IN TheProPackage &thepackage, OUT BYTE*& pSendData, OUT DWORD &dwSendLen);
- static void Req_LogOut(IN HP_CONNID dwConnID, IN const BYTE* pReceiveData, IN INT nReceiveLength, IN TheProPackage &thepackage, OUT BYTE*& pSendData, OUT DWORD &dwSendLen);
- // ²¿ÃÅ;
- static void New_Department(IN HP_CONNID dwConnID, IN const BYTE* pReceiveData, IN INT nReceiveLength, IN TheProPackage &thepackage, OUT BYTE*& pSendData, OUT DWORD &dwSendLen);
- static void Del_Department(IN HP_CONNID dwConnID, IN const BYTE* pReceiveData, IN INT nReceiveLength, IN TheProPackage &thepackage, OUT BYTE*& pSendData, OUT DWORD &dwSendLen);
- static void Mod_Department(IN HP_CONNID dwConnID, IN const BYTE* pReceiveData, IN INT nReceiveLength, IN TheProPackage &thepackage, OUT BYTE*& pSendData, OUT DWORD &dwSendLen);
- static EnHandleResult Ask_Department(IN HP_CONNID dwConnID, IN const BYTE* pReceiveData, IN INT nReceiveLength, IN TheProPackage &thepackage, OUT BYTE*& pSendData, OUT DWORD &dwSendLen);
-
- };
- #endif
|