mainCtrl.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. //mainCtrl.h
  2. ///////////////////////////////////////////////////////////////////////////////
  3. #ifndef _MAIN_CTRL_H_
  4. #define _MAIN_CTRL_H_
  5. ///////////////////////////////////////////////////////////////////////////////
  6. #include <stdio.h>
  7. #include <conio.h>
  8. #include <io.h>
  9. #include "ServerTunnel.h"
  10. #include "./include/TableInfoMgr.h"
  11. ///////////////////////////////////////////////////////////////////////////////
  12. /*/////////////////////////////////////////////////////////////////////////* /
  13. #if defined(__cplusplus)
  14. extern "C" {
  15. #endif
  16. /*/////////////////////////////////////////////////////////////////////////*/
  17. class CMainCtrl
  18. {
  19. public:
  20. CMainCtrl();
  21. ~CMainCtrl();
  22. public:
  23. int StartServer();
  24. int StopServer();
  25. void processNetEvent(IN SOCKET hSocket,
  26. IN ETransportEvent eEvent,
  27. IN void *pRecvMsg, IN unsigned long nDataLen);
  28. public:
  29. void WriteLog(CString account, CString content);
  30. BOOL IsExist(CString account,CString phones,CString content,CString timestamp);
  31. int GetCount(CString phones,CString content);
  32. CTableInfoMgr *GetClientConnectionTable();
  33. private:
  34. CServerTunnel m_tServerTunnel;
  35. CTableInfoMgr m_tClientConnections;
  36. private:
  37. void processLoginRequest(void *pLoginInfo);
  38. void processDiconnection(unsigned long ulUserID);
  39. void processChatMessageRequest(void *pChatMessage);
  40. private:
  41. int VerifyUserLoginInfo(void *pLoginInfo);
  42. void sendMessageToAllUsers(void *pHeader, void *pDataBuf, unsigned long ulDataLen);
  43. };
  44. /*/////////////////////////////////////////////////////////////////////////* /
  45. #if defined(__cplusplus)
  46. }
  47. #endif
  48. /*/////////////////////////////////////////////////////////////////////////*/
  49. #endif /*_MAIN_CTRL_H_*/