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.

451 lines
10 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. WsaHelp.h
  5. Abstract:
  6. This header file contains prototypes required for Windows Sockets
  7. Helper DLLs. The helper DLLs allow the Windows Sockets DLL to be
  8. transport independent by suppling the necessary option get/set and
  9. address conversion routines for an individual transport or transport
  10. family.
  11. Author:
  12. David Treadwell (davidtr) 15-Jul-1992
  13. Revision History:
  14. Keith Moore (keithmo) 08-Jan-1996
  15. Added WinSock 2 entrypoints.
  16. --*/
  17. #ifndef _WSAHELP_H_
  18. #define _WSAHELP_H_
  19. //
  20. // Notification event definitions. A helper DLL returns a mask of the
  21. // events for which it wishes to be notified, and the Windows Sockets
  22. // DLL calls the helper DLL in WSHNotify for each requested event.
  23. //
  24. #define WSH_NOTIFY_BIND 0x01
  25. #define WSH_NOTIFY_LISTEN 0x02
  26. #define WSH_NOTIFY_CONNECT 0x04
  27. #define WSH_NOTIFY_ACCEPT 0x08
  28. #define WSH_NOTIFY_SHUTDOWN_RECEIVE 0x10
  29. #define WSH_NOTIFY_SHUTDOWN_SEND 0x20
  30. #define WSH_NOTIFY_SHUTDOWN_ALL 0x40
  31. #define WSH_NOTIFY_CLOSE 0x80
  32. #define WSH_NOTIFY_CONNECT_ERROR 0x100
  33. //
  34. // Definitions for various internal socket options. These are used
  35. // by the Windows Sockets DLL to communicate information to the helper
  36. // DLL via get and set socket information calls.
  37. //
  38. #define SOL_INTERNAL 0xFFFE
  39. #define SO_CONTEXT 1
  40. //
  41. // Open, Notify, and Socket Option routine prototypes.
  42. //
  43. typedef
  44. INT
  45. (WINAPI * PWSH_OPEN_SOCKET) (
  46. IN PINT AddressFamily,
  47. IN PINT SocketType,
  48. IN PINT Protocol,
  49. OUT PUNICODE_STRING TransportDeviceName,
  50. OUT PVOID *HelperDllSocketContext,
  51. OUT PDWORD NotificationEvents
  52. );
  53. INT
  54. WINAPI
  55. WSHOpenSocket (
  56. IN OUT PINT AddressFamily,
  57. IN OUT PINT SocketType,
  58. IN OUT PINT Protocol,
  59. OUT PUNICODE_STRING TransportDeviceName,
  60. OUT PVOID *HelperDllSocketContext,
  61. OUT PDWORD NotificationEvents
  62. );
  63. typedef
  64. INT
  65. (WINAPI * PWSH_NOTIFY) (
  66. IN PVOID HelperDllSocketContext,
  67. IN SOCKET SocketHandle,
  68. IN HANDLE TdiAddressObjectHandle,
  69. IN HANDLE TdiConnectionObjectHandle,
  70. IN DWORD NotifyEvent
  71. );
  72. INT
  73. WINAPI
  74. WSHNotify (
  75. IN PVOID HelperDllSocketContext,
  76. IN SOCKET SocketHandle,
  77. IN HANDLE TdiAddressObjectHandle,
  78. IN HANDLE TdiConnectionObjectHandle,
  79. IN DWORD NotifyEvent
  80. );
  81. typedef
  82. INT
  83. (WINAPI * PWSH_GET_SOCKET_INFORMATION) (
  84. IN PVOID HelperDllSocketContext,
  85. IN SOCKET SocketHandle,
  86. IN HANDLE TdiAddressObjectHandle,
  87. IN HANDLE TdiConnectionObjectHandle,
  88. IN INT Level,
  89. IN INT OptionName,
  90. OUT PCHAR OptionValue,
  91. OUT PINT OptionLength
  92. );
  93. INT
  94. WINAPI
  95. WSHGetSocketInformation (
  96. IN PVOID HelperDllSocketContext,
  97. IN SOCKET SocketHandle,
  98. IN HANDLE TdiAddressObjectHandle,
  99. IN HANDLE TdiConnectionObjectHandle,
  100. IN INT Level,
  101. IN INT OptionName,
  102. OUT PCHAR OptionValue,
  103. OUT PINT OptionLength
  104. );
  105. typedef
  106. INT
  107. (WINAPI * PWSH_SET_SOCKET_INFORMATION) (
  108. IN PVOID HelperDllSocketContext,
  109. IN SOCKET SocketHandle,
  110. IN HANDLE TdiAddressObjectHandle,
  111. IN HANDLE TdiConnectionObjectHandle,
  112. IN INT Level,
  113. IN INT OptionName,
  114. IN PCHAR OptionValue,
  115. IN INT OptionLength
  116. );
  117. INT
  118. WINAPI
  119. WSHSetSocketInformation (
  120. IN PVOID HelperDllSocketContext,
  121. IN SOCKET SocketHandle,
  122. IN HANDLE TdiAddressObjectHandle,
  123. IN HANDLE TdiConnectionObjectHandle,
  124. IN INT Level,
  125. IN INT OptionName,
  126. IN PCHAR OptionValue,
  127. IN INT OptionLength
  128. );
  129. //
  130. // Structure and routine for determining the address family/socket
  131. // type/protocol triples supported by an individual Windows Sockets
  132. // Helper DLL. The Rows field of WINSOCK_MAPPING determines the
  133. // number of entries in the Mapping[] array; the Columns field is
  134. // always 3 for Windows/NT product 1.
  135. //
  136. typedef struct _WINSOCK_MAPPING {
  137. DWORD Rows;
  138. DWORD Columns;
  139. struct {
  140. DWORD AddressFamily;
  141. DWORD SocketType;
  142. DWORD Protocol;
  143. } Mapping[1];
  144. } WINSOCK_MAPPING, *PWINSOCK_MAPPING;
  145. typedef
  146. DWORD
  147. (WINAPI * PWSH_GET_WINSOCK_MAPPING) (
  148. OUT PWINSOCK_MAPPING Mapping,
  149. IN DWORD MappingLength
  150. );
  151. DWORD
  152. WINAPI
  153. WSHGetWinsockMapping (
  154. OUT PWINSOCK_MAPPING Mapping,
  155. IN DWORD MappingLength
  156. );
  157. //
  158. // Address manipulation routine.
  159. //
  160. typedef enum _SOCKADDR_ADDRESS_INFO {
  161. SockaddrAddressInfoNormal,
  162. SockaddrAddressInfoWildcard,
  163. SockaddrAddressInfoBroadcast,
  164. SockaddrAddressInfoLoopback
  165. } SOCKADDR_ADDRESS_INFO, *PSOCKADDR_ADDRESS_INFO;
  166. typedef enum _SOCKADDR_ENDPOINT_INFO {
  167. SockaddrEndpointInfoNormal,
  168. SockaddrEndpointInfoWildcard,
  169. SockaddrEndpointInfoReserved
  170. } SOCKADDR_ENDPOINT_INFO, *PSOCKADDR_ENDPOINT_INFO;
  171. typedef struct _SOCKADDR_INFO {
  172. SOCKADDR_ADDRESS_INFO AddressInfo;
  173. SOCKADDR_ENDPOINT_INFO EndpointInfo;
  174. } SOCKADDR_INFO, *PSOCKADDR_INFO;
  175. typedef
  176. INT
  177. (WINAPI * PWSH_GET_SOCKADDR_TYPE) (
  178. IN PSOCKADDR Sockaddr,
  179. IN DWORD SockaddrLength,
  180. OUT PSOCKADDR_INFO SockaddrInfo
  181. );
  182. INT
  183. WINAPI
  184. WSHGetSockaddrType (
  185. IN PSOCKADDR Sockaddr,
  186. IN DWORD SockaddrLength,
  187. OUT PSOCKADDR_INFO SockaddrInfo
  188. );
  189. typedef
  190. INT
  191. (WINAPI * PWSH_GET_WILDCARD_SOCKADDR) (
  192. IN PVOID HelperDllSocketContext,
  193. OUT PSOCKADDR Sockaddr,
  194. OUT PINT SockaddrLength
  195. );
  196. INT
  197. WINAPI
  198. WSHGetWildcardSockaddr (
  199. IN PVOID HelperDllSocketContext,
  200. OUT PSOCKADDR Sockaddr,
  201. OUT PINT SockaddrLength
  202. );
  203. typedef
  204. INT
  205. (WINAPI * PWSH_ENUM_PROTOCOLS) (
  206. IN LPINT lpiProtocols,
  207. IN LPTSTR lpTransportKeyName,
  208. IN OUT LPVOID lpProtocolBuffer,
  209. IN OUT LPDWORD lpdwBufferLength
  210. );
  211. INT
  212. WINAPI
  213. WSHEnumProtocols (
  214. IN LPINT lpiProtocols,
  215. IN LPTSTR lpTransportKeyName,
  216. IN OUT LPVOID lpProtocolBuffer,
  217. IN OUT LPDWORD lpdwBufferLength
  218. );
  219. #ifdef _WINSOCK2API_
  220. //
  221. // New WinSock 2 Entrypoints.
  222. //
  223. typedef
  224. INT
  225. (WINAPI * PWSH_OPEN_SOCKET2) (
  226. IN PINT AddressFamily,
  227. IN PINT SocketType,
  228. IN PINT Protocol,
  229. IN GROUP Group,
  230. IN DWORD Flags,
  231. OUT PUNICODE_STRING TransportDeviceName,
  232. OUT PVOID *HelperDllSocketContext,
  233. OUT PDWORD NotificationEvents
  234. );
  235. INT
  236. WINAPI
  237. WSHOpenSocket2 (
  238. IN OUT PINT AddressFamily,
  239. IN OUT PINT SocketType,
  240. IN OUT PINT Protocol,
  241. IN GROUP Group,
  242. IN DWORD Flags,
  243. OUT PUNICODE_STRING TransportDeviceName,
  244. OUT PVOID *HelperDllSocketContext,
  245. OUT PDWORD NotificationEvents
  246. );
  247. typedef
  248. INT
  249. (WINAPI * PWSH_JOIN_LEAF) (
  250. IN PVOID HelperDllSocketContext,
  251. IN SOCKET SocketHandle,
  252. IN HANDLE TdiAddressObjectHandle,
  253. IN HANDLE TdiConnectionObjectHandle,
  254. IN PVOID LeafHelperDllSocketContext,
  255. IN SOCKET LeafSocketHandle,
  256. IN PSOCKADDR Sockaddr,
  257. IN DWORD SockaddrLength,
  258. IN LPWSABUF CallerData,
  259. IN LPWSABUF CalleeData,
  260. IN LPQOS SocketQOS,
  261. IN LPQOS GroupQOS,
  262. IN DWORD Flags
  263. );
  264. INT
  265. WINAPI
  266. WSHJoinLeaf (
  267. IN PVOID HelperDllSocketContext,
  268. IN SOCKET SocketHandle,
  269. IN HANDLE TdiAddressObjectHandle,
  270. IN HANDLE TdiConnectionObjectHandle,
  271. IN PVOID LeafHelperDllSocketContext,
  272. IN SOCKET LeafSocketHandle,
  273. IN PSOCKADDR Sockaddr,
  274. IN DWORD SockaddrLength,
  275. IN LPWSABUF CallerData,
  276. IN LPWSABUF CalleeData,
  277. IN LPQOS SocketQOS,
  278. IN LPQOS GroupQOS,
  279. IN DWORD Flags
  280. );
  281. INT
  282. WINAPI
  283. WSHAddressToString (
  284. IN LPSOCKADDR Address,
  285. IN INT AddressLength,
  286. IN LPWSAPROTOCOL_INFOW ProtocolInfo,
  287. OUT LPWSTR AddressString,
  288. IN OUT LPDWORD AddressStringLength
  289. );
  290. typedef
  291. INT
  292. (WINAPI * PWSH_ADDRESS_TO_STRING) (
  293. IN LPSOCKADDR Address,
  294. IN INT AddressLength,
  295. IN LPWSAPROTOCOL_INFOW ProtocolInfo,
  296. OUT LPWSTR AddressString,
  297. IN OUT LPDWORD AddressStringLength
  298. );
  299. INT
  300. WINAPI
  301. WSHStringToAddress (
  302. IN LPWSTR AddressString,
  303. IN DWORD AddressFamily,
  304. IN LPWSAPROTOCOL_INFOW ProtocolInfo,
  305. OUT LPSOCKADDR Address,
  306. IN OUT LPINT AddressLength
  307. );
  308. typedef
  309. INT
  310. (WINAPI * PWSH_STRING_TO_ADDRESS) (
  311. IN LPWSTR AddressString,
  312. IN DWORD AddressFamily,
  313. IN LPWSAPROTOCOL_INFOW ProtocolInfo,
  314. OUT LPSOCKADDR Address,
  315. IN OUT LPINT AddressLength
  316. );
  317. typedef
  318. INT
  319. (WINAPI * PWSH_GET_BROADCAST_SOCKADDR) (
  320. IN PVOID HelperDllSocketContext,
  321. OUT PSOCKADDR Sockaddr,
  322. OUT PINT SockaddrLength
  323. );
  324. INT
  325. WINAPI
  326. WSHGetBroadcastSockaddr (
  327. IN PVOID HelperDllSocketContext,
  328. OUT PSOCKADDR Sockaddr,
  329. OUT PINT SockaddrLength
  330. );
  331. typedef
  332. INT
  333. (WINAPI * PWSH_GET_PROVIDER_GUID) (
  334. IN LPWSTR ProviderName,
  335. OUT LPGUID ProviderGuid
  336. );
  337. INT
  338. WINAPI
  339. WSHGetProviderGuid (
  340. IN LPWSTR ProviderName,
  341. OUT LPGUID ProviderGuid
  342. );
  343. typedef
  344. INT
  345. (WINAPI * PWSH_GET_WSAPROTOCOL_INFO) (
  346. IN LPWSTR ProviderName,
  347. OUT LPWSAPROTOCOL_INFOW * ProtocolInfo,
  348. OUT LPDWORD ProtocolInfoEntries
  349. );
  350. INT
  351. WINAPI
  352. WSHGetWSAProtocolInfo (
  353. IN LPWSTR ProviderName,
  354. OUT LPWSAPROTOCOL_INFOW * ProtocolInfo,
  355. OUT LPDWORD ProtocolInfoEntries
  356. );
  357. typedef
  358. INT
  359. (WINAPI * PWSH_IOCTL) (
  360. IN PVOID HelperDllSocketContext,
  361. IN SOCKET SocketHandle,
  362. IN HANDLE TdiAddressObjectHandle,
  363. IN HANDLE TdiConnectionObjectHandle,
  364. IN DWORD IoControlCode,
  365. IN LPVOID InputBuffer,
  366. IN DWORD InputBufferLength,
  367. IN LPVOID OutputBuffer,
  368. IN DWORD OutputBufferLength,
  369. OUT LPDWORD NumberOfBytesReturned,
  370. IN LPWSAOVERLAPPED Overlapped,
  371. IN LPWSAOVERLAPPED_COMPLETION_ROUTINE CompletionRoutine,
  372. OUT LPBOOL NeedsCompletion
  373. );
  374. INT
  375. WINAPI
  376. WSHIoctl (
  377. IN PVOID HelperDllSocketContext,
  378. IN SOCKET SocketHandle,
  379. IN HANDLE TdiAddressObjectHandle,
  380. IN HANDLE TdiConnectionObjectHandle,
  381. IN DWORD IoControlCode,
  382. IN LPVOID InputBuffer,
  383. IN DWORD InputBufferLength,
  384. IN LPVOID OutputBuffer,
  385. IN DWORD OutputBufferLength,
  386. OUT LPDWORD NumberOfBytesReturned,
  387. IN LPWSAOVERLAPPED Overlapped,
  388. IN LPWSAOVERLAPPED_COMPLETION_ROUTINE CompletionRoutine,
  389. OUT LPBOOL NeedsCompletion
  390. );
  391. #endif // _WINSOCK2API_
  392. #endif // _WSAHELP_H_