home *** CD-ROM | disk | FTP | other *** search
/ Beginning Direct3D Game Programming / Direct3D.iso / directx / dxf / include / dpaddr.h < prev    next >
C/C++ Source or Header  |  2000-10-20  |  16KB  |  369 lines

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