[DDK]
[reactos.git] / reactos / include / ddk / ws2san.h
1 /*
2 * ws2san.h
3 *
4 * WinSock Direct (SAN) support
5 *
6 * This file is part of the w32api package.
7 *
8 * Contributors:
9 * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
10 *
11 * THIS SOFTWARE IS NOT COPYRIGHTED
12 *
13 * This source code is offered for use in the public domain. You may
14 * use, modify or distribute it freely.
15 *
16 * This code is distributed in the hope that it will be useful but
17 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
18 * DISCLAIMED. This includes but is not limited to warranties of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20 *
21 */
22
23 #pragma once
24
25 #ifndef _WS2SAN_H_
26 #define _WS2SAN_H_
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32 #define SO_MAX_RDMA_SIZE 0x700D
33 #define SO_RDMA_THRESHOLD_SIZE 0x700E
34
35 #define MEM_READ 1
36 #define MEM_WRITE 2
37 #define MEM_READWRITE 3
38
39 #define WSAID_REGISTERMEMORY \
40 {0xC0B422F5, 0xF58C, 0x11d1, {0xAD, 0x6C, 0x00, 0xC0, 0x4F, 0xA3, 0x4A, 0x2D}}
41
42 #define WSAID_DEREGISTERMEMORY \
43 {0xC0B422F6, 0xF58C, 0x11d1, {0xAD, 0x6C, 0x00, 0xC0, 0x4F, 0xA3, 0x4A, 0x2D}}
44
45 #define WSAID_REGISTERRDMAMEMORY \
46 {0xC0B422F7, 0xF58C, 0x11d1, {0xAD, 0x6C, 0x00, 0xC0, 0x4F, 0xA3, 0x4A, 0x2D}}
47
48 #define WSAID_DEREGISTERRDMAMEMORY \
49 {0xC0B422F8, 0xF58C, 0x11d1, {0xAD, 0x6C, 0x00, 0xC0, 0x4F, 0xA3, 0x4A, 0x2D}}
50
51 #define WSAID_RDMAWRITE \
52 {0xC0B422F9, 0xF58C, 0x11d1, {0xAD, 0x6C, 0x00, 0xC0, 0x4F, 0xA3, 0x4A, 0x2D}}
53
54 #define WSAID_RDMAREAD \
55 {0xC0B422FA, 0xF58C, 0x11d1, {0xAD, 0x6C, 0x00, 0xC0, 0x4F, 0xA3, 0x4A, 0x2D}}
56
57 #if(_WIN32_WINNT >= 0x0501)
58 #define WSAID_MEMORYREGISTRATIONCACHECALLBACK \
59 {0xE5DA4AF8, 0xD824, 0x48CD, {0xA7, 0x99, 0x63, 0x37, 0xA9, 0x8E, 0xD2, 0xAF}}
60 #endif
61
62 typedef struct _WSPUPCALLTABLEEX {
63 LPWPUCLOSEEVENT lpWPUCloseEvent;
64 LPWPUCLOSESOCKETHANDLE lpWPUCloseSocketHandle;
65 LPWPUCREATEEVENT lpWPUCreateEvent;
66 LPWPUCREATESOCKETHANDLE lpWPUCreateSocketHandle;
67 LPWPUFDISSET lpWPUFDIsSet;
68 LPWPUGETPROVIDERPATH lpWPUGetProviderPath;
69 LPWPUMODIFYIFSHANDLE lpWPUModifyIFSHandle;
70 LPWPUPOSTMESSAGE lpWPUPostMessage;
71 LPWPUQUERYBLOCKINGCALLBACK lpWPUQueryBlockingCallback;
72 LPWPUQUERYSOCKETHANDLECONTEXT lpWPUQuerySocketHandleContext;
73 LPWPUQUEUEAPC lpWPUQueueApc;
74 LPWPURESETEVENT lpWPUResetEvent;
75 LPWPUSETEVENT lpWPUSetEvent;
76 LPWPUOPENCURRENTTHREAD lpWPUOpenCurrentThread;
77 LPWPUCLOSETHREAD lpWPUCloseThread;
78 LPWPUCOMPLETEOVERLAPPEDREQUEST lpWPUCompleteOverlappedRequest;
79 } WSPUPCALLTABLEEX, FAR *LPWSPUPCALLTABLEEX;
80
81 typedef struct _WSABUFEX {
82 u_long len;
83 _Field_size_bytes_(len) char FAR *buf;
84 HANDLE handle;
85 } WSABUFEX, FAR * LPWSABUFEX;
86
87 typedef
88 _Must_inspect_result_
89 int
90 (WSPAPI *LPWSPSTARTUPEX)(
91 _In_ WORD wVersionRequested,
92 _Out_ LPWSPDATA lpWSPData,
93 _In_ LPWSAPROTOCOL_INFOW lpProtocolInfo,
94 _In_ LPWSPUPCALLTABLEEX lpUpcallTable,
95 _Out_ LPWSPPROC_TABLE lpProcTable);
96
97 typedef
98 _Must_inspect_result_
99 HANDLE
100 (WSPAPI *LPFN_WSPREGISTERMEMORY)(
101 _In_ SOCKET s,
102 _In_reads_bytes_(dwBufferLength) PVOID lpBuffer,
103 _In_ DWORD dwBufferLength,
104 _In_ DWORD dwFlags,
105 _Out_ LPINT lpErrno);
106
107 typedef int
108 (WSPAPI *LPFN_WSPDEREGISTERMEMORY)(
109 _In_ SOCKET s,
110 _In_ HANDLE Handle,
111 _Out_ LPINT lpErrno);
112
113 typedef
114 _Must_inspect_result_
115 int
116 (WSPAPI *LPFN_WSPREGISTERRDMAMEMORY)(
117 _In_ SOCKET s,
118 _In_reads_bytes_(dwBufferLength) PVOID lpBuffer,
119 _In_ DWORD dwBufferLength,
120 _In_ DWORD dwFlags,
121 _Out_writes_bytes_(*lpdwDescriptorLength) LPVOID lpRdmaBufferDescriptor,
122 _Inout_ LPDWORD lpdwDescriptorLength,
123 _Out_ LPINT lpErrno);
124
125 typedef int
126 (WSPAPI *LPFN_WSPDEREGISTERRDMAMEMORY)(
127 _In_ SOCKET s,
128 _In_reads_bytes_(dwDescriptorLength) LPVOID lpRdmaBufferDescriptor,
129 _In_ DWORD dwDescriptorLength,
130 _Out_ LPINT lpErrno);
131
132 typedef int
133 (WSPAPI *LPFN_WSPRDMAWRITE)(
134 _In_ SOCKET s,
135 _In_reads_(dwBufferCount) LPWSABUFEX lpBuffers,
136 _In_ DWORD dwBufferCount,
137 _In_reads_bytes_(dwTargetDescriptorLength) LPVOID lpTargetBufferDescriptor,
138 _In_ DWORD dwTargetDescriptorLength,
139 _In_ DWORD dwTargetBufferOffset,
140 _Out_ LPDWORD lpdwNumberOfBytesWritten,
141 _In_ DWORD dwFlags,
142 _In_opt_ LPWSAOVERLAPPED lpOverlapped,
143 _In_opt_ LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine,
144 _In_ LPWSATHREADID lpThreadId,
145 _Out_ LPINT lpErrno);
146
147 typedef int
148 (WSPAPI *LPFN_WSPRDMAREAD)(
149 _In_ SOCKET s,
150 _In_reads_(dwBufferCount) LPWSABUFEX lpBuffers,
151 _In_ DWORD dwBufferCount,
152 _In_reads_bytes_(dwTargetDescriptorLength) LPVOID lpTargetBufferDescriptor,
153 _In_ DWORD dwTargetDescriptorLength,
154 _In_ DWORD dwTargetBufferOffset,
155 _Out_ LPDWORD lpdwNumberOfBytesRead,
156 _In_ DWORD dwFlags,
157 _In_opt_ LPWSAOVERLAPPED lpOverlapped,
158 _In_opt_ LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine,
159 _In_ LPWSATHREADID lpThreadId,
160 _Out_ LPINT lpErrno);
161
162 #if(_WIN32_WINNT >= 0x0501)
163 typedef
164 _Must_inspect_result_
165 int
166 (WSPAPI *LPFN_WSPMEMORYREGISTRATIONCACHECALLBACK)(
167 _In_reads_bytes_(Size) PVOID lpvAddress,
168 _In_ SIZE_T Size,
169 _Out_ LPINT lpErrno);
170 #endif
171
172 _Must_inspect_result_
173 int
174 WSPAPI
175 WSPStartupEx(
176 _In_ WORD wVersionRequested,
177 _Out_ LPWSPDATA lpWSPData,
178 _In_ LPWSAPROTOCOL_INFOW lpProtocolInfo,
179 _In_ LPWSPUPCALLTABLEEX lpUpcallTable,
180 _Out_ LPWSPPROC_TABLE lpProcTable);
181
182 _Must_inspect_result_
183 HANDLE
184 WSPAPI
185 WSPRegisterMemory(
186 _In_ SOCKET s,
187 _In_reads_bytes_(dwBufferLength) PVOID lpBuffer,
188 _In_ DWORD dwBufferLength,
189 _In_ DWORD dwFlags,
190 _Out_ LPINT lpErrno);
191
192 int
193 WSPAPI
194 WSPDeregisterMemory(
195 _In_ SOCKET s,
196 _In_ HANDLE Handle,
197 _Out_ LPINT lpErrno);
198
199 _Must_inspect_result_
200 int
201 WSPAPI
202 WSPRegisterRdmaMemory(
203 _In_ SOCKET s,
204 _In_reads_bytes_(dwBufferLength) PVOID lpBuffer,
205 _In_ DWORD dwBufferLength,
206 _In_ DWORD dwFlags,
207 _Out_writes_bytes_(*lpdwDescriptorLength) LPVOID lpRdmaBufferDescriptor,
208 _Inout_ LPDWORD lpdwDescriptorLength,
209 _Out_ LPINT lpErrno);
210
211 int
212 WSPAPI
213 WSPDeregisterRdmaMemory(
214 _In_ SOCKET s,
215 _In_reads_bytes_(dwDescriptorLength) LPVOID lpRdmaBufferDescriptor,
216 _In_ DWORD dwDescriptorLength,
217 _Out_ LPINT lpErrno);
218
219 int
220 WSPAPI
221 WSPRdmaWrite(
222 _In_ SOCKET s,
223 _In_reads_(dwBufferCount) LPWSABUFEX lpBuffers,
224 _In_ DWORD dwBufferCount,
225 _In_reads_bytes_(dwTargetDescriptorLength) LPVOID lpTargetBufferDescriptor,
226 _In_ DWORD dwTargetDescriptorLength,
227 _In_ DWORD dwTargetBufferOffset,
228 _Out_ LPDWORD lpdwNumberOfBytesWritten,
229 _In_ DWORD dwFlags,
230 _In_opt_ LPWSAOVERLAPPED lpOverlapped,
231 _In_opt_ LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine,
232 _In_ LPWSATHREADID lpThreadId,
233 _Out_ LPINT lpErrno);
234
235 int
236 WSPAPI
237 WSPRdmaRead(
238 _In_ SOCKET s,
239 _In_reads_(dwBufferCount) LPWSABUFEX lpBuffers,
240 _In_ DWORD dwBufferCount,
241 _In_reads_bytes_(dwTargetDescriptorLength) LPVOID lpTargetBufferDescriptor,
242 _In_ DWORD dwTargetDescriptorLength,
243 _In_ DWORD dwTargetBufferOffset,
244 _Out_ LPDWORD lpdwNumberOfBytesRead,
245 _In_ DWORD dwFlags,
246 _In_opt_ LPWSAOVERLAPPED lpOverlapped,
247 _In_opt_ LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine,
248 _In_ LPWSATHREADID lpThreadId,
249 _Out_ LPINT lpErrno);
250
251 #if(_WIN32_WINNT >= 0x0501)
252 _Must_inspect_result_
253 int
254 WSPAPI
255 WSPMemoryRegistrationCacheCallback(
256 _In_reads_bytes_(Size) PVOID lpvAddress,
257 _In_ SIZE_T Size,
258 _Out_ LPINT lpErrno);
259 #endif
260
261 #ifdef __cplusplus
262 }
263 #endif
264
265 #endif /* _WS2SAN_H_ */