中间件标准版5.1git,去除基础模块

NetCtrlInterface.h 3.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /*************************************************************************
  2. 【文件名】 NetCtrlInterface.h
  3. 【功能模块和目的】 网络连接控制接口头文件
  4. 【开发者及日期】 郑石诺 2015.05.22
  5. 【版本】 V1.0
  6. 【版权信息】 Copyright (C)2015 河南华谊网络科技有限公司
  7. 【更改记录】
  8. *************************************************************************/
  9. #pragma once
  10. #include "PduLinkInc.h"
  11. class CPduEntity;
  12. class IPduLinkProc;
  13. /*************************************************************************
  14. 【类名】 IPduLink
  15. 【功能】 定义PDU连接管理接口
  16. 【接口说明】
  17. 【开发者及日期】 郑石诺 2015.05.22
  18. 【版本】 V1.0
  19. 【版权信息】 Copyright (C)2015 河南华谊网络科技有限公司
  20. 【更改记录】
  21. *************************************************************************/
  22. class IPduLink
  23. {
  24. public:
  25. virtual ~IPduLink(void) = 0 {}
  26. // 连接管理
  27. virtual BOOL GetLinkInfo(CString& a_strIp, int& a_nPort, PDU_DEV_TYPE a_nType, int a_nId) = 0; // 获取指定连接的网络信息
  28. virtual BOOL GetPeerIp(CString& a_strIp, CPduEntity* a_pCmd) = 0; // 获取PDU命令的发送方IP
  29. virtual BOOL CreatePduServer(int a_nListenPort,
  30. PDU_DEV_TYPE a_nLocalType,
  31. int a_nLocalId) = 0; // 创建PDU通讯服务器
  32. virtual BOOL CreatePduClient(CString a_strFarIp,
  33. int a_nFarPort,
  34. PDU_DEV_TYPE a_nLocalType,
  35. int a_nLocalId,
  36. PDU_DEV_TYPE a_nFarType,
  37. int a_nFarId,
  38. bool IsAutoReconnect) = 0; // 创建PDU通讯客户端
  39. virtual BOOL ClosePduClient(PDU_DEV_TYPE a_nFarType,
  40. int a_nFarId) = 0; // 关闭PDU通讯客户端
  41. // 事件处理
  42. virtual BOOL RegistPduLinkProc(IPduLinkProc* a_pPduLinkProc, BOOL bIsInsert) = 0; // 添加/删除订阅
  43. virtual void StopAll(void) = 0;
  44. };
  45. class IPduCommProc;
  46. /*************************************************************************
  47. 【类名】 IPduComm
  48. 【功能】 定义PDU消息传输接口
  49. 【接口说明】
  50. 【开发者及日期】 郑石诺 2015.05.22
  51. 【版本】 V1.0
  52. 【版权信息】 Copyright (C)2015 河南华谊网络科技有限公司
  53. 【更改记录】
  54. *************************************************************************/
  55. class IPduComm
  56. {
  57. public:
  58. virtual ~IPduComm(void) = 0 {}
  59. virtual BOOL Send(CPduEntity* a_pCmd, PDU_DEV_TYPE a_nDestType, int a_nDestId) = 0; // 发送PDU命令(正常发送)
  60. virtual void Send2All(CPduEntity* a_pCmd) = 0; // 向所有已注册的连接发PDU
  61. virtual BOOL RegistPduCommProc(IPduCommProc* a_pPduCommProc, BOOL bIsInsert) = 0; // 添加/取消订阅
  62. };
  63. /*************************************************************************
  64. 【类名】 CInterfaceWindow
  65. 【功能】 获取接口的窗口
  66. 【接口说明】
  67. 【开发者及日期】 郑石诺 2015/07/19
  68. 【版本】 V1.0.0
  69. 【版权信息】 Copyright (C)2015 河南华谊网络科技有限公司
  70. 【更改记录】
  71. *************************************************************************/
  72. class CInterfaceWindow
  73. {
  74. public:
  75. virtual ~CInterfaceWindow(void) = 0 {}
  76. // 两套接口是互斥的,混用将带来不可预估的错误
  77. // IOCP模式的客户端接口不能单独使用必须搭配服务器接口,
  78. // 否则将收不到任何PDU
  79. static IPduLink* getLinkInstance(void); // 得到异步套接字模式下的连接管理接口实例(老接口)
  80. static IPduComm* getCommInstance(void); // 得到异步套接字模式下的消息传输接口实例(老接口)
  81. static IPduLink* getIocpLinkInstance(void); // 得到IOCP模式下的连接管理接口实例
  82. static IPduComm* getIocpCommInstance(void); // 得到IOCP模式下的消息传输接口实例
  83. };