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 | #ifndef __WS2SAN_H
|
---|
24 | #define __WS2SAN_H
|
---|
25 |
|
---|
26 | #if __GNUC__ >=3
|
---|
27 | #pragma GCC system_header
|
---|
28 | #endif
|
---|
29 |
|
---|
30 | #ifdef __cplusplus
|
---|
31 | extern "C" {
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | #include <winsock2.h>
|
---|
35 | #include "ntddk.h"
|
---|
36 |
|
---|
37 |
|
---|
38 | #define WSPAPI STDCALL
|
---|
39 |
|
---|
40 | /* FIXME: Unknown definitions */
|
---|
41 | typedef PVOID LPWSPDATA;
|
---|
42 | typedef PDWORD LPWSATHREADID;
|
---|
43 | typedef PVOID LPWSPPROC_TABLE;
|
---|
44 | typedef struct _WSPUPCALLTABLEEX WSPUPCALLTABLEEX;
|
---|
45 | typedef WSPUPCALLTABLEEX *LPWSPUPCALLTABLEEX;
|
---|
46 |
|
---|
47 | #define SO_MAX_RDMA_SIZE 0x700D
|
---|
48 | #define SO_RDMA_THRESHOLD_SIZE 0x700E
|
---|
49 |
|
---|
50 | #define WSAID_REGISTERMEMORY \
|
---|
51 | {0xC0B422F5, 0xF58C, 0x11d1, {0xAD, 0x6C, 0x00, 0xC0, 0x4F, 0xA3, 0x4A, 0x2D}}
|
---|
52 |
|
---|
53 | #define WSAID_DEREGISTERMEMORY \
|
---|
54 | {0xC0B422F6, 0xF58C, 0x11d1, {0xAD, 0x6C, 0x00, 0xC0, 0x4F, 0xA3, 0x4A, 0x2D}}
|
---|
55 |
|
---|
56 | #define WSAID_REGISTERRDMAMEMORY \
|
---|
57 | {0xC0B422F7, 0xF58C, 0x11d1, {0xAD, 0x6C, 0x00, 0xC0, 0x4F, 0xA3, 0x4A, 0x2D}}
|
---|
58 |
|
---|
59 | #define WSAID_DEREGISTERRDMAMEMORY \
|
---|
60 | {0xC0B422F8, 0xF58C, 0x11d1, {0xAD, 0x6C, 0x00, 0xC0, 0x4F, 0xA3, 0x4A, 0x2D}}
|
---|
61 |
|
---|
62 | #define WSAID_RDMAWRITE \
|
---|
63 | {0xC0B422F9, 0xF58C, 0x11d1, {0xAD, 0x6C, 0x00, 0xC0, 0x4F, 0xA3, 0x4A, 0x2D}}
|
---|
64 |
|
---|
65 | #define WSAID_RDMAREAD \
|
---|
66 | {0xC0B422FA, 0xF58C, 0x11d1, {0xAD, 0x6C, 0x00, 0xC0, 0x4F, 0xA3, 0x4A, 0x2D}}
|
---|
67 |
|
---|
68 | #define WSAID_MEMORYREGISTRATIONCACHECALLBACK \
|
---|
69 | {0xE5DA4AF8, 0xD824, 0x48CD, {0xA7, 0x99, 0x63, 0x37, 0xA9, 0x8E, 0xD2, 0xAF}}
|
---|
70 |
|
---|
71 | typedef struct _WSABUFEX {
|
---|
72 | u_long len;
|
---|
73 | char FAR *buf;
|
---|
74 | HANDLE handle;
|
---|
75 | } WSABUFEX, FAR * LPWSABUFEX;
|
---|
76 |
|
---|
77 | #if 0
|
---|
78 | typedef struct _WSPUPCALLTABLEEX {
|
---|
79 | LPWPUCLOSEEVENT lpWPUCloseEvent;
|
---|
80 | LPWPUCLOSESOCKETHANDLE lpWPUCloseSocketHandle;
|
---|
81 | LPWPUCREATEEVENT lpWPUCreateEvent;
|
---|
82 | LPWPUCREATESOCKETHANDLE lpWPUCreateSocketHandle;
|
---|
83 | LPWPUFDISSET lpWPUFDIsSet;
|
---|
84 | LPWPUGETPROVIDERPATH lpWPUGetProviderPath;
|
---|
85 | LPWPUMODIFYIFSHANDLE lpWPUModifyIFSHandle;
|
---|
86 | LPWPUPOSTMESSAGE lpWPUPostMessage;
|
---|
87 | LPWPUQUERYBLOCKINGCALLBACK lpWPUQueryBlockingCallback;
|
---|
88 | LPWPUQUERYSOCKETHANDLECONTEXT lpWPUQuerySocketHandleContext;
|
---|
89 | LPWPUQUEUEAPC lpWPUQueueApc;
|
---|
90 | LPWPURESETEVENT lpWPUResetEvent;
|
---|
91 | LPWPUSETEVENT lpWPUSetEvent;
|
---|
92 | LPWPUOPENCURRENTTHREAD lpWPUOpenCurrentThread;
|
---|
93 | LPWPUCLOSETHREAD lpWPUCloseThread;
|
---|
94 | LPWPUCOMPLETEOVERLAPPEDREQUEST lpWPUCompleteOverlappedRequest;
|
---|
95 | } WSPUPCALLTABLEEX, FAR * LPWSPUPCALLTABLEEX;
|
---|
96 | #endif
|
---|
97 |
|
---|
98 | int WSPAPI
|
---|
99 | WSPStartupEx(
|
---|
100 | /*IN*/ WORD wVersionRequested,
|
---|
101 | /*OUT*/ LPWSPDATA lpWSPData,
|
---|
102 | /*IN*/ LPWSAPROTOCOL_INFOW lpProtocolInfo,
|
---|
103 | /*IN*/ LPWSPUPCALLTABLEEX lpUpcallTable,
|
---|
104 | /*OUT*/ LPWSPPROC_TABLE lpProcTable);
|
---|
105 |
|
---|
106 | typedef int WSPAPI
|
---|
107 | (*LPWSPSTARTUPEX)(
|
---|
108 | /*IN*/ WORD wVersionRequested,
|
---|
109 | /*OUT*/ LPWSPDATA lpWSPData,
|
---|
110 | /*IN*/ LPWSAPROTOCOL_INFOW lpProtocolInfo,
|
---|
111 | /*IN*/ LPWSPUPCALLTABLEEX lpUpcallTable,
|
---|
112 | /*OUT*/ LPWSPPROC_TABLE lpProcTable);
|
---|
113 |
|
---|
114 | #define MEM_READ 1
|
---|
115 | #define MEM_WRITE 2
|
---|
116 | #define MEM_READWRITE 3
|
---|
117 |
|
---|
118 | int WSPAPI
|
---|
119 | WSPDeregisterMemory(
|
---|
120 | /*IN*/ SOCKET s,
|
---|
121 | /*IN*/ HANDLE Handle,
|
---|
122 | /*OUT*/ LPINT lpErrno);
|
---|
123 |
|
---|
124 | typedef int WSPAPI
|
---|
125 | (*LPFN_WSPDEREGISTERMEMORY)(
|
---|
126 | /*IN*/ SOCKET s,
|
---|
127 | /*IN*/ HANDLE Handle,
|
---|
128 | /*OUT*/ LPINT lpErrno);
|
---|
129 |
|
---|
130 | int WSPAPI
|
---|
131 | WSPDeregisterRdmaMemory(
|
---|
132 | /*IN*/ SOCKET s,
|
---|
133 | /*IN*/ LPVOID lpRdmaBufferDescriptor,
|
---|
134 | /*IN*/ DWORD dwDescriptorLength,
|
---|
135 | /*OUT*/ LPINT lpErrno);
|
---|
136 |
|
---|
137 | typedef int WSPAPI
|
---|
138 | (*LPFN_WSPDEREGISTERRDMAMEMORY)(
|
---|
139 | /*IN*/ SOCKET s,
|
---|
140 | /*IN*/ LPVOID lpRdmaBufferDescriptor,
|
---|
141 | /*IN*/ DWORD dwDescriptorLength,
|
---|
142 | /*OUT*/ LPINT lpErrno);
|
---|
143 |
|
---|
144 | int WSPAPI
|
---|
145 | WSPMemoryRegistrationCacheCallback(
|
---|
146 | /*IN*/ PVOID lpvAddress,
|
---|
147 | /*IN*/ SIZE_T Size,
|
---|
148 | /*OUT*/ LPINT lpErrno);
|
---|
149 |
|
---|
150 | typedef int WSPAPI
|
---|
151 | (*LPFN_WSPMEMORYREGISTRATIONCACHECALLBACK)(
|
---|
152 | /*IN*/ PVOID lpvAddress,
|
---|
153 | /*IN*/ SIZE_T Size,
|
---|
154 | /*OUT*/ LPINT lpErrno);
|
---|
155 |
|
---|
156 | int WSPAPI
|
---|
157 | WSPRdmaRead(
|
---|
158 | /*IN*/ SOCKET s,
|
---|
159 | /*IN*/ LPWSABUFEX lpBuffers,
|
---|
160 | /*IN*/ DWORD dwBufferCount,
|
---|
161 | /*IN*/ LPVOID lpTargetBufferDescriptor,
|
---|
162 | /*IN*/ DWORD dwTargetDescriptorLength,
|
---|
163 | /*IN*/ DWORD dwTargetBufferOffset,
|
---|
164 | /*OUT*/ LPDWORD lpdwNumberOfBytesRead,
|
---|
165 | /*IN*/ DWORD dwFlags,
|
---|
166 | /*IN*/ LPWSAOVERLAPPED lpOverlapped,
|
---|
167 | /*IN*/ LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine,
|
---|
168 | /*IN*/ LPWSATHREADID lpThreadId,
|
---|
169 | /*OUT*/ LPINT lpErrno);
|
---|
170 |
|
---|
171 | typedef int WSPAPI
|
---|
172 | (*LPFN_WSPRDMAREAD)(
|
---|
173 | /*IN*/ SOCKET s,
|
---|
174 | /*IN*/ LPWSABUFEX lpBuffers,
|
---|
175 | /*IN*/ DWORD dwBufferCount,
|
---|
176 | /*IN*/ LPVOID lpTargetBufferDescriptor,
|
---|
177 | /*IN*/ DWORD dwTargetDescriptorLength,
|
---|
178 | /*IN*/ DWORD dwTargetBufferOffset,
|
---|
179 | /*OUT*/ LPDWORD lpdwNumberOfBytesRead,
|
---|
180 | /*IN*/ DWORD dwFlags,
|
---|
181 | /*IN*/ LPWSAOVERLAPPED lpOverlapped,
|
---|
182 | /*IN*/ LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine,
|
---|
183 | /*IN*/ LPWSATHREADID lpThreadId,
|
---|
184 | /*OUT*/ LPINT lpErrno);
|
---|
185 |
|
---|
186 | int WSPAPI
|
---|
187 | WSPRdmaWrite(
|
---|
188 | /*IN*/ SOCKET s,
|
---|
189 | /*IN*/ LPWSABUFEX lpBuffers,
|
---|
190 | /*IN*/ DWORD dwBufferCount,
|
---|
191 | /*IN*/ LPVOID lpTargetBufferDescriptor,
|
---|
192 | /*IN*/ DWORD dwTargetDescriptorLength,
|
---|
193 | /*IN*/ DWORD dwTargetBufferOffset,
|
---|
194 | /*OUT*/ LPDWORD lpdwNumberOfBytesWritten,
|
---|
195 | /*IN*/ DWORD dwFlags,
|
---|
196 | /*IN*/ LPWSAOVERLAPPED lpOverlapped,
|
---|
197 | /*IN*/ LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine,
|
---|
198 | /*IN*/ LPWSATHREADID lpThreadId,
|
---|
199 | /*OUT*/ LPINT lpErrno);
|
---|
200 |
|
---|
201 | typedef int WSPAPI
|
---|
202 | (*LPFN_WSPRDMAWRITE)(
|
---|
203 | /*IN*/ SOCKET s,
|
---|
204 | /*IN*/ LPWSABUFEX lpBuffers,
|
---|
205 | /*IN*/ DWORD dwBufferCount,
|
---|
206 | /*IN*/ LPVOID lpTargetBufferDescriptor,
|
---|
207 | /*IN*/ DWORD dwTargetDescriptorLength,
|
---|
208 | /*IN*/ DWORD dwTargetBufferOffset,
|
---|
209 | /*OUT*/ LPDWORD lpdwNumberOfBytesWritten,
|
---|
210 | /*IN*/ DWORD dwFlags,
|
---|
211 | /*IN*/ LPWSAOVERLAPPED lpOverlapped,
|
---|
212 | /*IN*/ LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine,
|
---|
213 | /*IN*/ LPWSATHREADID lpThreadId,
|
---|
214 | /*OUT*/ LPINT lpErrno);
|
---|
215 |
|
---|
216 | HANDLE WSPAPI
|
---|
217 | WSPRegisterMemory(
|
---|
218 | /*IN*/ SOCKET s,
|
---|
219 | /*IN*/ PVOID lpBuffer,
|
---|
220 | /*IN*/ DWORD dwBufferLength,
|
---|
221 | /*IN*/ DWORD dwFlags,
|
---|
222 | /*OUT*/ LPINT lpErrno);
|
---|
223 |
|
---|
224 | int WSPAPI
|
---|
225 | WSPRegisterRdmaMemory(
|
---|
226 | /*IN*/ SOCKET s,
|
---|
227 | /*IN*/ PVOID lpBuffer,
|
---|
228 | /*IN*/ DWORD dwBufferLength,
|
---|
229 | /*IN*/ DWORD dwFlags,
|
---|
230 | /*OUT*/ LPVOID lpRdmaBufferDescriptor,
|
---|
231 | /*IN OUT*/ LPDWORD lpdwDescriptorLength,
|
---|
232 | /*OUT*/ LPINT lpErrno);
|
---|
233 |
|
---|
234 | typedef int WSPAPI
|
---|
235 | (*LPFN_WSPREGISTERRDMAMEMORY)(
|
---|
236 | /*IN*/ SOCKET s,
|
---|
237 | /*IN*/ PVOID lpBuffer,
|
---|
238 | /*IN*/ DWORD dwBufferLength,
|
---|
239 | /*IN*/ DWORD dwFlags,
|
---|
240 | /*OUT*/ LPVOID lpRdmaBufferDescriptor,
|
---|
241 | /*IN OUT*/ LPDWORD lpdwDescriptorLength,
|
---|
242 | /*OUT*/ LPINT lpErrno);
|
---|
243 |
|
---|
244 | #ifdef __cplusplus
|
---|
245 | }
|
---|
246 | #endif
|
---|
247 |
|
---|
248 | #endif /* __WS2SAN_H */
|
---|