[PSDK]
[reactos.git] / include / psdk / mswsock.h
1 /*
2 * mswsock.h
3 * MS-specific extensions to Windows Sockets, exported from mswsock.dll.
4 * These functions are N/A on Windows9x.
5 *
6 * This file is part of a free library for the Win32 API.
7 * This library is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 */
11
12 #pragma once
13
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17
18 #include <mswsockdef.h>
19
20 #define SO_CONNDATA 0x7000
21 #define SO_CONNOPT 0x7001
22 #define SO_DISCDATA 0x7002
23 #define SO_DISCOPT 0x7003
24 #define SO_CONNDATALEN 0x7004
25 #define SO_CONNOPTLEN 0x7005
26 #define SO_DISCDATALEN 0x7006
27 #define SO_DISCOPTLEN 0x7007
28 #define SO_OPENTYPE 0x7008
29 #define SO_SYNCHRONOUS_ALERT 0x10
30 #define SO_SYNCHRONOUS_NONALERT 0x20
31 #define SO_MAXDG 0x7009
32 #define SO_MAXPATHDG 0x700A
33 #define SO_UPDATE_ACCEPT_CONTEXT 0x700B
34 #define SO_CONNECT_TIME 0x700C
35 #if(_WIN32_WINNT >= 0x0501)
36 #define SO_UPDATE_CONNECT_CONTEXT 0x7010
37 #endif
38
39 #define TCP_BSDURGENT 0x7000
40
41 #define SIO_UDP_CONNRESET _WSAIOW(IOC_VENDOR,12)
42
43 #if((_WIN32_WINNT < 0x0600) && (_WIN32_WINNT >= 0x0501))
44 #define SIO_SOCKET_CLOSE_NOTIFY _WSAIOW(IOC_VENDOR,13)
45 #endif
46
47 #define SIO_UDP_NETRESET _WSAIOW(IOC_VENDOR,15)
48
49 #define TF_DISCONNECT 1
50 #define TF_REUSE_SOCKET 2
51 #define TF_WRITE_BEHIND 4
52
53 #define TF_USE_DEFAULT_WORKER 0
54 #define TF_USE_SYSTEM_THREAD 16
55 #define TF_USE_KERNEL_APC 32
56
57 #if(_WIN32_WINNT >= 0x0501)
58 #define TP_ELEMENT_MEMORY 1
59 #define TP_ELEMENT_FILE 2
60 #define TP_ELEMENT_EOP 4
61 #endif
62
63 #define TP_DISCONNECT TF_DISCONNECT
64 #define TP_REUSE_SOCKET TF_REUSE_SOCKET
65 #define TP_USE_DEFAULT_WORKER TF_USE_DEFAULT_WORKER
66 #define TP_USE_SYSTEM_THREAD TF_USE_SYSTEM_THREAD
67 #define TP_USE_KERNEL_APC TF_USE_KERNEL_APC
68
69 #define WSAID_TRANSMITFILE \
70 {0xb5367df0,0xcbac,0x11cf,{0x95,0xca,0x00,0x80,0x5f,0x48,0xa1,0x92}}
71
72 #define WSAID_ACCEPTEX \
73 {0xb5367df1,0xcbac,0x11cf,{0x95,0xca,0x00,0x80,0x5f,0x48,0xa1,0x92}}
74
75 #define WSAID_GETACCEPTEXSOCKADDRS \
76 {0xb5367df2,0xcbac,0x11cf,{0x95,0xca,0x00,0x80,0x5f,0x48,0xa1,0x92}}
77
78 typedef struct _TRANSMIT_FILE_BUFFERS {
79 LPVOID Head;
80 DWORD HeadLength;
81 LPVOID Tail;
82 DWORD TailLength;
83 } TRANSMIT_FILE_BUFFERS, *PTRANSMIT_FILE_BUFFERS, FAR *LPTRANSMIT_FILE_BUFFERS;
84
85 typedef BOOL
86 (PASCAL FAR *LPFN_TRANSMITFILE)(
87 IN SOCKET hSocket,
88 IN HANDLE hFile,
89 IN DWORD nNumberOfBytesToWrite,
90 IN DWORD nNumberOfBytesPerSend,
91 IN OUT LPOVERLAPPED lpOverlapped OPTIONAL,
92 IN LPTRANSMIT_FILE_BUFFERS lpTransmitBuffers OPTIONAL,
93 IN DWORD dwReserved);
94
95 typedef BOOL
96 (PASCAL FAR *LPFN_ACCEPTEX)(
97 IN SOCKET sListenSocket,
98 IN SOCKET sAcceptSocket,
99 IN PVOID lpOutputBuffer,
100 IN DWORD dwReceiveDataLength,
101 IN DWORD dwLocalAddressLength,
102 IN DWORD dwRemoteAddressLength,
103 OUT LPDWORD lpdwBytesReceived,
104 IN OUT LPOVERLAPPED lpOverlapped);
105
106 typedef VOID
107 (PASCAL FAR *LPFN_GETACCEPTEXSOCKADDRS)(
108 IN PVOID lpOutputBuffer,
109 IN DWORD dwReceiveDataLength,
110 IN DWORD dwLocalAddressLength,
111 IN DWORD dwRemoteAddressLength,
112 OUT struct sockaddr **LocalSockaddr,
113 OUT LPINT LocalSockaddrLength,
114 OUT struct sockaddr **RemoteSockaddr,
115 OUT LPINT RemoteSockaddrLength);
116
117 #if(_WIN32_WINNT >= 0x0501)
118
119 typedef struct _TRANSMIT_PACKETS_ELEMENT {
120 ULONG dwElFlags;
121 ULONG cLength;
122 union {
123 struct {
124 LARGE_INTEGER nFileOffset;
125 HANDLE hFile;
126 };
127 PVOID pBuffer;
128 };
129 } TRANSMIT_PACKETS_ELEMENT, *PTRANSMIT_PACKETS_ELEMENT, FAR *LPTRANSMIT_PACKETS_ELEMENT;
130
131 typedef BOOL
132 (PASCAL FAR *LPFN_TRANSMITPACKETS)(
133 IN SOCKET hSocket,
134 IN LPTRANSMIT_PACKETS_ELEMENT lpPacketArray OPTIONAL,
135 IN DWORD nElementCount,
136 IN DWORD nSendSize,
137 IN OUT LPOVERLAPPED lpOverlapped OPTIONAL,
138 IN DWORD dwFlags);
139
140 #define WSAID_TRANSMITPACKETS \
141 {0xd9689da0,0x1f90,0x11d3,{0x99,0x71,0x00,0xc0,0x4f,0x68,0xc8,0x76}}
142
143 typedef BOOL
144 (PASCAL FAR *LPFN_CONNECTEX)(
145 IN SOCKET s,
146 IN const struct sockaddr FAR *name,
147 IN int namelen,
148 IN PVOID lpSendBuffer OPTIONAL,
149 IN DWORD dwSendDataLength,
150 OUT LPDWORD lpdwBytesSent,
151 IN OUT LPOVERLAPPED lpOverlapped);
152
153 #define WSAID_CONNECTEX \
154 {0x25a207b9,0xddf3,0x4660,{0x8e,0xe9,0x76,0xe5,0x8c,0x74,0x06,0x3e}}
155
156 typedef BOOL
157 (PASCAL FAR *LPFN_DISCONNECTEX)(
158 IN SOCKET s,
159 IN OUT LPOVERLAPPED lpOverlapped OPTIONAL,
160 IN DWORD dwFlags,
161 IN DWORD dwReserved);
162
163 #define WSAID_DISCONNECTEX \
164 {0x7fda2e11,0x8630,0x436f,{0xa0, 0x31, 0xf5, 0x36, 0xa6, 0xee, 0xc1, 0x57}}
165
166 #define DE_REUSE_SOCKET TF_REUSE_SOCKET
167
168 #define NLA_NAMESPACE_GUID \
169 {0x6642243a,0x3ba8,0x4aa6,{0xba,0xa5,0x2e,0xb,0xd7,0x1f,0xdd,0x83}}
170
171 #define NLA_SERVICE_CLASS_GUID \
172 {0x37e515,0xb5c9,0x4a43,{0xba,0xda,0x8b,0x48,0xa8,0x7a,0xd2,0x39}}
173
174 #define NLA_ALLUSERS_NETWORK 0x00000001
175 #define NLA_FRIENDLY_NAME 0x00000002
176
177 typedef enum _NLA_BLOB_DATA_TYPE {
178 NLA_RAW_DATA = 0,
179 NLA_INTERFACE = 1,
180 NLA_802_1X_LOCATION = 2,
181 NLA_CONNECTIVITY = 3,
182 NLA_ICS = 4,
183 } NLA_BLOB_DATA_TYPE, *PNLA_BLOB_DATA_TYPE;
184
185 typedef enum _NLA_CONNECTIVITY_TYPE {
186 NLA_NETWORK_AD_HOC = 0,
187 NLA_NETWORK_MANAGED = 1,
188 NLA_NETWORK_UNMANAGED = 2,
189 NLA_NETWORK_UNKNOWN = 3,
190 } NLA_CONNECTIVITY_TYPE, *PNLA_CONNECTIVITY_TYPE;
191
192 typedef enum _NLA_INTERNET {
193 NLA_INTERNET_UNKNOWN = 0,
194 NLA_INTERNET_NO = 1,
195 NLA_INTERNET_YES = 2,
196 } NLA_INTERNET, *PNLA_INTERNET;
197
198 typedef struct _NLA_BLOB {
199 struct {
200 NLA_BLOB_DATA_TYPE type;
201 DWORD dwSize;
202 DWORD nextOffset;
203 } header;
204 union {
205 CHAR rawData[1];
206 struct {
207 DWORD dwType;
208 DWORD dwSpeed;
209 CHAR adapterName[1];
210 } interfaceData;
211 struct {
212 CHAR information[1];
213 } locationData;
214 struct {
215 NLA_CONNECTIVITY_TYPE type;
216 NLA_INTERNET internet;
217 } connectivity;
218 struct {
219 struct {
220 DWORD speed;
221 DWORD type;
222 DWORD state;
223 WCHAR machineName[256];
224 WCHAR sharedAdapterName[256];
225 } remote;
226 } ICS;
227 } data;
228 } NLA_BLOB, *PNLA_BLOB, * FAR LPNLA_BLOB;
229
230 typedef INT
231 (PASCAL FAR *LPFN_WSARECVMSG)(
232 IN SOCKET s,
233 IN OUT LPWSAMSG lpMsg,
234 OUT LPDWORD lpdwNumberOfBytesRecvd OPTIONAL,
235 IN OUT LPWSAOVERLAPPED lpOverlapped OPTIONAL,
236 IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine OPTIONAL);
237
238 #define WSAID_WSARECVMSG \
239 {0xf689d7c8,0x6f1f,0x436b,{0x8a,0x53,0xe5,0x4f,0xe3,0x51,0xc3,0x22}}
240
241 #endif /* (_WIN32_WINNT >= 0x0501) */
242
243 #if(_WIN32_WINNT >= 0x0600)
244
245 #define SIO_BSP_HANDLE _WSAIOR(IOC_WS2,27)
246 #define SIO_BSP_HANDLE_SELECT _WSAIOR(IOC_WS2,28)
247 #define SIO_BSP_HANDLE_POLL _WSAIOR(IOC_WS2,29)
248
249 #define SIO_BASE_HANDLE _WSAIOR(IOC_WS2,34)
250
251 #define SIO_EXT_SELECT _WSAIORW(IOC_WS2,30)
252 #define SIO_EXT_POLL _WSAIORW(IOC_WS2,31)
253 #define SIO_EXT_SENDMSG _WSAIORW(IOC_WS2,32)
254
255 typedef struct {
256 int result;
257 ULONG fds;
258 INT timeout;
259 WSAPOLLFD fdArray[0];
260 } WSAPOLLDATA, *LPWSAPOLLDATA;
261
262 typedef struct {
263 LPWSAMSG lpMsg;
264 DWORD dwFlags;
265 LPDWORD lpNumberOfBytesSent;
266 LPWSAOVERLAPPED lpOverlapped;
267 LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine;
268 } WSASENDMSG, *LPWSASENDMSG;
269
270 typedef INT
271 (PASCAL FAR *LPFN_WSASENDMSG)(
272 IN SOCKET s,
273 IN LPWSAMSG lpMsg,
274 IN DWORD dwFlags,
275 OUT LPDWORD lpNumberOfBytesSent OPTIONAL,
276 IN OUT LPWSAOVERLAPPED lpOverlapped OPTIONAL,
277 IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine OPTIONAL);
278
279 #define WSAID_WSASENDMSG
280 {0xa441e712,0x754f,0x43ca,{0x84,0xa7,0x0d,0xee,0x44,0xcf,0x60,0x6d}}
281
282 typedef INT
283 (WSAAPI *LPFN_WSAPOLL)(
284 IN OUT LPWSAPOLLFD fdarray,
285 IN ULONG nfds,
286 IN INT timeout);
287
288 #define WSAID_WSAPOLL \
289 {0x18C76F85,0xDC66,0x4964,{0x97,0x2E,0x23,0xC2,0x72,0x38,0x31,0x2B}}
290
291 #endif /* (_WIN32_WINNT >= 0x0600) */
292
293 #if(_WIN32_WINNT < 0x0600)
294 int
295 PASCAL
296 FAR
297 WSARecvEx(
298 IN SOCKET s,
299 OUT char FAR *buf,
300 IN int len,
301 IN OUT int FAR *flags);
302 #else //(_WIN32_WINNT < 0x0600)
303 INT
304 PASCAL
305 FAR
306 WSARecvEx(
307 IN SOCKET s,
308 OUT CHAR FAR *buf,
309 IN INT len,
310 IN OUT INT FAR *flags);
311 #endif //(_WIN32_WINNT < 0x0600)
312
313 BOOL
314 PASCAL
315 FAR
316 TransmitFile(
317 IN SOCKET hSocket,
318 IN HANDLE hFile,
319 IN DWORD nNumberOfBytesToWrite,
320 IN DWORD nNumberOfBytesPerSend,
321 IN OUT LPOVERLAPPED lpOverlapped OPTIONAL,
322 IN LPTRANSMIT_FILE_BUFFERS lpTransmitBuffers OPTIONAL,
323 IN DWORD dwReserved);
324
325 BOOL
326 PASCAL
327 FAR
328 AcceptEx(
329 IN SOCKET sListenSocket,
330 IN SOCKET sAcceptSocket,
331 OUT PVOID lpOutputBuffer,
332 IN DWORD dwReceiveDataLength,
333 IN DWORD dwLocalAddressLength,
334 IN DWORD dwRemoteAddressLength,
335 OUT LPDWORD lpdwBytesReceived,
336 IN OUT LPOVERLAPPED lpOverlapped);
337
338 VOID
339 PASCAL
340 FAR
341 GetAcceptExSockaddrs(
342 IN PVOID lpOutputBuffer,
343 IN DWORD dwReceiveDataLength,
344 IN DWORD dwLocalAddressLength,
345 IN DWORD dwRemoteAddressLength,
346 OUT struct sockaddr **LocalSockaddr,
347 OUT LPINT LocalSockaddrLength,
348 OUT struct sockaddr **RemoteSockaddr,
349 OUT LPINT RemoteSockaddrLength);
350
351 #ifdef __cplusplus
352 }
353 #endif