IServer.h
上传用户:dzyhzl
上传日期:2019-04-29
资源大小:56270k
文件大小:2k
源码类别:

模拟服务器

开发平台:

C/C++

  1. /********************************************************************
  2. created: 2003/03/19
  3. file base: IServer
  4. file ext: h
  5. author: liupeng
  6. purpose: Server interface definition
  7. *********************************************************************/
  8. #ifndef __INCLUDE_INTERFACE_ISERVER_H__
  9. #define __INCLUDE_INTERFACE_ISERVER_H__
  10. #include "HeavenInterface.h"
  11. #include <objbase.h>
  12. /*
  13.  * Antitype : IOCPServer Interface
  14.  */
  15. // {FC6B562E-89C2-4fbc-BF5F-553C09AE93D8}
  16. DEFINE_GUID( IID_IIOCPServer, 
  17. 0xfc6b562e, 0x89c2, 0x4fbc, 0xbf, 0x5f, 0x55, 0x3c, 0x9, 0xae, 0x93, 0xd8);
  18. /*
  19.  * ATTENTION : PLEASE USE IT IN ANSI SETTING
  20.  */
  21. DECLARE_INTERFACE_( IServer, IUnknown )
  22. {
  23. /*
  24.  * Initialize server object and start up it
  25.  */
  26. STDMETHOD( Startup )
  27. (
  28. ) PURE;
  29. /*
  30.  * Stop this object and destroy it
  31.  */
  32. STDMETHOD( Cleanup )
  33. (
  34. ) PURE;
  35. /*
  36.  * Afford service base on an IP.PORT
  37.  */
  38. STDMETHOD( OpenService )
  39. (
  40. const unsigned long &ulnAddressToListenOn,
  41. const unsigned short &usnPortToListenOn
  42. ) PURE;
  43. /*
  44.  * Close the current connection
  45.  */
  46. STDMETHOD( CloseService )
  47. (
  48. ) PURE;
  49. /*
  50.  * Install a callback funtion is used to get event from server
  51.  */
  52. STDMETHOD( RegisterMsgFilter )
  53. (
  54. CALLBACK_SERVER_EVENT pfnEventNotify
  55. ) PURE;
  56. /*
  57.  * prepare to send 
  58.  */
  59. STDMETHOD( PreparePackSink )
  60. (
  61. ) PURE;
  62. /*
  63.  * Add data into client sink but don't to send immediately
  64.  */
  65. STDMETHOD( PackDataToClient )
  66. (
  67. const unsigned long &ulnClientID,
  68. const void * const pData,
  69. const size_t &datalength
  70. ) PURE;
  71. /*
  72.  * Begin to send
  73.  */
  74. STDMETHOD( SendPackToClient )
  75. (
  76. ) PURE;
  77. /*
  78.  * Get some data from a specified client
  79.  */
  80. STDMETHOD_( const void *, GetPackFromClient )
  81. (
  82. const unsigned long &ulnClientID,
  83. size_t &datalength
  84. ) PURE;
  85. /*
  86.  * Disconnect a specified connection
  87.  */
  88. STDMETHOD( ShutdownClient )
  89. (
  90. const unsigned long &ulnClientID
  91. ) PURE;
  92. /*
  93.  * Get current client count
  94.  */
  95. STDMETHOD_( size_t, GetClientCount )
  96. (
  97. ) PURE;
  98. }; // Endof DECLARE_INTERFACE_( IServer ...
  99. #endif // __INCLUDE_INTERFACE_ISERVER_H__