Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

539 lines
18 KiB

  1. /*==========================================================================
  2. *
  3. * Copyright (C) 1999-2002 Microsoft Corporation. All Rights Reserved.
  4. *
  5. * File: SPAddress.h
  6. * Content: Winsock address base class
  7. *
  8. *
  9. * History:
  10. * Date By Reason
  11. * ==== == ======
  12. * 01/20/1999 jtk Created
  13. * 05/11/1999 jtk Split out to make a base class
  14. * 01/10/2000 rmt Updated to build with Millenium build process
  15. * 03/22/2000 jtk Updated with changes to interface names
  16. ***************************************************************************/
  17. #ifndef __SP_ADDRESS_H__
  18. #define __SP_ADDRESS_H__
  19. //**********************************************************************
  20. // Constant definitions
  21. //**********************************************************************
  22. //
  23. // enumerated values for noting which components have been initialized
  24. //
  25. typedef enum
  26. {
  27. SPADDRESS_PARSE_KEY_DEVICE = 0,
  28. SPADDRESS_PARSE_KEY_HOSTNAME,
  29. SPADDRESS_PARSE_KEY_PORT,
  30. // this must be the last item
  31. SPADDRESS_PARSE_KEY_MAX
  32. } SPADDRESS_PARSE_KEY_INDEX;
  33. //
  34. // these are only for the debug build, but make sure they don't match
  35. // any legal values, anyway
  36. //
  37. #define INVALID_SOCKET_FAMILY 0
  38. #define INVALID_SOCKET_PROTOCOL 5000
  39. //
  40. // types of addresses
  41. //
  42. typedef enum
  43. {
  44. SP_ADDRESS_TYPE_UNKNOWN = 0, // unknown
  45. SP_ADDRESS_TYPE_DEVICE_USE_ANY_PORT, // address is for local device and dynamically bind to a port
  46. SP_ADDRESS_TYPE_DEVICE, // address is for local device the port must be set
  47. SP_ADDRESS_TYPE_HOST, // address is for a remote host (default port always used if none specified)
  48. SP_ADDRESS_TYPE_READ_HOST, // address is for a remote host address from a socket read
  49. SP_ADDRESS_TYPE_PUBLIC_HOST_ADDRESS, // public address for this host
  50. #ifndef DPNBUILD_NOMULTICAST
  51. SP_ADDRESS_TYPE_MULTICAST_GROUP, // multicast group address
  52. #endif // ! DPNBUILD_NOMULTICAST
  53. } SP_ADDRESS_TYPE;
  54. //
  55. // define for any port
  56. //
  57. #define ANY_PORT ((WORD) 0)
  58. //**********************************************************************
  59. // Macro definitions
  60. //**********************************************************************
  61. //**********************************************************************
  62. // Structure definitions
  63. //**********************************************************************
  64. //**********************************************************************
  65. // Variable definitions
  66. //**********************************************************************
  67. //
  68. // external variables
  69. //
  70. extern const WCHAR g_IPBroadcastAddress[];
  71. extern const DWORD g_dwIPBroadcastAddressSize;
  72. //**********************************************************************
  73. // Function prototypes
  74. //**********************************************************************
  75. //
  76. // GUID encryption/decription code. Note that it's presently an XOR function
  77. // so map the decryption code to the encryption function.
  78. //
  79. void EncryptGuid( const GUID *const pSourceGuid,
  80. GUID *const pDestinationGuid,
  81. const GUID *const pEncrpytionKey );
  82. inline void DecryptGuid( const GUID *const pSourceGuid,
  83. GUID *const pDestinationGuid,
  84. const GUID *const pEncryptionKey ) { EncryptGuid( pSourceGuid, pDestinationGuid, pEncryptionKey ); }
  85. //**********************************************************************
  86. // Class definition
  87. //**********************************************************************
  88. //
  89. // This class assumes that the size of a SOCKADDR is constant, and equal to
  90. // the size of a SOCKADDR_IN and 2 bytes larger than a SOCKADDR_IPX!
  91. //
  92. class CSocketAddress
  93. {
  94. public:
  95. //
  96. // Pool functions
  97. //
  98. static BOOL PoolAllocFunction( void* pvItem, void* pvContext );
  99. static void PoolGetFunction( void* pvItem, void* pvContext );
  100. static void PoolReturnFunction( void* pvItem );
  101. #undef DPF_MODNAME
  102. #define DPF_MODNAME "CSocketAddress::GetPort"
  103. WORD GetPort( void ) const
  104. {
  105. #if ((! defined(DPNBUILD_NOIPV6)) || (! defined(DPNBUILD_NOIPX)))
  106. switch (m_SocketAddress.SocketAddress.sa_family)
  107. #endif // ! DPNBUILD_NOIPV6 or ! DPNBUILD_NOIPX
  108. {
  109. #ifndef DPNBUILD_NOIPV6
  110. case AF_INET6:
  111. {
  112. return m_SocketAddress.IPv6SocketAddress.sin6_port;
  113. break;
  114. }
  115. #endif // ! DPNBUILD_NOIPV6
  116. #ifndef DPNBUILD_NOIPX
  117. case AF_IPX:
  118. {
  119. return m_SocketAddress.IPXSocketAddress.sa_socket;
  120. break;
  121. }
  122. #endif // ! DPNBUILD_NOIPX
  123. #if ((! defined(DPNBUILD_NOIPV6)) || (! defined(DPNBUILD_NOIPX)))
  124. default:
  125. #endif // ! DPNBUILD_NOIPV6 or ! DPNBUILD_NOIPX
  126. {
  127. DNASSERT(m_SocketAddress.SocketAddress.sa_family == AF_INET);
  128. return m_SocketAddress.IPSocketAddress.sin_port;
  129. #if ((! defined(DPNBUILD_NOIPV6)) || (! defined(DPNBUILD_NOIPX)))
  130. break;
  131. #endif // ! DPNBUILD_NOIPV6 or ! DPNBUILD_NOIPX
  132. }
  133. }
  134. }
  135. #undef DPF_MODNAME
  136. #define DPF_MODNAME "CSocketAddress::SetPort"
  137. void SetPort( const WORD wPort )
  138. {
  139. #if ((! defined(DPNBUILD_NOIPV6)) || (! defined(DPNBUILD_NOIPX)))
  140. switch (m_SocketAddress.SocketAddress.sa_family)
  141. #endif // ! DPNBUILD_NOIPV6 or ! DPNBUILD_NOIPX
  142. {
  143. #ifndef DPNBUILD_NOIPV6
  144. case AF_INET6:
  145. {
  146. m_SocketAddress.IPv6SocketAddress.sin6_port = wPort;
  147. break;
  148. }
  149. #endif // ! DPNBUILD_NOIPV6
  150. #ifndef DPNBUILD_NOIPX
  151. case AF_IPX:
  152. {
  153. m_SocketAddress.IPXSocketAddress.sa_socket = wPort;
  154. break;
  155. }
  156. #endif // ! DPNBUILD_NOIPX
  157. #if ((! defined(DPNBUILD_NOIPV6)) || (! defined(DPNBUILD_NOIPX)))
  158. default:
  159. #endif // ! DPNBUILD_NOIPV6 or ! DPNBUILD_NOIPX
  160. {
  161. DNASSERT(m_SocketAddress.SocketAddress.sa_family == AF_INET);
  162. m_SocketAddress.IPSocketAddress.sin_port = wPort;
  163. #if ((! defined(DPNBUILD_NOIPV6)) || (! defined(DPNBUILD_NOIPX)))
  164. break;
  165. #endif // ! DPNBUILD_NOIPV6 or ! DPNBUILD_NOIPX
  166. }
  167. }
  168. }
  169. void InitializeWithBroadcastAddress( void );
  170. void SetAddressFromSOCKADDR( const SOCKADDR *pAddress, const INT_PTR iAddressSize );
  171. HRESULT SocketAddressFromDP8Address( IDirectPlay8Address *const pDP8Address,
  172. #ifdef DPNBUILD_XNETSECURITY
  173. ULONGLONG * const pullKeyID,
  174. #endif // DPNBUILD_XNETSECURITY
  175. #ifndef DPNBUILD_ONLYONETHREAD
  176. const BOOL fAllowNameResolution,
  177. #endif // ! DPNBUILD_ONLYONETHREAD
  178. const SP_ADDRESS_TYPE AddressType );
  179. #ifdef DPNBUILD_XNETSECURITY
  180. IDirectPlay8Address *DP8AddressFromSocketAddress( ULONGLONG * const pullKeyID,
  181. const XNADDR * const pxnaddr,
  182. const SP_ADDRESS_TYPE AddressType ) const;
  183. #else // ! DPNBUILD_XNETSECURITY
  184. IDirectPlay8Address *DP8AddressFromSocketAddress( const SP_ADDRESS_TYPE AddressType ) const;
  185. #endif // ! DPNBUILD_XNETSECURITY
  186. static BOOL CompareFunction( PVOID pvKey1, PVOID pvKey2 );
  187. static DWORD HashFunction( PVOID pvKey, BYTE bBitDepth );
  188. INT_PTR CompareToBaseAddress( const SOCKADDR *const pBaseAddress ) const;
  189. #ifndef DPNBUILD_ONLYONEADAPTER
  190. HRESULT EnumAdapters( SPENUMADAPTERSDATA *const pEnumData ) const;
  191. #ifndef DPNBUILD_NOIPX
  192. HRESULT EnumIPXAdapters( SPENUMADAPTERSDATA *const pEnumData ) const;
  193. #endif // ! DPNBUILD_NOIPX
  194. HRESULT EnumIPv4Adapters( SPENUMADAPTERSDATA *const pEnumData ) const;
  195. #ifndef DPNBUILD_NOIPV6
  196. HRESULT EnumIPv6and4Adapters( SPENUMADAPTERSDATA *const pEnumData ) const;
  197. #endif // ! DPNBUILD_NOIPV6
  198. #endif // ! DPNBUILD_ONLYONEADAPTER
  199. #ifndef DPNBUILD_NOMULTICAST
  200. HRESULT EnumMulticastScopes( SPENUMMULTICASTSCOPESDATA *const pEnumData, BOOL const fUseMADCAP ) const;
  201. HRESULT SocketAddressFromMulticastDP8Address( IDirectPlay8Address * const pDP8Address,
  202. #ifdef DPNBUILD_XNETSECURITY
  203. ULONGLONG * const pullKeyID,
  204. #endif // DPNBUILD_XNETSECURITY
  205. GUID * const pScopeGuid );
  206. #endif // ! DPNBUILD_NOMULTICAST
  207. void GuidFromInternalAddressWithoutPort( GUID * pOutputGuid ) const;
  208. BOOL IsUndefinedHostAddress( void ) const;
  209. BOOL IsValidUnicastAddress( BOOL fAllowBroadcastAddress ) const;
  210. #ifndef DPNBUILD_NOREGISTRY
  211. BOOL IsBannedAddress( void ) const;
  212. #endif // ! DPNBUILD_NOREGISTRY
  213. void ChangeLoopBackToLocalAddress( const CSocketAddress *const pOtherAddress );
  214. #undef DPF_MODNAME
  215. #define DPF_MODNAME "CSocketAddress::AddressFromGuid"
  216. #ifdef DPNBUILD_NOIPV6
  217. void AddressFromGuid( const GUID * pInputGuid, SOCKADDR * pSocketAddress ) const
  218. #else // ! DPNBUILD_NOIPV6
  219. void AddressFromGuid( const GUID * pInputGuid, SOCKADDR_STORAGE * pSocketAddress ) const
  220. #endif // ! DPNBUILD_NOIPV6
  221. {
  222. #if ((! defined(DPNBUILD_NOIPV6)) || (! defined(DPNBUILD_NOIPX)))
  223. switch (m_SocketAddress.SocketAddress.sa_family)
  224. #endif // ! DPNBUILD_NOIPV6 or ! DPNBUILD_NOIPX
  225. {
  226. #ifndef DPNBUILD_NOIPV6
  227. case AF_INET6:
  228. {
  229. SOCKADDR_IN6 * psaddrin6 = (SOCKADDR_IN6*) pSocketAddress;
  230. DecryptGuid( pInputGuid, reinterpret_cast<GUID*>( &(psaddrin6->sin6_addr) ), &g_IPSPEncryptionGuid );
  231. //
  232. // Link local and site local addresses have the scope ID packed into the
  233. // address as well. See CSocketAddress::GuidFromAddress.
  234. //
  235. if ((IN6_IS_ADDR_LINKLOCAL(&psaddrin6->sin6_addr)) ||
  236. (IN6_IS_ADDR_SITELOCAL(&psaddrin6->sin6_addr)))
  237. {
  238. WORD * pawSrcAddr;
  239. WORD * pawDstAddr;
  240. //
  241. // Copy the scope ID then zero out the parts of the address that
  242. // were used.
  243. // The source bits are WORD, but not DWORD aligned.
  244. //
  245. pawSrcAddr = (WORD*) (&psaddrin6->sin6_addr);
  246. pawDstAddr = (WORD*) (&psaddrin6->sin6_scope_id);
  247. DBG_CASSERT(sizeof(psaddrin6->sin6_scope_id) == 4);
  248. pawDstAddr[0] = pawSrcAddr[1];
  249. pawDstAddr[1] = pawSrcAddr[2];
  250. pawSrcAddr[1] = 0;
  251. pawSrcAddr[2] = 0;
  252. DNASSERT(psaddrin6->sin6_scope_id != 0);
  253. }
  254. else
  255. {
  256. psaddrin6->sin6_scope_id = 0;
  257. }
  258. break;
  259. }
  260. #endif // ! DPNBUILD_NOIPV6
  261. #ifndef DPNBUILD_NOIPX
  262. case AF_IPX:
  263. {
  264. DecryptGuid( pInputGuid, reinterpret_cast<GUID*>( pSocketAddress ), &g_IPXSPEncryptionGuid );
  265. break;
  266. }
  267. #endif // ! DPNBUILD_NOIPX
  268. #if ((! defined(DPNBUILD_NOIPV6)) || (! defined(DPNBUILD_NOIPX)))
  269. default:
  270. #endif // ! DPNBUILD_NOIPV6 or ! DPNBUILD_NOIPX
  271. {
  272. DNASSERT(m_SocketAddress.SocketAddress.sa_family == AF_INET);
  273. DecryptGuid( pInputGuid, reinterpret_cast<GUID*>( pSocketAddress ), &g_IPSPEncryptionGuid );
  274. #if ((! defined(DPNBUILD_NOIPV6)) || (! defined(DPNBUILD_NOIPX)))
  275. break;
  276. #endif // ! DPNBUILD_NOIPV6 or ! DPNBUILD_NOIPX
  277. }
  278. }
  279. }
  280. #ifndef DPNBUILD_NOMULTICAST
  281. #ifdef WINNT
  282. #undef DPF_MODNAME
  283. #define DPF_MODNAME "CSocketAddress::CreateScopeGuid"
  284. #ifdef DPNBUILD_NOIPV6
  285. static void CreateScopeGuid( const MCAST_SCOPE_CTX * const pMcastScopeCtx, const BYTE bTTL, GUID * const pOutputGuid )
  286. #else // ! DPNBUILD_NOIPV6
  287. static void CreateScopeGuid( const USHORT usAddressFamily, const MCAST_SCOPE_CTX * const pMcastScopeCtx, const BYTE bTTL, GUID * const pOutputGuid )
  288. #endif // ! DPNBUILD_NOIPV6
  289. {
  290. GUID guidTemp;
  291. BYTE * pCurrent;
  292. #ifndef DPNBUILD_NOIPV6
  293. if (usAddressFamily == AF_INET6)
  294. {
  295. #pragma TODO(vanceo, "Make IPv6 ready"
  296. }
  297. else
  298. #endif // ! DPNBUILD_NOIPV6
  299. {
  300. DBG_CASSERT( (sizeof( pMcastScopeCtx->ScopeID.IpAddrV4 ) + sizeof( pMcastScopeCtx->Interface.IpAddrV4 ) + sizeof( pMcastScopeCtx->ServerID.IpAddrV4 ) + sizeof( bTTL ) ) <= sizeof( guidTemp ) );
  301. memset( &guidTemp, 0, sizeof( guidTemp ) );
  302. pCurrent = reinterpret_cast<BYTE*>( &guidTemp );
  303. memcpy( pCurrent, &pMcastScopeCtx->ScopeID.IpAddrV4, sizeof( pMcastScopeCtx->ScopeID.IpAddrV4 ) );
  304. pCurrent += sizeof( pMcastScopeCtx->ScopeID.IpAddrV4 );
  305. memcpy( pCurrent, &pMcastScopeCtx->Interface.IpAddrV4, sizeof( pMcastScopeCtx->Interface.IpAddrV4 ) );
  306. pCurrent += sizeof( pMcastScopeCtx->Interface.IpAddrV4 );
  307. memcpy( pCurrent, &pMcastScopeCtx->ServerID.IpAddrV4, sizeof( pMcastScopeCtx->ServerID.IpAddrV4 ) );
  308. pCurrent += sizeof( pMcastScopeCtx->ServerID.IpAddrV4 );
  309. *pCurrent = bTTL;
  310. }
  311. EncryptGuid( &guidTemp, pOutputGuid, &g_IPSPEncryptionGuid );
  312. }
  313. static void GetScopeGuidMcastScopeCtx( const GUID * const pInputGuid, MCAST_SCOPE_CTX * const pMcastScopeCtx )
  314. {
  315. GUID guidTemp;
  316. BYTE * pCurrent;
  317. DecryptGuid( pInputGuid, &guidTemp, &g_IPSPEncryptionGuid );
  318. pCurrent = reinterpret_cast<BYTE*>( &guidTemp );
  319. memcpy( &pMcastScopeCtx->ScopeID.IpAddrV4, pCurrent, sizeof( pMcastScopeCtx->ScopeID.IpAddrV4 ) );
  320. pCurrent += sizeof( pMcastScopeCtx->ScopeID.IpAddrV4 );
  321. memcpy( &pMcastScopeCtx->Interface.IpAddrV4, pCurrent, sizeof( pMcastScopeCtx->Interface.IpAddrV4 ) );
  322. pCurrent += sizeof( pMcastScopeCtx->Interface.IpAddrV4 );
  323. memcpy( &pMcastScopeCtx->ServerID.IpAddrV4, pCurrent, sizeof( pMcastScopeCtx->ServerID.IpAddrV4 ) );
  324. }
  325. #endif // WINNT
  326. #undef DPF_MODNAME
  327. #define DPF_MODNAME "CSocketAddress::GetScopeGuidTTL"
  328. static BYTE GetScopeGuidTTL( const GUID * const pInputGuid )
  329. {
  330. GUID guidTemp;
  331. BYTE * pCurrent;
  332. BYTE bTTL;
  333. DecryptGuid( pInputGuid, &guidTemp, &g_IPSPEncryptionGuid );
  334. pCurrent = reinterpret_cast<BYTE*>( &guidTemp );
  335. bTTL = *(pCurrent + ( sizeof( DWORD ) * 3 ));
  336. if (bTTL == 0)
  337. {
  338. DPFX(DPFPREP, 0, "Overriding invalid TTL, setting to 1!", 0);
  339. bTTL = 1;
  340. }
  341. return bTTL;
  342. }
  343. #endif // ! DPNBUILD_NOMULTICAST
  344. const SOCKADDR *GetAddress( void ) const { return &m_SocketAddress.SocketAddress; }
  345. SOCKADDR *GetWritableAddress( void ) { return &m_SocketAddress.SocketAddress; }
  346. #undef DPF_MODNAME
  347. #define DPF_MODNAME "CSocketAddress::GetAddressSize"
  348. const INT GetAddressSize( void ) const
  349. {
  350. DNASSERT( m_iSocketAddressSize != 0 );
  351. return m_iSocketAddressSize;
  352. }
  353. #undef DPF_MODNAME
  354. #define DPF_MODNAME "CSocketAddress::CopyAddressSettings"
  355. void CopyAddressSettings( const CSocketAddress * const pOtherAddress )
  356. {
  357. DBG_CASSERT( sizeof( m_SocketAddress ) == sizeof( pOtherAddress->m_SocketAddress ) );
  358. memcpy( &m_SocketAddress, &pOtherAddress->m_SocketAddress, sizeof( m_SocketAddress ) );
  359. m_iSocketAddressSize = pOtherAddress->m_iSocketAddressSize;
  360. }
  361. #undef DPF_MODNAME
  362. #define DPF_MODNAME "CSocketAddress::GetFamily"
  363. USHORT GetFamily( void ) const
  364. {
  365. DBG_CASSERT( sizeof( m_SocketAddress.SocketAddress.sa_family ) == sizeof( m_SocketAddress.IPSocketAddress.sin_family ) );
  366. DBG_CASSERT( OFFSETOF( SOCKADDR, sa_family ) == OFFSETOF( SOCKADDR_IN, sin_family ) );
  367. #ifndef DPNBUILD_NOIPV6
  368. DBG_CASSERT( sizeof( m_SocketAddress.SocketAddress.sa_family ) == sizeof( m_SocketAddress.IPv6SocketAddress.sin6_family ) );
  369. DBG_CASSERT( OFFSETOF( SOCKADDR, sa_family ) == OFFSETOF( SOCKADDR_IN6, sin6_family ) );
  370. #endif // DPNBUILD_NOIPV6
  371. #ifndef DPNBUILD_NOIPX
  372. DBG_CASSERT( sizeof( m_SocketAddress.SocketAddress.sa_family ) == sizeof( m_SocketAddress.IPXSocketAddress.sa_family ) );
  373. DBG_CASSERT( OFFSETOF( SOCKADDR, sa_family ) == OFFSETOF( SOCKADDR_IPX, sa_family ) );
  374. #endif // DPNBUILD_NOIPX
  375. DNASSERT( m_SocketAddress.SocketAddress.sa_family != INVALID_SOCKET_FAMILY );
  376. #ifdef DPNBUILD_NOIPX
  377. #ifdef DPNBUILD_NOIPV6
  378. DNASSERT( ( m_SocketAddress.SocketAddress.sa_family == AF_INET ));
  379. #else
  380. DNASSERT( ( m_SocketAddress.SocketAddress.sa_family == AF_INET ) || ( m_SocketAddress.SocketAddress.sa_family == AF_INET6 ));
  381. #endif // DPNBUILD_NOIPV6
  382. #else
  383. #ifdef DPNBUILD_NOIPV6
  384. DNASSERT( ( m_SocketAddress.SocketAddress.sa_family == AF_INET ) || ( m_SocketAddress.SocketAddress.sa_family == AF_IPX ));
  385. #else
  386. DNASSERT( ( m_SocketAddress.SocketAddress.sa_family == AF_INET ) || ( m_SocketAddress.SocketAddress.sa_family == AF_INET6 ) || ( m_SocketAddress.SocketAddress.sa_family == AF_IPX ));
  387. #endif // DPNBUILD_NOIPV6
  388. #endif // DPNBUILD_NOIPX
  389. return m_SocketAddress.SocketAddress.sa_family;
  390. }
  391. #undef DPF_MODNAME
  392. #define DPF_MODNAME "CSocketAddress::SetFamilyProtocolAndSize"
  393. void SetFamilyProtocolAndSize( short sFamily )
  394. {
  395. memset( &m_SocketAddress, 0x00, sizeof( m_SocketAddress ) );
  396. switch (sFamily)
  397. {
  398. #ifndef DPNBUILD_NOIPV6
  399. case AF_INET6:
  400. {
  401. m_SocketAddress.IPv6SocketAddress.sin6_family = AF_INET6;
  402. m_iSocketAddressSize = sizeof( m_SocketAddress.IPv6SocketAddress );
  403. m_iSocketProtocol = IPPROTO_UDP;
  404. break;
  405. }
  406. #endif // ! DPNBUILD_NOIPV6
  407. #ifndef DPNBUILD_NOIPX
  408. case AF_IPX:
  409. {
  410. m_SocketAddress.IPXSocketAddress.sa_family = AF_IPX;
  411. m_iSocketAddressSize = sizeof( m_SocketAddress.IPXSocketAddress );
  412. m_iSocketProtocol = NSPROTO_IPX;
  413. break;
  414. }
  415. #endif // ! DPNBUILD_NOIPX
  416. case AF_INET:
  417. {
  418. m_SocketAddress.IPSocketAddress.sin_family = AF_INET;
  419. m_iSocketAddressSize = sizeof( m_SocketAddress.IPSocketAddress );
  420. m_iSocketProtocol = IPPROTO_UDP;
  421. break;
  422. }
  423. default:
  424. {
  425. DNASSERT(FALSE);
  426. }
  427. }
  428. }
  429. #undef DPF_MODNAME
  430. #define DPF_MODNAME "CSocketAddress::GetProtocol"
  431. INT GetProtocol( void ) const
  432. {
  433. DNASSERT( m_iSocketProtocol != INVALID_SOCKET_PROTOCOL );
  434. #ifndef DPNBUILD_NOIPX
  435. DNASSERT( ( m_iSocketProtocol == IPPROTO_UDP ) || ( m_iSocketProtocol == NSPROTO_IPX ) );
  436. #else
  437. DNASSERT( ( m_iSocketProtocol == IPPROTO_UDP ) );
  438. #endif // DPNBUILD_NOIPX
  439. return m_iSocketProtocol;
  440. }
  441. protected:
  442. BYTE m_Sig[4]; // debugging signature ('SPAD')
  443. //
  444. // combine all of the SOCKADDR variants into one item
  445. //
  446. union
  447. {
  448. SOCKADDR SocketAddress;
  449. SOCKADDR_IN IPSocketAddress;
  450. #ifndef DPNBUILD_NOIPV6
  451. SOCKADDR_IN6 IPv6SocketAddress;
  452. #endif // DPNBUILD_NOIPV6
  453. #ifndef DPNBUILD_NOIPX
  454. SOCKADDR_IPX IPXSocketAddress;
  455. #endif // DPNBUILD_NOIPX
  456. } m_SocketAddress;
  457. INT m_iSocketAddressSize;
  458. INT m_iSocketProtocol;
  459. private:
  460. void GuidFromAddress( GUID * pOutputGuid, const SOCKADDR * pSocketAddress ) const;
  461. };
  462. #undef DPF_MODNAME
  463. #endif // __SP_ADDRESS_H__