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

模拟服务器

开发平台:

C/C++

  1. /*==========================================================================;
  2.  *
  3.  *  Copyright (C) 2000 Microsoft Corporation.  All Rights Reserved.
  4.  *
  5.  *  File:       dpaddr.h
  6.  *  Content:   DirectPlayAddress include file
  7.  ***************************************************************************/
  8. #ifndef __DIRECTPLAYADDRESS__
  9. #define __DIRECTPLAYADDRESS__
  10. #include <ole2.h> // for DECLARE_INTERFACE and HRESULT
  11. #ifdef __cplusplus
  12. extern "C" {
  13. #endif
  14. #include "dplay8.h"
  15. /****************************************************************************
  16.  *
  17.  * DirectPlay8Address CLSIDs
  18.  *
  19.  ****************************************************************************/
  20. // {934A9523-A3CA-4bc5-ADA0-D6D95D979421}
  21. DEFINE_GUID(CLSID_DirectPlay8Address,
  22. 0x934a9523, 0xa3ca, 0x4bc5, 0xad, 0xa0, 0xd6, 0xd9, 0x5d, 0x97, 0x94, 0x21);
  23. /****************************************************************************
  24.  *
  25.  * DirectPlay8Address Interface IIDs
  26.  *
  27.  ****************************************************************************/
  28. // {83783300-4063-4c8a-9DB3-82830A7FEB31}
  29. DEFINE_GUID(IID_IDirectPlay8Address,
  30. 0x83783300, 0x4063, 0x4c8a, 0x9d, 0xb3, 0x82, 0x83, 0xa, 0x7f, 0xeb, 0x31);
  31. // {E5A0E990-2BAD-430b-87DA-A142CF75DE58}
  32. DEFINE_GUID(IID_IDirectPlay8AddressIP,
  33. 0xe5a0e990, 0x2bad, 0x430b, 0x87, 0xda, 0xa1, 0x42, 0xcf, 0x75, 0xde, 0x58);
  34. /****************************************************************************
  35.  *
  36.  * DirectPlay8Address Interface Pointer definitions
  37.  *
  38.  ****************************************************************************/
  39. typedef struct IDirectPlay8Address *PDIRECTPLAY8ADDRESS, *LPDIRECTPLAY8ADDRESS;
  40. typedef struct IDirectPlay8AddressIP *PDIRECTPLAY8ADDRESSIP, *LPDIRECTPLAY8ADDRESSIP;
  41. /****************************************************************************
  42.  *
  43.  * DirectPlay8Address Forward Declarations For External Types
  44.  *
  45.  ****************************************************************************/
  46. typedef struct sockaddr SOCKADDR;
  47. /****************************************************************************
  48.  *
  49.  * DirectPlay8Address Constants
  50.  *
  51.  ****************************************************************************/
  52. //
  53. // Asynchronous operation flags
  54. //
  55. #define DPNA_DATATYPE_STRING 0x00000001
  56. #define DPNA_DATATYPE_DWORD 0x00000002
  57. #define DPNA_DATATYPE_GUID 0x00000003
  58. #define DPNA_DATATYPE_BINARY 0x00000004
  59. #define DPNA_DATATYPE_STRING_ANSI           0x00000005
  60. #define DPNA_DPNSVR_PORT 6073
  61. #define DPNA_INDEX_INVALID 0xFFFFFFFF
  62. /****************************************************************************
  63.  *
  64.  * DirectPlay8Address Address Elements
  65.  *
  66.  ****************************************************************************/
  67. #define DPNA_SEPARATOR_KEYVALUE L'='
  68. #define DPNA_SEPARATOR_USERDATA L'#'
  69. #define DPNA_SEPARATOR_COMPONENT L';'
  70. #define DPNA_ESCAPECHAR L'%'
  71. // Header
  72. #define DPNA_HEADER                     L"x-directplay:/"
  73. // key names for address components
  74. #define DPNA_KEY_APPLICATION_INSTANCE L"applicationinstance"
  75. #define DPNA_KEY_BAUD L"baud"
  76. #define DPNA_KEY_DEVICE L"device"
  77. #define DPNA_KEY_FLOWCONTROL L"flowcontrol"
  78. #define DPNA_KEY_HOSTNAME L"hostname"
  79. #define DPNA_KEY_PARITY L"parity"
  80. #define DPNA_KEY_PHONENUMBER L"phonenumber"
  81. #define DPNA_KEY_PORT L"port"
  82. #define DPNA_KEY_PROGRAM L"program"
  83. #define DPNA_KEY_PROVIDER L"provider"
  84. #define DPNA_KEY_STOPBITS L"stopbits"
  85. // values for baud rate
  86. #define DPNA_BAUD_RATE_9600 9600
  87. #define DPNA_BAUD_RATE_14400 14400
  88. #define DPNA_BAUD_RATE_19200 19200
  89. #define DPNA_BAUD_RATE_38400 38400
  90. #define DPNA_BAUD_RATE_56000 56000
  91. #define DPNA_BAUD_RATE_57600 57600
  92. #define DPNA_BAUD_RATE_115200 115200
  93. // values for stop bits
  94. #define DPNA_STOP_BITS_ONE L"1"
  95. #define DPNA_STOP_BITS_ONE_FIVE L"1.5"
  96. #define DPNA_STOP_BITS_TWO L"2"
  97. // values for parity
  98. #define DPNA_PARITY_NONE L"NONE"
  99. #define DPNA_PARITY_EVEN L"EVEN"
  100. #define DPNA_PARITY_ODD L"ODD"
  101. #define DPNA_PARITY_MARK L"MARK"
  102. #define DPNA_PARITY_SPACE L"SPACE"
  103. // values for flow control
  104. #define DPNA_FLOW_CONTROL_NONE L"NONE"
  105. #define DPNA_FLOW_CONTROL_XONXOFF L"XONXOFF"
  106. #define DPNA_FLOW_CONTROL_RTS L"RTS"
  107. #define DPNA_FLOW_CONTROL_DTR L"DTR"
  108. #define DPNA_FLOW_CONTROL_RTSDTR L"RTSDTR"
  109. // Shortcut values
  110. //
  111. // These can be used instead of the corresponding CLSID_DP8SP_XXXX guids
  112. //
  113. #define DPNA_VALUE_TCPIPPROVIDER            L"IP"
  114. #define DPNA_VALUE_IPXPROVIDER              L"IPX"
  115. #define DPNA_VALUE_MODEMPROVIDER            L"MODEM"
  116. #define DPNA_VALUE_SERIALPROVIDER           L"SERIAL"
  117. //// ANSI DEFINITIONS
  118. // Header
  119. #define DPNA_HEADER_A "x-directplay:/"
  120. #define DPNA_SEPARATOR_KEYVALUE_A '='
  121. #define DPNA_SEPARATOR_USERDATA_A '#'
  122. #define DPNA_SEPARATOR_COMPONENT_A ';'
  123. #define DPNA_ESCAPECHAR_A '%'
  124. // key names for address components
  125. #define DPNA_KEY_APPLICATION_INSTANCE_A "applicationinstance"
  126. #define DPNA_KEY_BAUD_A "baud"
  127. #define DPNA_KEY_DEVICE_A "device"
  128. #define DPNA_KEY_FLOWCONTROL_A "flowcontrol"
  129. #define DPNA_KEY_HOSTNAME_A "hostname"
  130. #define DPNA_KEY_PARITY_A "parity"
  131. #define DPNA_KEY_PHONENUMBER_A "phonenumber"
  132. #define DPNA_KEY_PORT_A "port"
  133. #define DPNA_KEY_PROGRAM_A "program"
  134. #define DPNA_KEY_PROVIDER_A "provider"
  135. #define DPNA_KEY_STOPBITS_A "stopbits"
  136. // values for stop bits
  137. #define DPNA_STOP_BITS_ONE_A "1"
  138. #define DPNA_STOP_BITS_ONE_FIVE_A "1.5"
  139. #define DPNA_STOP_BITS_TWO_A "2"
  140. // values for parity
  141. #define DPNA_PARITY_NONE_A "NONE"
  142. #define DPNA_PARITY_EVEN_A "EVEN"
  143. #define DPNA_PARITY_ODD_A "ODD"
  144. #define DPNA_PARITY_MARK_A "MARK"
  145. #define DPNA_PARITY_SPACE_A "SPACE"
  146. // values for flow control
  147. #define DPNA_FLOW_CONTROL_NONE_A "NONE"
  148. #define DPNA_FLOW_CONTROL_XONXOFF_A  "XONXOFF"
  149. #define DPNA_FLOW_CONTROL_RTS_A "RTS"
  150. #define DPNA_FLOW_CONTROL_DTR_A "DTR"
  151. #define DPNA_FLOW_CONTROL_RTSDTR_A "RTSDTR"
  152. // Shortcut values
  153. //
  154. // These can be used instead of the corresponding CLSID_DP8SP_XXXX guids
  155. //
  156. #define DPNA_VALUE_TCPIPPROVIDER_A          "IP"
  157. #define DPNA_VALUE_IPXPROVIDER_A            "IPX"
  158. #define DPNA_VALUE_MODEMPROVIDER_A          "MODEM"
  159. #define DPNA_VALUE_SERIALPROVIDER_A         "SERIAL"
  160. /****************************************************************************
  161.  *
  162.  * DirectPlay8Address Functions
  163.  *
  164.  ****************************************************************************/
  165. /*
  166.  * 
  167.  * This function is no longer supported.  It is recommended that CoCreateInstance be used to create 
  168.  * DirectPlay8 address objects. 
  169.  *
  170.  * HRESULT WINAPI DirectPlay8AddressCreate( const GUID * pcIID, void **ppvInterface, IUnknown *pUnknown);
  171.  *
  172.  */
  173. /****************************************************************************
  174.  *
  175.  * DirectPlay8Address Application Interfaces
  176.  *
  177.  ****************************************************************************/
  178. //
  179. // COM definition for IDirectPlay8Address Generic Interface
  180. //
  181. #undef INTERFACE // External COM Implementation
  182. #define INTERFACE IDirectPlay8Address
  183. DECLARE_INTERFACE_(IDirectPlay8Address,IUnknown)
  184. {
  185.     /*** IUnknown methods ***/
  186. STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE;
  187. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  188. STDMETHOD_(ULONG,Release) (THIS) PURE;
  189.     /*** IDirectPlay8Address methods ***/
  190.     STDMETHOD(BuildFromURLW)(THIS_ WCHAR *pwszSourceURL ) PURE;
  191.     STDMETHOD(BuildFromURLA)(THIS_ CHAR *pszSourceURL ) PURE;
  192.     STDMETHOD(Duplicate)(THIS_ PDIRECTPLAY8ADDRESS *ppdpaNewAddress ) PURE;
  193.     STDMETHOD(SetEqual)(THIS_ PDIRECTPLAY8ADDRESS pdpaAddress ) PURE;
  194. STDMETHOD(IsEqual)(THIS_ PDIRECTPLAY8ADDRESS pdpaAddress ) PURE;
  195.     STDMETHOD(Clear)(THIS ) PURE;
  196.     STDMETHOD(GetURLW)(THIS_ WCHAR *pwszURL, PDWORD pdwNumChars ) PURE;
  197.     STDMETHOD(GetURLA)(THIS_ CHAR *pszURL, PDWORD pdwNumChars) PURE;
  198.     STDMETHOD(GetSP)(THIS_ GUID *pguidSP ) PURE;
  199.     STDMETHOD(GetUserData)(THIS_ void *pvUserData, PDWORD pdwBufferSize) PURE;
  200.     STDMETHOD(SetSP)(THIS_ const GUID * const pguidSP ) PURE;
  201.     STDMETHOD(SetUserData)(THIS_ const void * const pvUserData, const DWORD dwDataSize) PURE;
  202.     STDMETHOD(GetNumComponents)(THIS_ PDWORD pdwNumComponents ) PURE;
  203.     STDMETHOD(GetComponentByName)(THIS_ const WCHAR * const pwszName, void *pvBuffer, PDWORD pdwBufferSize, PDWORD pdwDataType ) PURE;
  204.     STDMETHOD(GetComponentByIndex)(THIS_ const DWORD dwComponentID, WCHAR * pwszName, PDWORD pdwNameLen, void *pvBuffer, PDWORD pdwBufferSize, PDWORD pdwDataType ) PURE;
  205.     STDMETHOD(AddComponent)(THIS_ const WCHAR * const pwszName, const void * const lpvData, const DWORD dwDataSize, const DWORD dwDataType ) PURE;
  206.     STDMETHOD(GetDevice)(THIS_  GUID * ) PURE;
  207.     STDMETHOD(SetDevice)(THIS_  const GUID * const) PURE;
  208.     STDMETHOD(BuildFromDPADDRESS)( THIS_ LPVOID pvAddress, DWORD dwDataSize ) PURE;
  209. };
  210. //
  211. // COM definition for IDirectPlay8AddressIP Generic Interface
  212. //
  213. #undef INTERFACE // External COM Implementation
  214. #define INTERFACE IDirectPlay8AddressIP
  215. DECLARE_INTERFACE_(IDirectPlay8AddressIP,IUnknown)
  216. {
  217.     /*** IUnknown methods ***/
  218. STDMETHOD(QueryInterface) (THIS_ REFIID, PVOID *) PURE;
  219. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  220. STDMETHOD_(ULONG,Release) (THIS) PURE;
  221. /*** IDirectPlay8AddressIP methods ***/
  222. // Constructs a IDirectPlay8 TCP Address from a SOCKADDR structure
  223. STDMETHOD(BuildFromSockAddr)(THIS_ const SOCKADDR * const ) PURE;
  224. // Constructs a TCP Address from a string (hostname) and port
  225. STDMETHOD(BuildAddress)(THIS_ const WCHAR * const wszAddress, const USHORT usPort ) PURE;
  226. // Builds a local TCP Address
  227. STDMETHOD(BuildLocalAddress)(THIS_ const GUID * const pguidAdapter, const USHORT usPort ) PURE;
  228. // Gets the address from the structure in SOCKADR format
  229. STDMETHOD(GetSockAddress)(THIS_ SOCKADDR *, PDWORD ) PURE;
  230. // Gets the local afddress
  231. STDMETHOD(GetLocalAddress)(THIS_ GUID *pguidAdapter, USHORT *pusPort ) PURE;
  232. // Gets the remote address
  233. STDMETHOD(GetAddress)(THIS_ WCHAR *wszAddress, PDWORD pdwAddressLength, USHORT *psPort ) PURE;
  234. };
  235. /****************************************************************************
  236.  *
  237.  * IDirectPlay8 application interface macros
  238.  *
  239.  ****************************************************************************/
  240. #if !defined(__cplusplus) || defined(CINTERFACE)
  241. #define IDirectPlay8Address_QueryInterface(p,a,b)     (p)->lpVtbl->QueryInterface(p,a,b)
  242. #define IDirectPlay8Address_AddRef(p)               (p)->lpVtbl->AddRef(p)
  243. #define IDirectPlay8Address_Release(p)              (p)->lpVtbl->Release(p)
  244. #define IDirectPlay8Address_BuildFromURLW(p,a)     (p)->lpVtbl->BuildFromURLW(p,a)
  245. #define IDirectPlay8Address_BuildFromURLA(p,a)     (p)->lpVtbl->BuildFromURLA(p,a)
  246. #define IDirectPlay8Address_Duplicate(p,a)     (p)->lpVtbl->Duplicate(p,a)
  247. #define IDirectPlay8Address_SetEqual(p,a)                   (p)->lpVtbl->SetEqual(p,a)
  248. #define IDirectPlay8Address_IsEqual(p,a)         (p)->lpVtbl->IsEqual(p,a)
  249. #define IDirectPlay8Address_Clear(p)     (p)->lpVtbl->Clear(p)
  250. #define IDirectPlay8Address_GetURLW(p,a,b)     (p)->lpVtbl->GetURLW(p,a,b)
  251. #define IDirectPlay8Address_GetURLA(p,a,b)     (p)->lpVtbl->GetURLA(p,a,b)
  252. #define IDirectPlay8Address_GetSP(p,a)     (p)->lpVtbl->GetSP(p,a)
  253. #define IDirectPlay8Address_GetUserData(p,a,b)     (p)->lpVtbl->GetUserData(p,a,b)
  254. #define IDirectPlay8Address_SetSP(p,a)     (p)->lpVtbl->SetSP(p,a)
  255. #define IDirectPlay8Address_SetUserData(p,a,b)     (p)->lpVtbl->SetUserData(p,a,b)
  256. #define IDirectPlay8Address_GetNumComponents(p,a)     (p)->lpVtbl->GetNumComponents(p,a)
  257. #define IDirectPlay8Address_GetComponentByName(p,a,b,c,d) (p)->lpVtbl->GetComponentByName(p,a,b,c,d)
  258. #define IDirectPlay8Address_GetComponentByIndex(p,a,b,c,d,e,f) (p)->lpVtbl->GetComponentByIndex(p,a,b,c,d,e,f)
  259. #define IDirectPlay8Address_AddComponent(p,a,b,c,d)     (p)->lpVtbl->AddComponent(p,a,b,c,d)
  260. #define IDirectPlay8Address_SetDevice(p,a)     (p)->lpVtbl->SetDevice(p,a)
  261. #define IDirectPlay8Address_GetDevice(p,a)     (p)->lpVtbl->GetDevice(p,a)
  262. #define IDirectPlay8Address_BuildFromDirectPlay4Address(p,a,b)  (p)->lpVtbl->BuildFromDirectPlay4Address(p,a,b)
  263. #define IDirectPlay8AddressIP_QueryInterface(p,a,b)     (p)->lpVtbl->QueryInterface(p,a,b)
  264. #define IDirectPlay8AddressIP_AddRef(p)               (p)->lpVtbl->AddRef(p)
  265. #define IDirectPlay8AddressIP_Release(p)              (p)->lpVtbl->Release(p)
  266. #define IDirectPlay8AddressIP_BuildFromSockAddr(p,a)     (p)->lpVtbl->BuildFromSockAddr(p,a)
  267. #define IDirectPlay8AddressIP_BuildAddress(p,a,b)     (p)->lpVtbl->BuildAddress(p,a,b)
  268. #define IDirectPlay8AddressIP_BuildLocalAddress(p,a,b)     (p)->lpVtbl->BuildLocalAddress(p,a,b)
  269. #define IDirectPlay8AddressIP_GetSockAddress(p,a,b)     (p)->lpVtbl->GetSockAddress(p,a,b)
  270. #define IDirectPlay8AddressIP_GetLocalAddress(p,a,b)     (p)->lpVtbl->GetLocalAddress(p,a,b)
  271. #define IDirectPlay8AddressIP_GetAddress(p,a,b,c)     (p)->lpVtbl->GetAddress(p,a,b,c)
  272. #else /* C++ */
  273. #define IDirectPlay8Address_QueryInterface(p,a,b)     (p)->QueryInterface(a,b)
  274. #define IDirectPlay8Address_AddRef(p)               (p)->AddRef()
  275. #define IDirectPlay8Address_Release(p)              (p)->Release()
  276. #define IDirectPlay8Address_BuildFromURLW(p,a)     (p)->BuildFromURLW(a)
  277. #define IDirectPlay8Address_BuildFromURLA(p,a)     (p)->BuildFromURLA(a)
  278. #define IDirectPlay8Address_Duplicate(p,a)     (p)->Duplicate(a)
  279. #define IDirectPlay8Address_SetEqual(p,a)                   (p)->SetEqual(a)
  280. #define IDirectPlay8Address_IsEqual(p,a)         (p)->IsEqual(a)
  281. #define IDirectPlay8Address_Clear(p)     (p)->Clear()
  282. #define IDirectPlay8Address_GetURLW(p,a,b)     (p)->GetURLW(a,b)
  283. #define IDirectPlay8Address_GetURLA(p,a,b)     (p)->GetURLA(a,b)
  284. #define IDirectPlay8Address_GetSP(p,a)     (p)->GetSP(a)
  285. #define IDirectPlay8Address_GetUserData(p,a,b)     (p)->GetUserData(a,b)
  286. #define IDirectPlay8Address_SetSP(p,a)     (p)->SetSP(a)
  287. #define IDirectPlay8Address_SetUserData(p,a,b)     (p)->SetUserData(a,b)
  288. #define IDirectPlay8Address_GetNumComponents(p,a)     (p)->GetNumComponents(a)
  289. #define IDirectPlay8Address_GetComponentByName(p,a,b,c,d) (p)->GetComponentByName(a,b,c,d)
  290. #define IDirectPlay8Address_GetComponentByIndex(p,a,b,c,d,e,f) (p)->GetComponentByIndex(a,b,c,d,e,f)
  291. #define IDirectPlay8Address_AddComponent(p,a,b,c,d)     (p)->AddComponent(a,b,c,d)
  292. #define IDirectPlay8Address_SetDevice(p,a)     (p)->SetDevice(a)
  293. #define IDirectPlay8Address_GetDevice(p,a)     (p)->GetDevice(a)
  294. #define IDirectPlay8Address_BuildFromDirectPlay4Address(p,a,b)  (p)->BuildFromDirectPlay4Address(a,b)
  295. #define IDirectPlay8AddressIP_QueryInterface(p,a,b)     (p)->QueryInterface(a,b)
  296. #define IDirectPlay8AddressIP_AddRef(p)               (p)->AddRef()
  297. #define IDirectPlay8AddressIP_Release(p)              (p)->Release()
  298. #define IDirectPlay8AddressIP_BuildFromSockAddr(p,a)     (p)->BuildFromSockAddr(a)
  299. #define IDirectPlay8AddressIP_BuildAddress(p,a,b)     (p)->BuildAddress(a,b)
  300. #define IDirectPlay8AddressIP_BuildLocalAddress(p,a,b)     (p)->BuildLocalAddress(a,b)
  301. #define IDirectPlay8AddressIP_GetSockAddress(p,a,b)     (p)->GetSockAddress(a,b)
  302. #define IDirectPlay8AddressIP_GetLocalAddress(p,a,b)     (p)->GetLocalAddress(a,b)
  303. #define IDirectPlay8AddressIP_GetAddress(p,a,b,c)     (p)->GetAddress(a,b,c)
  304. #endif
  305. #ifdef __cplusplus
  306. }
  307. #endif
  308. #endif