Source code of Windows XP (NT5)
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.

287 lines
6.8 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. ws2san.h
  5. Abstract:
  6. This module contains the Microsoft-specific extensions to the Windows
  7. Sockets SPI for WinSock Direct (SAN) support.
  8. Revision History:
  9. --*/
  10. #ifndef _WS2SAN_H_
  11. #define _WS2SAN_H_
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15. /*
  16. * Option for getting maximum RDMA transfer size supported by provider
  17. */
  18. #define SO_MAX_RDMA_SIZE 0x700D
  19. /*
  20. * Option for getting minimum RDMA transfer size feasible (performance-wise)
  21. * for the provider
  22. */
  23. #define SO_RDMA_THRESHOLD_SIZE 0x700E
  24. /*
  25. * The upcall table. This structure is passed by value to the service
  26. * provider's WSPStartup() entrypoint.
  27. */
  28. typedef struct _WSPUPCALLTABLEEX {
  29. LPWPUCLOSEEVENT lpWPUCloseEvent;
  30. LPWPUCLOSESOCKETHANDLE lpWPUCloseSocketHandle;
  31. LPWPUCREATEEVENT lpWPUCreateEvent;
  32. LPWPUCREATESOCKETHANDLE lpWPUCreateSocketHandle;
  33. LPWPUFDISSET lpWPUFDIsSet;
  34. LPWPUGETPROVIDERPATH lpWPUGetProviderPath;
  35. LPWPUMODIFYIFSHANDLE lpWPUModifyIFSHandle;
  36. LPWPUPOSTMESSAGE lpWPUPostMessage;
  37. LPWPUQUERYBLOCKINGCALLBACK lpWPUQueryBlockingCallback;
  38. LPWPUQUERYSOCKETHANDLECONTEXT lpWPUQuerySocketHandleContext;
  39. LPWPUQUEUEAPC lpWPUQueueApc;
  40. LPWPURESETEVENT lpWPUResetEvent;
  41. LPWPUSETEVENT lpWPUSetEvent;
  42. LPWPUOPENCURRENTTHREAD lpWPUOpenCurrentThread;
  43. LPWPUCLOSETHREAD lpWPUCloseThread;
  44. LPWPUCOMPLETEOVERLAPPEDREQUEST lpWPUCompleteOverlappedRequest;
  45. } WSPUPCALLTABLEEX, FAR * LPWSPUPCALLTABLEEX;
  46. /*
  47. * An extended WSABUF, that includes a registration handle
  48. */
  49. typedef struct _WSABUFEX {
  50. u_long len; /* the length of the buffer */
  51. char FAR * buf; /* the pointer to the buffer */
  52. HANDLE handle; /* The handle returned by WSPRegisterMemory */
  53. } WSABUFEX, FAR * LPWSABUFEX;
  54. /*
  55. * WinSock 2 SPI socket function prototypes
  56. */
  57. int
  58. WSPAPI
  59. WSPStartupEx(
  60. IN WORD wVersionRequested,
  61. OUT LPWSPDATA lpWSPData,
  62. IN LPWSAPROTOCOL_INFOW lpProtocolInfo,
  63. IN LPWSPUPCALLTABLEEX lpUpcallTable,
  64. OUT LPWSPPROC_TABLE lpProcTable
  65. );
  66. typedef
  67. int
  68. (WSPAPI * LPWSPSTARTUPEX)(
  69. WORD wVersionRequested,
  70. LPWSPDATA lpWSPData,
  71. LPWSAPROTOCOL_INFOW lpProtocolInfo,
  72. LPWSPUPCALLTABLEEX lpUpcallTable,
  73. LPWSPPROC_TABLE lpProcTable
  74. );
  75. #define WSAID_REGISTERMEMORY \
  76. {0xC0B422F5,0xF58C,0x11d1,{0xAD,0x6C,0x00,0xC0,0x4F,0xA3,0x4A,0x2D}}
  77. #define WSAID_DEREGISTERMEMORY \
  78. {0xC0B422F6,0xF58C,0x11d1,{0xAD,0x6C,0x00,0xC0,0x4F,0xA3,0x4A,0x2D}}
  79. #define WSAID_REGISTERRDMAMEMORY \
  80. {0xC0B422F7,0xF58C,0x11d1,{0xAD,0x6C,0x00,0xC0,0x4F,0xA3,0x4A,0x2D}}
  81. #define WSAID_DEREGISTERRDMAMEMORY \
  82. {0xC0B422F8,0xF58C,0x11d1,{0xAD,0x6C,0x00,0xC0,0x4F,0xA3,0x4A,0x2D}}
  83. #define WSAID_RDMAWRITE \
  84. {0xC0B422F9,0xF58C,0x11d1,{0xAD,0x6C,0x00,0xC0,0x4F,0xA3,0x4A,0x2D}}
  85. #define WSAID_RDMAREAD \
  86. {0xC0B422FA,0xF58C,0x11d1,{0xAD,0x6C,0x00,0xC0,0x4F,0xA3,0x4A,0x2D}}
  87. #define WSAID_MEMORYREGISTRATIONCACHECALLBACK \
  88. {0xE5DA4AF8,0xD824,0x48CD,{0xA7,0x99,0x63,0x37,0xA9,0x8E,0xD2,0xAF}}
  89. #define MEM_READ 1
  90. #define MEM_WRITE 2
  91. #define MEM_READWRITE 3
  92. HANDLE WSPAPI
  93. WSPRegisterMemory(
  94. IN SOCKET s,
  95. IN PVOID lpBuffer,
  96. IN DWORD dwBufferLength,
  97. IN DWORD dwFlags,
  98. OUT LPINT lpErrno
  99. );
  100. int WSPAPI
  101. WSPDeregisterMemory(
  102. IN SOCKET s,
  103. IN HANDLE handle,
  104. OUT LPINT lpErrno
  105. );
  106. int WSPAPI
  107. WSPRegisterRdmaMemory(
  108. IN SOCKET s,
  109. IN PVOID lpBuffer,
  110. IN DWORD dwBufferLength,
  111. IN DWORD dwFlags,
  112. OUT LPVOID lpRdmaBufferDescriptor,
  113. IN OUT LPDWORD lpdwDescriptorLength,
  114. OUT LPINT lpErrno
  115. );
  116. int WSPAPI
  117. WSPDeregisterRdmaMemory(
  118. IN SOCKET s,
  119. IN LPVOID lpRdmaBufferDescriptor,
  120. IN DWORD dwDescriptorLength,
  121. OUT LPINT lpErrno
  122. );
  123. int WSPAPI
  124. WSPRdmaWrite(
  125. IN SOCKET s,
  126. IN LPWSABUFEX lpBuffers,
  127. IN DWORD dwBufferCount,
  128. IN LPVOID lpTargetBufferDescriptor,
  129. IN DWORD dwTargetDescriptorLength,
  130. IN DWORD dwTargetBufferOffset,
  131. OUT LPDWORD lpdwNumberOfBytesWritten,
  132. IN DWORD dwFlags,
  133. IN LPWSAOVERLAPPED lpOverlapped,
  134. IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine,
  135. IN LPWSATHREADID lpThreadId,
  136. OUT LPINT lpErrno
  137. );
  138. int WSPAPI
  139. WSPRdmaRead(
  140. IN SOCKET s,
  141. IN LPWSABUFEX lpBuffers,
  142. IN DWORD dwBufferCount,
  143. IN LPVOID lpTargetBufferDescriptor,
  144. IN DWORD dwTargetDescriptorLength,
  145. IN DWORD dwTargetBufferOffset,
  146. OUT LPDWORD lpdwNumberOfBytesRead,
  147. IN DWORD dwFlags,
  148. IN LPWSAOVERLAPPED lpOverlapped,
  149. IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine,
  150. IN LPWSATHREADID lpThreadId,
  151. OUT LPINT lpErrno
  152. );
  153. int WSPAPI
  154. WSPMemoryRegistrationCacheCallback(
  155. IN LPVOID lpvAddress,
  156. IN SIZE_T Size,
  157. OUT LPINT lpErrno
  158. );
  159. /*
  160. * "QueryInterface" versions of the above APIs.
  161. */
  162. typedef
  163. HANDLE
  164. (WSPAPI * LPFN_WSPREGISTERMEMORY)(
  165. IN SOCKET s,
  166. IN PVOID lpBuffer,
  167. IN DWORD dwBufferLength,
  168. IN DWORD dwFlags,
  169. OUT LPINT lpErrno
  170. );
  171. typedef
  172. int
  173. (WSPAPI * LPFN_WSPDEREGISTERMEMORY)(
  174. IN SOCKET s,
  175. IN HANDLE handle,
  176. OUT LPINT lpErrno
  177. );
  178. typedef
  179. BOOL
  180. (WSPAPI * LPFN_WSPREGISTERRDMAMEMORY)(
  181. IN SOCKET s,
  182. IN PVOID lpBuffer,
  183. IN DWORD dwBufferLength,
  184. IN DWORD dwFlags,
  185. OUT LPVOID lpRdmaBufferDescriptor,
  186. IN OUT LPDWORD lpdwDescriptorLength,
  187. OUT LPINT lpErrno
  188. );
  189. typedef
  190. int
  191. (WSPAPI * LPFN_WSPDEREGISTERRDMAMEMORY)(
  192. IN SOCKET s,
  193. IN LPVOID lpRdmaBufferDescriptor,
  194. IN DWORD dwDescriptorLength,
  195. OUT LPINT lpErrno
  196. );
  197. typedef
  198. int
  199. (WSPAPI * LPFN_WSPRDMAWRITE)(
  200. IN SOCKET s,
  201. IN LPWSABUFEX lpBuffers,
  202. IN DWORD dwBufferCount,
  203. IN LPVOID lpTargetBufferDescriptor,
  204. IN DWORD dwTargetDescriptorLength,
  205. IN DWORD dwTargetBufferOffset,
  206. OUT LPDWORD lpdwNumberOfBytesWritten,
  207. IN DWORD dwFlags,
  208. IN LPWSAOVERLAPPED lpOverlapped,
  209. IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine,
  210. IN LPWSATHREADID lpThreadId,
  211. OUT LPINT lpErrno
  212. );
  213. typedef
  214. int
  215. (WSPAPI * LPFN_WSPRDMAREAD)(
  216. IN SOCKET s,
  217. IN LPWSABUFEX lpBuffers,
  218. IN DWORD dwBufferCount,
  219. IN LPVOID lpTargetBufferDescriptor,
  220. IN DWORD dwTargetDescriptorLength,
  221. IN DWORD dwTargetBufferOffset,
  222. OUT LPDWORD lpdwNumberOfBytesRead,
  223. IN DWORD dwFlags,
  224. IN LPWSAOVERLAPPED lpOverlapped,
  225. IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine,
  226. IN LPWSATHREADID lpThreadId,
  227. OUT LPINT lpErrno
  228. );
  229. typedef
  230. int
  231. (WSPAPI * LPFN_WSPMEMORYREGISTRATIONCACHECALLBACK)(
  232. IN LPVOID lpvAddress,
  233. IN SIZE_T Size,
  234. OUT LPINT lpErrno
  235. );
  236. #ifdef __cplusplus
  237. }
  238. #endif
  239. #endif // _WS2SAN_H_