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.

233 lines
8.4 KiB

  1. /*==========================================================================
  2. *
  3. * Copyright (C) 2001-2002 Microsoft Corporation. All Rights Reserved.
  4. *
  5. * File: dpnwsockextern.h
  6. * Content: DirectPlay Wsock Library external functions to be called
  7. * by other DirectPlay components.
  8. *
  9. * History:
  10. * Date By Reason
  11. * ==== == ======
  12. * 07/20/2001 masonb Created
  13. *
  14. ***************************************************************************/
  15. // Pack this to keep it small since it will be sent over the wire
  16. #pragma pack(push, 1)
  17. #define SPSESSIONDATAINFO_XNET 0x00000001 // XNet security session information
  18. typedef struct _SPSESSIONDATA_XNET
  19. {
  20. DWORD dwInfo; // version control for future-proofing the session data, should be SPSESSIONDATAINFO_XNET
  21. GUID guidKey; // session key
  22. ULONGLONG ullKeyID; // session key ID
  23. } SPSESSIONDATA_XNET;
  24. #ifdef XBOX_ON_DESKTOP
  25. //
  26. // Emulated Xbox networking library structures
  27. //
  28. typedef struct {
  29. BYTE cfgSizeOfStruct;
  30. // Must be set to sizeof(XNetStartupParams). There is no default.
  31. BYTE cfgFlags;
  32. // One or more of the following flags OR'd together:
  33. #define XNET_STARTUP_BYPASS_SECURITY 0x01
  34. // This devkit-only flag tells the XNet stack to allow insecure
  35. // communication to untrusted hosts (such as a PC). This flag
  36. // is silently ignored by the secure versions of the library.
  37. #define XNET_STARTUP_BYPASS_DHCP 0x02
  38. // This devkit-only flag tells the XNet stack to skip searching for
  39. // for a DHCP server and use auto-ip only to acquire an IP address.
  40. // This will save several seconds when starting up if you know
  41. // that there is no DHCP server configured. This flag is silently
  42. // ignored by the secure versions of the library.
  43. // The default is 0 (no flags specified).
  44. BYTE cfgPrivatePoolSizeInPages;
  45. // Specifies the size of the pre-allocated private memory pool used by
  46. // XNet for the following situations:
  47. //
  48. // - Responding to ARP/DHCP/ICMP messages
  49. // - Responding to certain TCP control messages
  50. // - Allocating incoming TCP connection request sockets
  51. // - Buffering outgoing data until it is transmitted (UDP) or
  52. // until it is acknowledged (TCP)
  53. // - Buffering incoming data on a socket that does not have a
  54. // sufficiently large overlapped read pending
  55. //
  56. // The reason for using a private pool instead of the normal system
  57. // pool is because we want to have completely deterministic memory
  58. // behavior. That is, all memory allocation occurs only when an API
  59. // is called. No system memory allocation happens asynchronously in
  60. // response to an incoming packet.
  61. //
  62. // Note that this parameter is in units of pages (4096 bytes per page).
  63. //
  64. // The default is 12 pages (48K).
  65. BYTE cfgEnetReceiveQueueLength;
  66. // The length of the Ethernet receive queue in number of packets. Each
  67. // packet takes 2KB of physically contiguous memory.
  68. //
  69. // The default is 8 packets (16K).
  70. BYTE cfgIpFragMaxSimultaneous;
  71. // The maximum number of IP datagrams that can be in the process of reassembly
  72. // at the same time.
  73. //
  74. // The default is 4 packets.
  75. BYTE cfgIpFragMaxPacketDiv256;
  76. // The maximum size of an IP datagram (including header) that can be reassembled.
  77. // Be careful when setting this parameter to a large value as it opens up
  78. // a potential denial-of-service attack by consuming large amounts of memory
  79. // in the fixed-size private pool.
  80. //
  81. // Note that this parameter is in units of 256-bytes each.
  82. //
  83. // The default is 8 units (2048 bytes).
  84. BYTE cfgSockMaxSockets;
  85. // The maximum number of sockets that can be opened at once, including those
  86. // sockets created as a result of incoming connection requests. Remember
  87. // that a TCP socket may not be closed immediately after closesocket is
  88. // called depending on the linger options in place (by default a TCP socket
  89. // will linger).
  90. //
  91. // The default is 64 sockets.
  92. BYTE cfgSockDefaultRecvBufsizeInK;
  93. // The default receive buffer size for a socket, in units of K (1024 bytes).
  94. //
  95. // The default is 16 units (16K).
  96. BYTE cfgSockDefaultSendBufsizeInK;
  97. // The default send buffer size for a socket, in units of K (1024 bytes).
  98. //
  99. // The default is 16 units (16K).
  100. BYTE cfgKeyRegMax;
  101. // The maximum number of XNKID / XNKEY pairs that can be registered at the
  102. // same time by calling XNetRegisterKey.
  103. //
  104. // The default is 4 key pair registrations.
  105. BYTE cfgSecRegMax;
  106. // The maximum number of security associations that can be registered at the
  107. // same time. Security associations are created for each unique XNADDR / XNKID
  108. // pair passed to XNetXnAddrToInAddr. Security associations are also implicitly
  109. // created for each secure host that establishes an incoming connection
  110. // with this host on a given registered XNKID. Note that there will only be
  111. // one security association between a pair of hosts on a given XNKID no matter
  112. // how many sockets are actively communicating on that secure connection.
  113. //
  114. // The default is 32 security associations.
  115. BYTE cfgQosDataLimitDiv4;
  116. // The maximum amount of Qos data, in units of DWORD (4 bytes), that can be supplied
  117. // to a call to XNetQosListen or returned in the result set of a call to XNetQosLookup.
  118. //
  119. // The default is 64 (256 bytes).
  120. } XNetStartupParams;
  121. typedef struct _XNADDR
  122. {
  123. IN_ADDR ina; // IP address (zero if not static/DHCP)
  124. IN_ADDR inaOnline; // Online IP address (zero if not online)
  125. WORD wPortOnline; // Online port
  126. BYTE abEnet[6]; // Ethernet MAC address
  127. BYTE abOnline[20]; // Online identification
  128. } XNADDR;
  129. typedef struct _XNKID
  130. {
  131. BYTE ab[8]; // xbox to xbox key identifier
  132. } XNKID;
  133. #define XNET_XNKID_MASK 0xF0 // Mask of flag bits in first byte of XNKID
  134. #define XNET_XNKID_SYSTEM_LINK 0x00 // Peer to peer system link session
  135. #define XNET_XNKID_ONLINE_PEER 0x80 // Peer to peer online session
  136. #define XNET_XNKID_ONLINE_SERVER 0xC0 // Client to server online session
  137. #define XNetXnKidIsSystemLink(pxnkid) (((pxnkid)->ab[0] & 0xC0) == XNET_XNKID_SYSTEM_LINK)
  138. #define XNetXnKidIsOnlinePeer(pxnkid) (((pxnkid)->ab[0] & 0xC0) == XNET_XNKID_ONLINE_PEER)
  139. #define XNetXnKidIsOnlineServer(pxnkid) (((pxnkid)->ab[0] & 0xC0) == XNET_XNKID_ONLINE_SERVER)
  140. typedef struct _XNKEY
  141. {
  142. BYTE ab[16]; // xbox to xbox key exchange key
  143. } XNKEY;
  144. typedef struct
  145. {
  146. INT iStatus; // WSAEINPROGRESS if pending; 0 if success; error if failed
  147. UINT cina; // Count of IP addresses for the given host
  148. IN_ADDR aina[8]; // Vector of IP addresses for the given host
  149. } XNDNS;
  150. #endif // XBOX_ON_DESKTOP
  151. #pragma pack(pop)
  152. BOOL DNWsockInit(HANDLE hModule);
  153. void DNWsockDeInit();
  154. #ifndef DPNBUILD_NOCOMREGISTER
  155. BOOL DNWsockRegister(LPCWSTR wszDLLName);
  156. BOOL DNWsockUnRegister();
  157. #endif // ! DPNBUILD_NOCOMREGISTER
  158. #ifndef DPNBUILD_NOIPX
  159. HRESULT CreateIPXInterface(
  160. #ifdef DPNBUILD_PREALLOCATEDMEMORYMODEL
  161. const XDP8CREATE_PARAMS * const pDP8CreateParams,
  162. #endif // DPNBUILD_PREALLOCATEDMEMORYMODEL
  163. IDP8ServiceProvider **const ppiDP8SP
  164. );
  165. #endif // ! DPNBUILD_NOIPX
  166. HRESULT CreateIPInterface(
  167. #ifdef DPNBUILD_PREALLOCATEDMEMORYMODEL
  168. const XDP8CREATE_PARAMS * const pDP8CreateParams,
  169. #endif // DPNBUILD_PREALLOCATEDMEMORYMODEL
  170. IDP8ServiceProvider **const ppiDP8SP
  171. );
  172. #ifndef DPNBUILD_LIBINTERFACE
  173. DWORD DNWsockGetRemainingObjectCount();
  174. extern IClassFactoryVtbl TCPIPClassFactoryVtbl;
  175. #ifndef DPNBUILD_NOIPX
  176. extern IClassFactoryVtbl IPXClassFactoryVtbl;
  177. #endif // ! DPNBUILD_NOIPX
  178. #endif // ! DPNBUILD_LIBINTERFACE