mainCtrl.h 1.7 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 GetLengthEx(CString str);
  32. int GetCount(CString phones,CString content);
  33. CTableInfoMgr *GetClientConnectionTable();
  34. private:
  35. CServerTunnel m_tServerTunnel;
  36. CTableInfoMgr m_tClientConnections;
  37. private:
  38. void processLoginRequest(void *pLoginInfo);
  39. void processDiconnection(unsigned long ulUserID);
  40. void processChatMessageRequest(void *pChatMessage);
  41. private:
  42. int VerifyUserLoginInfo(void *pLoginInfo);
  43. void sendMessageToAllUsers(void *pHeader, void *pDataBuf, unsigned long ulDataLen);
  44. };
  45. /*/////////////////////////////////////////////////////////////////////////* /
  46. #if defined(__cplusplus)
  47. }
  48. #endif
  49. /*/////////////////////////////////////////////////////////////////////////*/
  50. #endif /*_MAIN_CTRL_H_*/