2 * Winsock 2 definitions - used for ws2_32.dll
4 * Copyright (C) 1999 Ove Kaaven
5 * Copyright (C) 2001 Francois Gouget
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #ifndef __WINE_WINSOCKAPI_STDLIB_H
23 #define __WINE_WINSOCKAPI_STDLIB_H
26 * This section defines the items that conflict with the Unix headers.
29 /* We are not using the WS_ prefix we risk getting conflicts for
30 * everything related to select.
33 /* Too late, the Unix version of stdlib.h was included before winsock.h.
34 * This means select and all the related stuff is already defined and we
35 * cannot override types and function prototypes.
36 * All we can do is disable all these symbols so that they are not used
39 # include <sys/types.h>
46 # define FD_SETSIZE Include_winsock_h_before_stdlib_h_or_use_the_MSVCRT_library
47 # define FD_CLR Include_winsock_h_before_stdlib_h_or_use_the_MSVCRT_library
48 # define FD_SET Include_winsock_h_before_stdlib_h_or_use_the_MSVCRT_library
49 # define FD_ZERO Include_winsock_h_before_stdlib_h_or_use_the_MSVCRT_library
50 # define FD_ISSET Include_winsock_h_before_stdlib_h_or_use_the_MSVCRT_library
51 # define fd_set Include_winsock_h_before_stdlib_h_or_use_the_MSVCRT_library
52 # define select Include_winsock_h_before_stdlib_h_or_use_the_MSVCRT_library
53 # elif defined(RLIM_INFINITY)
54 /* On Darwin stdlib.h includes sys/resource.h which defines timeval but not the fd_set macros */
55 # define fd_set unix_fd_set
56 # include <sys/types.h>
65 # define select Include_winsock_h_before_sys_types_h_or_use_the_MSVCRT_library
66 # define timeval Include_winsock_h_before_sys_types_h_or_use_the_MSVCRT_library
68 /* stdlib.h has not been included yet so it's not too late. Include it now
69 * making sure that none of the select symbols is affected. Then we can
70 * define them with our own values.
72 # define fd_set unix_fd_set
73 # define timeval unix_timeval
74 # define select unix_select
75 # define socklen_t unix_socklen_t
76 # define u_long unix_u_long
77 # include <sys/types.h>
90 # undef _TIMEVAL_DEFINED
92 # define WS_DEFINE_SELECT
96 # define WS_DEFINE_SELECT
97 # include <sys/types.h>
99 #endif /* !USE_WS_PREFIX */
101 #endif /* __WINE_WINSOCKAPI_STDLIB_H */
103 #ifndef _WINSOCK2API_
104 #define _WINSOCK2API_
110 # define WS(x) WS_##x
116 typedef unsigned char WS_u_char
;
117 typedef unsigned short WS_u_short
;
118 typedef unsigned int WS_u_int
;
119 typedef ULONG WS_u_long
;
120 #elif (defined(_MSC_VER) || defined(__MINGW32__) || defined(__WATCOMC__)) && !defined(_BSDTYPES_DEFINED)
121 /* MinGW doesn't define the u_xxx types */
122 typedef unsigned char u_char
;
123 typedef unsigned short u_short
;
124 typedef unsigned int u_int
;
125 typedef ULONG u_long
;
126 #define _BSDTYPES_DEFINED
128 #define u_long ULONG /* make sure we don't use the system u_long */
131 typedef UINT_PTR SOCKET
;
137 /* Everything common between winsock.h and winsock2.h */
138 #ifndef INCL_WINSOCK_API_PROTOTYPES
139 #define INCL_WINSOCK_API_PROTOTYPES 1
140 #define WS_API_PROTOTYPES 1
142 #define WS_API_PROTOTYPES INCL_WINSOCK_API_PROTOTYPES
145 #ifndef INCL_WINSOCK_API_TYPEDEFS
146 #define INCL_WINSOCK_API_TYPEDEFS 0
147 #define WS_API_TYPEDEFS 0
149 #define WS_API_TYPEDEFS INCL_WINSOCK_API_TYPEDEFS
156 #endif /* defined(__cplusplus) */
158 #define INVALID_SOCKET (SOCKET)(~0)
159 #define SOCKET_ERROR (-1)
161 #ifndef USE_WS_PREFIX
162 #define SOL_SOCKET 0xffff
163 #define SO_DEBUG 0x0001
164 #define SO_ACCEPTCONN 0x0002
165 #define SO_REUSEADDR 0x0004
166 #define SO_EXCLUSIVEADDRUSE ((u_int)(~SO_REUSEADDR))
167 #define SO_KEEPALIVE 0x0008
168 #define SO_DONTROUTE 0x0010
169 #define SO_BROADCAST 0x0020
170 #define SO_USELOOPBACK 0x0040
171 #define SO_LINGER 0x0080
172 #define SO_OOBINLINE 0x0100
173 #define SO_DONTLINGER ((u_int)(~SO_LINGER))
174 #define SO_SNDBUF 0x1001
175 #define SO_RCVBUF 0x1002
176 #define SO_SNDLOWAT 0x1003
177 #define SO_RCVLOWAT 0x1004
178 #define SO_SNDTIMEO 0x1005
179 #define SO_RCVTIMEO 0x1006
180 #define SO_ERROR 0x1007
181 #define SO_TYPE 0x1008
182 #define SO_GROUP_ID 0x2001
183 #define SO_GROUP_PRIORITY 0x2002
184 #define SO_MAX_MSG_SIZE 0x2003
185 #define SO_PROTOCOL_INFOA 0x2004
186 #define SO_PROTOCOL_INFOW 0x2005
187 #define SO_PROTOCOL_INFO WINELIB_NAME_AW(WS_SO_PROTOCOL_INFO)
188 #define PVD_CONFIG 0x3001
189 #define SO_CONDITIONAL_ACCEPT 0x3002
191 #define WS_SOL_SOCKET 0xffff
192 #define WS_SO_DEBUG 0x0001
193 #define WS_SO_ACCEPTCONN 0x0002
194 #define WS_SO_REUSEADDR 0x0004
195 #define WS_SO_EXCLUSIVEADDRUSE ((WS_u_int)(~WS_SO_REUSEADDR))
196 #define WS_SO_KEEPALIVE 0x0008
197 #define WS_SO_DONTROUTE 0x0010
198 #define WS_SO_BROADCAST 0x0020
199 #define WS_SO_USELOOPBACK 0x0040
200 #define WS_SO_LINGER 0x0080
201 #define WS_SO_OOBINLINE 0x0100
202 #define WS_SO_DONTLINGER ((WS_u_int)(~WS_SO_LINGER))
203 #define WS_SO_SNDBUF 0x1001
204 #define WS_SO_RCVBUF 0x1002
205 #define WS_SO_SNDLOWAT 0x1003
206 #define WS_SO_RCVLOWAT 0x1004
207 #define WS_SO_SNDTIMEO 0x1005
208 #define WS_SO_RCVTIMEO 0x1006
209 #define WS_SO_ERROR 0x1007
210 #define WS_SO_TYPE 0x1008
211 #define WS_SO_GROUP_ID 0x2001
212 #define WS_SO_GROUP_PRIORITY 0x2002
213 #define WS_SO_MAX_MSG_SIZE 0x2003
214 #define WS_SO_PROTOCOL_INFOA 0x2004
215 #define WS_SO_PROTOCOL_INFOW 0x2005
216 #define WS_SO_PROTOCOL_INFO WINELIB_NAME_AW(WS_SO_PROTOCOL_INFO)
217 #define WS_PVD_CONFIG 0x3001
218 #define WS_SO_CONDITIONAL_ACCEPT 0x3002
223 #define FROM_PROTOCOL_INFO (-1)
225 #ifndef USE_WS_PREFIX
226 #define SOCK_STREAM 1
230 #define SOCK_SEQPACKET 5
231 #else /* USE_WS_PREFIX */
232 #define WS_SOCK_STREAM 1
233 #define WS_SOCK_DGRAM 2
234 #define WS_SOCK_RAW 3
235 #define WS_SOCK_RDM 4
236 #define WS_SOCK_SEQPACKET 5
237 #endif /* USE_WS_PREFIX */
239 /* protocol families */
241 #ifndef USE_WS_PREFIX
242 #define PF_APPLETALK AF_APPLETALK
243 #define PF_BAN AF_BAN
244 #define PF_CCITT AF_CCITT
245 #define PF_CHAOS AF_CHAOS
246 #define PF_DATAKIT AF_DATAKIT
247 #define PF_DECnet AF_DECnet
248 #define PF_DLI AF_DLI
249 #define PF_ECMA AF_ECMA
250 #define PF_FIREFOX AF_FIREFOX
251 #define PF_HYLINK AF_HYLINK
252 #define PF_IMPLINK AF_IMPLINK
253 #define PF_INET AF_INET
254 #define PF_INET6 AF_INET6
255 #define PF_IPX AF_IPX
256 #define PF_ISO AF_ISO
257 #define PF_LAT AF_LAT
258 #define PF_MAX AF_MAX
260 #define PF_OSI AF_OSI
261 #define PF_PUP AF_PUP
262 #define PF_SNA AF_SNA
263 #define PF_UNIX AF_UNIX
264 #define PF_UNKNOWN1 AF_UNKNOWN1
265 #define PF_UNSPEC AF_UNSPEC
266 #define PF_VOICEVIEW AF_VOICEVIEW
269 /* option flags per socket */
271 #define FD_MAX_EVENTS 10
272 #define FD_READ_BIT 0
273 #define FD_WRITE_BIT 1
275 #define FD_ACCEPT_BIT 3
276 #define FD_CONNECT_BIT 4
277 #define FD_CLOSE_BIT 5
279 #define FD_GROUP_QOS_BIT 7
280 #define FD_ROUTING_INTERFACE_CHANGE_BIT 8
281 #define FD_ADDRESS_LIST_CHANGE_BIT 9
283 #define FD_READ 0x00000001
284 #define FD_WRITE 0x00000002
285 #define FD_OOB 0x00000004
286 #define FD_ACCEPT 0x00000008
287 #define FD_CONNECT 0x00000010
288 #define FD_CLOSE 0x00000020
289 #define FD_QOS 0x00000040
290 #define FD_GROUP_QOS 0x00000080
291 #define FD_ROUTING_INTERFACE_CHANGE 0x00000100
292 #define FD_ADDRESS_LIST_CHANGE 0x00000200
294 /* Constants for LPCONDITIONPROC */
295 #define CF_ACCEPT 0x0000
296 #define CF_REJECT 0x0001
297 #define CF_DEFER 0x0002
299 /* Constants for shutdown() */
300 #define SD_RECEIVE 0x00
304 /* Constants for WSAPoll() */
305 #ifndef USE_WS_PREFIX
306 #define POLLERR 0x0001
307 #define POLLHUP 0x0002
308 #define POLLNVAL 0x0004
309 #define POLLWRNORM 0x0010
310 #define POLLWRBAND 0x0020
311 #define POLLRDNORM 0x0100
312 #define POLLRDBAND 0x0200
313 #define POLLPRI 0x0400
314 #define POLLIN (POLLRDNORM|POLLRDBAND)
315 #define POLLOUT (POLLWRNORM)
317 #define WS_POLLERR 0x0001
318 #define WS_POLLHUP 0x0002
319 #define WS_POLLNVAL 0x0004
320 #define WS_POLLWRNORM 0x0010
321 #define WS_POLLWRBAND 0x0020
322 #define WS_POLLRDNORM 0x0100
323 #define WS_POLLRDBAND 0x0200
324 #define WS_POLLPRI 0x0400
325 #define WS_POLLIN (WS_POLLRDNORM|WS_POLLRDBAND)
326 #define WS_POLLOUT (WS_POLLWRNORM)
329 /* Constants for WSAIoctl() */
331 #define WS_IOC_UNIX 0x00000000
332 #define WS_IOC_WS2 0x08000000
333 #define WS_IOC_PROTOCOL 0x10000000
334 #define WS_IOC_VENDOR 0x18000000
335 #define WS_IOC_VOID 0x20000000
336 #define WS_IOC_OUT 0x40000000
337 #define WS_IOC_IN 0x80000000
338 #define WS_IOC_INOUT (WS_IOC_IN|WS_IOC_OUT)
339 #define WS_IOCPARM_MASK 0x7f
340 #define WS__IO(x,y) (WS_IOC_VOID | ((x) << 8) | (y))
341 #define WS__IOR(x,y,t) (WS_IOC_OUT | (((UINT)sizeof(t) & WS_IOCPARM_MASK) << 16) | ((x) << 8) | (y))
342 #define WS__IOW(x,y,t) (WS_IOC_IN | (((UINT)sizeof(t) & WS_IOCPARM_MASK) << 16) | ((x) << 8) | (y))
343 #define _WSAIO(x,y) (WS_IOC_VOID|(x)|(y))
344 #define _WSAIOR(x,y) (WS_IOC_OUT|(x)|(y))
345 #define _WSAIOW(x,y) (WS_IOC_IN|(x)|(y))
346 #define _WSAIORW(x,y) (WS_IOC_INOUT|(x)|(y))
347 #define WS_FIONREAD WS__IOR('f', 127, ULONG)
348 #define WS_FIONBIO WS__IOW('f', 126, ULONG)
349 #define WS_FIOASYNC WS__IOW('f', 125, ULONG)
350 #define WS_SIOCSHIWAT WS__IOW('s', 0, ULONG)
351 #define WS_SIOCGHIWAT WS__IOR('s', 1, ULONG)
352 #define WS_SIOCSLOWAT WS__IOW('s', 2, ULONG)
353 #define WS_SIOCGLOWAT WS__IOR('s', 3, ULONG)
354 #define WS_SIOCATMARK WS__IOR('s', 7, ULONG)
355 #define WS_SIO_ASSOCIATE_HANDLE _WSAIOW(WS_IOC_WS2,1)
356 #define WS_SIO_ENABLE_CIRCULAR_QUEUEING _WSAIO(WS_IOC_WS2,2)
357 #define WS_SIO_FIND_ROUTE _WSAIOR(WS_IOC_WS2,3)
358 #define WS_SIO_FLUSH _WSAIO(WS_IOC_WS2,4)
359 #define WS_SIO_GET_BROADCAST_ADDRESS _WSAIOR(WS_IOC_WS2,5)
360 #define WS_SIO_GET_EXTENSION_FUNCTION_POINTER _WSAIORW(WS_IOC_WS2,6)
361 #define WS_SIO_GET_QOS _WSAIORW(WS_IOC_WS2,7)
362 #define WS_SIO_GET_GROUP_QOS _WSAIORW(WS_IOC_WS2,8)
363 #define WS_SIO_MULTIPOINT_LOOPBACK _WSAIOW(WS_IOC_WS2,9)
364 #define WS_SIO_MULTICAST_SCOPE _WSAIOW(WS_IOC_WS2,10)
365 #define WS_SIO_SET_QOS _WSAIOW(WS_IOC_WS2,11)
366 #define WS_SIO_SET_GROUP_QOS _WSAIOW(WS_IOC_WS2,12)
367 #define WS_SIO_TRANSLATE_HANDLE _WSAIORW(WS_IOC_WS2,13)
368 #define WS_SIO_ROUTING_INTERFACE_QUERY _WSAIORW(WS_IOC_WS2,20)
369 #define WS_SIO_ROUTING_INTERFACE_CHANGE _WSAIOW(WS_IOC_WS2,21)
370 #define WS_SIO_ADDRESS_LIST_QUERY _WSAIOR(WS_IOC_WS2,22)
371 #define WS_SIO_ADDRESS_LIST_CHANGE _WSAIO(WS_IOC_WS2,23)
372 #define WS_SIO_QUERY_TARGET_PNP_HANDLE _WSAIOR(WS_IOC_WS2,24)
373 #define WS_SIO_GET_INTERFACE_LIST WS__IOR('t', 127, ULONG)
374 #else /* USE_WS_PREFIX */
379 #define IOC_UNIX 0x00000000
380 #define IOC_WS2 0x08000000
381 #define IOC_PROTOCOL 0x10000000
382 #define IOC_VENDOR 0x18000000
383 #define IOC_VOID 0x20000000
384 #define IOC_OUT 0x40000000
385 #define IOC_IN 0x80000000
386 #define IOC_INOUT (IOC_IN|IOC_OUT)
387 #define IOCPARM_MASK 0x7f
388 #define _IO(x,y) (IOC_VOID | ((x) << 8) | (y))
389 #define _IOR(x,y,t) (IOC_OUT | (((UINT)sizeof(t) & IOCPARM_MASK) << 16) | ((x) << 8) | (y))
390 #define _IOW(x,y,t) (IOC_IN | (((UINT)sizeof(t) & IOCPARM_MASK) << 16) | ((x) << 8) | (y))
391 #define _WSAIO(x,y) (IOC_VOID|(x)|(y))
392 #define _WSAIOR(x,y) (IOC_OUT|(x)|(y))
393 #define _WSAIOW(x,y) (IOC_IN|(x)|(y))
394 #define _WSAIORW(x,y) (IOC_INOUT|(x)|(y))
395 #define FIONREAD _IOR('f', 127, ULONG)
396 #define FIONBIO _IOW('f', 126, ULONG)
397 #define FIOASYNC _IOW('f', 125, ULONG)
398 #define SIOCSHIWAT _IOW('s', 0, ULONG)
399 #define SIOCGHIWAT _IOR('s', 1, ULONG)
400 #define SIOCSLOWAT _IOW('s', 2, ULONG)
401 #define SIOCGLOWAT _IOR('s', 3, ULONG)
402 #define SIOCATMARK _IOR('s', 7, ULONG)
403 #define SIO_ASSOCIATE_HANDLE _WSAIOW(IOC_WS2,1)
404 #define SIO_ENABLE_CIRCULAR_QUEUEING _WSAIO(IOC_WS2,2)
405 #define SIO_FIND_ROUTE _WSAIOR(IOC_WS2,3)
406 #define SIO_FLUSH _WSAIO(IOC_WS2,4)
407 #define SIO_GET_BROADCAST_ADDRESS _WSAIOR(IOC_WS2,5)
408 #define SIO_GET_EXTENSION_FUNCTION_POINTER _WSAIORW(IOC_WS2,6)
409 #define SIO_GET_QOS _WSAIORW(IOC_WS2,7)
410 #define SIO_GET_GROUP_QOS _WSAIORW(IOC_WS2,8)
411 #define SIO_MULTIPOINT_LOOPBACK _WSAIOW(IOC_WS2,9)
412 #define SIO_MULTICAST_SCOPE _WSAIOW(IOC_WS2,10)
413 #define SIO_SET_QOS _WSAIOW(IOC_WS2,11)
414 #define SIO_SET_GROUP_QOS _WSAIOW(IOC_WS2,12)
415 #define SIO_TRANSLATE_HANDLE _WSAIORW(IOC_WS2,13)
416 #define SIO_ROUTING_INTERFACE_QUERY _WSAIORW(IOC_WS2,20)
417 #define SIO_ROUTING_INTERFACE_CHANGE _WSAIOW(IOC_WS2,21)
418 #define SIO_ADDRESS_LIST_QUERY _WSAIOR(IOC_WS2,22)
419 #define SIO_ADDRESS_LIST_CHANGE _WSAIO(IOC_WS2,23)
420 #define SIO_QUERY_TARGET_PNP_HANDLE _WSAIOR(IOC_WS2,24)
421 #define SIO_GET_INTERFACE_LIST _IOR ('t', 127, ULONG)
422 #endif /* USE_WS_PREFIX */
424 #ifndef USE_WS_PREFIX
425 #define SOMAXCONN 0x7fffffff
427 #define MSG_OOB 0x0001
428 #define MSG_PEEK 0x0002
429 #define MSG_DONTROUTE 0x0004
430 #define MSG_WAITALL 0x0008
431 #define MSG_INTERRUPT 0x0010
432 #define MSG_PARTIAL 0x8000
433 #define MSG_MAXIOVLEN 16
434 #else /* USE_WS_PREFIX */
435 #define WS_SOMAXCONN 0x7fffffff
437 #define WS_MSG_OOB 0x0001
438 #define WS_MSG_PEEK 0x0002
439 #define WS_MSG_DONTROUTE 0x0004
440 #define WS_MSG_WAITALL 0x0008
441 #define WS_MSG_INTERRUPT 0x0010
442 #define WS_MSG_PARTIAL 0x8000
443 #define WS_MSG_MAXIOVLEN 16
444 #endif /* USE_WS_PREFIX */
446 /* Constants for WSAIoctl() */
447 #define WSA_FLAG_OVERLAPPED 0x0001
448 #define WSA_FLAG_MULTIPOINT_C_ROOT 0x0002
449 #define WSA_FLAG_MULTIPOINT_C_LEAF 0x0004
450 #define WSA_FLAG_MULTIPOINT_D_ROOT 0x0008
451 #define WSA_FLAG_MULTIPOINT_D_LEAF 0x0010
452 #define WSA_FLAG_ACCESS_SYSTEM_SECURITY 0x0040
453 #define WSA_FLAG_NO_HANDLE_INHERIT 0x0080
454 #define WSA_FLAG_REGISTERED_IO 0x0100
456 /* Constants for WSAJoinLeaf() */
457 #define JL_SENDER_ONLY 0x01
458 #define JL_RECEIVER_ONLY 0x02
461 /* Constants for WSALookupServiceBegin() */
462 #define LUP_DEEP 0x0001
463 #define LUP_RETURN_NAME 0x0010
464 #define LUP_RETURN_TYPE 0x0020
465 #define LUP_RETURN_VERSION 0x0040
466 #define LUP_RETURN_COMMENT 0x0080
467 #define LUP_RETURN_ADDR 0x0100
468 #define LUP_RETURN_BLOB 0x0200
469 #define LUP_RETURN_ALIASES 0x0400
470 #define LUP_RETURN_QUERY_STRING 0x0800
471 #define LUP_RETURN_ALL (LUP_RETURN_ADDR|LUP_RETURN_BLOB|LUP_RETURN_ALIASES|LUP_RETURN_QUERY_STRING \
472 |LUP_RETURN_NAME|LUP_RETURN_TYPE|LUP_RETURN_VERSION|LUP_RETURN_COMMENT)
474 /* Constants for dwNameSpace from struct WSANAMESPACE_INFO */
478 #define NS_PEER_BROWSE 3
481 #define NS_TCPIP_LOCAL 10
482 #define NS_TCPIP_HOSTS 11
493 #define NS_PNRPNAME 38
494 #define NS_PNRPCLOUD 39
497 #define NS_NISPLUS 42
505 #define MAXGETHOSTSTRUCT 1024
507 #define MAX_PROTOCOL_CHAIN 7
508 #define BASE_PROTOCOL 1
509 #define LAYERED_PROTOCOL 0
511 typedef struct _WSAPROTOCOLCHAIN
513 int ChainLen
; /* the length of the chain, */
514 /* length = 0 means layered protocol, */
515 /* length = 1 means base protocol, */
516 /* length > 1 means protocol chain */
517 DWORD ChainEntries
[MAX_PROTOCOL_CHAIN
]; /* a list of dwCatalogEntryIds */
518 } WSAPROTOCOLCHAIN
, * LPWSAPROTOCOLCHAIN
;
520 /* constants used in dwProviderFlags from struct WSAPROTOCOL_INFO */
521 #define PFL_MULTIPLE_PROTO_ENTRIES 0x00000001
522 #define PFL_RECOMMENDED_PROTO_ENTRY 0x00000002
523 #define PFL_HIDDEN 0x00000004
524 #define PFL_MATCHES_PROTOCOL_ZERO 0x00000008
526 #define XP1_CONNECTIONLESS 0x00000001
527 #define XP1_GUARANTEED_DELIVERY 0x00000002
528 #define XP1_GUARANTEED_ORDER 0x00000004
529 #define XP1_MESSAGE_ORIENTED 0x00000008
530 #define XP1_PSEUDO_STREAM 0x00000010
531 #define XP1_GRACEFUL_CLOSE 0x00000020
532 #define XP1_EXPEDITED_DATA 0x00000040
533 #define XP1_CONNECT_DATA 0x00000080
534 #define XP1_DISCONNECT_DATA 0x00000100
535 #define XP1_SUPPORT_BROADCAST 0x00000200
536 #define XP1_SUPPORT_MULTIPOINT 0x00000400
537 #define XP1_MULTIPOINT_CONTROL_PLANE 0x00000800
538 #define XP1_MULTIPOINT_DATA_PLANE 0x00001000
539 #define XP1_QOS_SUPPORTED 0x00002000
540 #define XP1_INTERRUPT 0x00004000
541 #define XP1_UNI_SEND 0x00008000
542 #define XP1_UNI_RECV 0x00010000
543 #define XP1_IFS_HANDLES 0x00020000
544 #define XP1_PARTIAL_MESSAGE 0x00040000
546 #define BIGENDIAN 0x0000
547 #define LITTLEENDIAN 0x0001
549 #define SECURITY_PROTOCOL_NONE 0x0000
551 #ifndef _TIMEVAL_DEFINED
552 #define _TIMEVAL_DEFINED
553 typedef struct WS(timeval
)
557 } TIMEVAL
, *PTIMEVAL
, *LPTIMEVAL
;
560 #ifdef WS_DEFINE_SELECT
562 #define __WS_FD_CLR(fd, set, cast) do { \
564 for (__i = 0; __i < ((cast*)(set))->fd_count; __i++) \
566 if (((cast*)(set))->fd_array[__i] == fd) \
568 while (__i < ((cast*)(set))->fd_count-1) \
570 ((cast*)(set))->fd_array[__i] = \
571 ((cast*)(set))->fd_array[__i+1]; \
574 ((cast*)(set))->fd_count--; \
580 #define __WS_FD_SET(fd, set, cast) do { \
582 for (__i = 0; __i < ((cast*)(set))->fd_count; __i++) \
584 if (((cast*)(set))->fd_array[__i] == (fd)) \
587 if (__i == ((cast*)(set))->fd_count && ((cast*)(set))->fd_count < FD_SETSIZE) \
589 ((cast*)(set))->fd_count++; \
590 ((cast*)(set))->fd_array[__i]=(fd);\
594 #ifndef USE_WS_PREFIX
597 # define FD_SETSIZE 64
600 # define FD_CLR(fd, set) __WS_FD_CLR((fd), (set), fd_set)
601 # define FD_SET(fd, set) __WS_FD_SET((fd), (set), fd_set)
602 # define FD_ZERO(set) (((fd_set*)(set))->fd_count=0)
603 # define FD_ISSET(fd, set) __WSAFDIsSet((SOCKET)(fd), (fd_set*)(set))
607 # ifndef WS_FD_SETSIZE
608 # define WS_FD_SETSIZE 64
611 # define WS_FD_CLR(fd, set) __WS_FD_CLR((fd), (set), WS_fd_set)
612 # define WS_FD_SET(fd, set) __WS_FD_SET((fd), (set), WS_fd_set)
613 # define WS_FD_ZERO(set) (((WS_fd_set*)(set))->fd_count=0)
614 # define WS_FD_ISSET(fd, set) __WSAFDIsSet((SOCKET)(fd), (WS_fd_set*)(set))
618 typedef struct WS(fd_set
)
621 SOCKET fd_array
[WS(FD_SETSIZE
)];
622 } WS(fd_set
), FD_SET
, *PFD_SET
, *LPFD_SET
;
626 typedef struct /*WS(pollfd)*/
633 typedef struct WS(hostent
)
640 #define h_addr h_addr_list[0]
641 } HOSTENT
, *PHOSTENT
, *LPHOSTENT
;
643 typedef struct WS(servent
)
654 } SERVENT
, *PSERVENT
, *LPSERVENT
;
656 typedef struct WS(protoent
)
661 } PROTOENT
, *PPROTOENT
, *LPPROTOENT
;
663 typedef struct WS(linger
)
666 WS(u_short
) l_linger
;
667 } LINGER
, *PLINGER
, *LPLINGER
;
669 #define WSAPROTOCOL_LEN 255
670 typedef struct _WSAPROTOCOL_INFOA
672 DWORD dwServiceFlags1
;
673 DWORD dwServiceFlags2
;
674 DWORD dwServiceFlags3
;
675 DWORD dwServiceFlags4
;
676 DWORD dwProviderFlags
;
678 DWORD dwCatalogEntryId
;
679 WSAPROTOCOLCHAIN ProtocolChain
;
686 int iProtocolMaxOffset
;
687 int iNetworkByteOrder
;
690 DWORD dwProviderReserved
;
691 CHAR szProtocol
[WSAPROTOCOL_LEN
+1];
692 } WSAPROTOCOL_INFOA
, * LPWSAPROTOCOL_INFOA
;
694 typedef struct _WSAPROTOCOL_INFOW
696 DWORD dwServiceFlags1
;
697 DWORD dwServiceFlags2
;
698 DWORD dwServiceFlags3
;
699 DWORD dwServiceFlags4
;
700 DWORD dwProviderFlags
;
702 DWORD dwCatalogEntryId
;
703 WSAPROTOCOLCHAIN ProtocolChain
;
710 int iProtocolMaxOffset
;
711 int iNetworkByteOrder
;
714 DWORD dwProviderReserved
;
715 WCHAR szProtocol
[WSAPROTOCOL_LEN
+1];
716 } WSAPROTOCOL_INFOW
, *LPWSAPROTOCOL_INFOW
;
718 DECL_WINELIB_TYPE_AW(WSAPROTOCOL_INFO
)
719 DECL_WINELIB_TYPE_AW(LPWSAPROTOCOL_INFO
)
721 typedef struct _WSANETWORKEVENTS
724 int iErrorCode
[FD_MAX_EVENTS
];
725 } WSANETWORKEVENTS
, *LPWSANETWORKEVENTS
;
727 typedef struct _WSANSClassInfoA
734 } WSANSCLASSINFOA
, *PWSANSCLASSINFOA
, *LPWSANSCLASSINFOA
;
736 typedef struct _WSANSClassInfoW
743 } WSANSCLASSINFOW
, *PWSANSCLASSINFOW
, *LPWSANSCLASSINFOW
;
745 DECL_WINELIB_TYPE_AW(WSANSCLASSINFO
)
746 DECL_WINELIB_TYPE_AW(PWSANSCLASSINFO
)
747 DECL_WINELIB_TYPE_AW(LPWSANSCLASSINFO
)
749 typedef struct _WSAServiceClassInfoA
751 LPGUID lpServiceClassId
;
752 LPSTR lpszServiceClassName
;
754 LPWSANSCLASSINFOA lpClassInfos
;
755 } WSASERVICECLASSINFOA
, *PWSASERVICECLASSINFOA
, *LPWSASERVICECLASSINFOA
;
757 typedef struct _WSAServiceClassInfoW
759 LPGUID lpServiceClassId
;
760 LPWSTR lpszServiceClassName
;
762 LPWSANSCLASSINFOW lpClassInfos
;
763 } WSASERVICECLASSINFOW
, *PWSASERVICECLASSINFOW
, *LPWSASERVICECLASSINFOW
;
766 DECL_WINELIB_TYPE_AW(WSASERVICECLASSINFO
)
767 DECL_WINELIB_TYPE_AW(PWSASERVICECLASSINFO
)
768 DECL_WINELIB_TYPE_AW(LPWSASERVICECLASSINFO
)
770 #define WSAEVENT HANDLE
771 #define LPWSAEVENT LPHANDLE
772 #define WSAOVERLAPPED OVERLAPPED
773 typedef struct _OVERLAPPED
* LPWSAOVERLAPPED
;
775 #ifndef USE_WS_PREFIX
776 #define h_errno WSAGetLastError()
778 #define WS_h_errno WSAGetLastError()
781 #define WSAHOST_NOT_FOUND (WSABASEERR + 1001)
782 #define WSATRY_AGAIN (WSABASEERR + 1002)
783 #define WSANO_RECOVERY (WSABASEERR + 1003)
784 #define WSANO_DATA (WSABASEERR + 1004)
785 #define WSANO_ADDRESS WSANO_DATA
787 #define WSA_IO_PENDING (ERROR_IO_PENDING)
788 #define WSA_IO_INCOMPLETE (ERROR_IO_INCOMPLETE)
789 #define WSA_INVALID_HANDLE (ERROR_INVALID_HANDLE)
790 #define WSA_INVALID_PARAMETER (ERROR_INVALID_PARAMETER)
791 #define WSA_NOT_ENOUGH_MEMORY (ERROR_NOT_ENOUGH_MEMORY)
792 #define WSA_OPERATION_ABORTED (ERROR_OPERATION_ABORTED)
794 #define WSA_INVALID_EVENT ((WSAEVENT)NULL)
795 #define WSA_MAXIMUM_WAIT_EVENTS (MAXIMUM_WAIT_OBJECTS)
796 #define WSA_WAIT_FAILED ((DWORD)-1)
797 #define WSA_WAIT_EVENT_0 (WAIT_OBJECT_0)
798 #define WSA_WAIT_IO_COMPLETION (WAIT_IO_COMPLETION)
799 #define WSA_WAIT_TIMEOUT (WAIT_TIMEOUT)
800 #define WSA_INFINITE (INFINITE)
802 typedef unsigned int GROUP
;
803 #define SG_UNCONSTRAINED_GROUP 0x01
804 #define SG_CONSTRAINED_GROUP 0x02
807 * FLOWSPEC and SERVICETYPE should eventually move to qos.h
810 typedef ULONG SERVICETYPE
;
812 typedef struct _FLOWSPEC
{
813 unsigned int TokenRate
;
814 unsigned int TokenBucketSize
;
815 unsigned int PeakBandwidth
;
816 unsigned int Latency
;
817 unsigned int DelayVariation
;
818 SERVICETYPE ServiceType
;
819 unsigned int MaxSduSize
;
820 unsigned int MinimumPolicedSize
;
821 } FLOWSPEC
, *PFLOWSPEC
, *LPFLOWSPEC
;
823 typedef struct _QUALITYOFSERVICE
{
824 FLOWSPEC SendingFlowspec
;
825 FLOWSPEC ReceivingFlowspec
;
826 WSABUF ProviderSpecific
;
829 typedef int (CALLBACK
*LPCONDITIONPROC
)
832 LPWSABUF lpCallerData
,
836 LPWSABUF lpCalleeData
,
838 DWORD_PTR dwCallbackData
841 typedef void (CALLBACK
*LPWSAOVERLAPPED_COMPLETION_ROUTINE
)
845 LPWSAOVERLAPPED lpOverlapped
,
849 #ifndef _tagBLOB_DEFINED
850 #define _tagBLOB_DEFINED
851 #define _BLOB_DEFINED
852 #define _LPBLOB_DEFINED
853 typedef struct _BLOB
{
859 /* addressfamily protocol pairs */
860 typedef struct _AFPROTOCOLS
{
863 } AFPROTOCOLS
, *PAFPROTOCOLS
, *LPAFPROTOCOLS
;
865 /* client query definitions */
866 typedef enum _WSAEcomparator
{
869 } WSAECOMPARATOR
, *PWSAECOMPARATOR
, *LPWSAECOMPARATOR
;
871 typedef struct _WSAVersion
{
873 WSAECOMPARATOR ecHow
;
874 } WSAVERSION
, *PWSAVERSION
, *LPWSAVERSION
;
877 typedef struct _WSAQuerySetA
{
879 LPSTR lpszServiceInstanceName
;
880 LPGUID lpServiceClassId
;
881 LPWSAVERSION lpVersion
;
884 LPGUID lpNSProviderId
;
886 DWORD dwNumberOfProtocols
;
887 LPAFPROTOCOLS lpafpProtocols
;
888 LPSTR lpszQueryString
;
889 DWORD dwNumberOfCsAddrs
;
890 LPCSADDR_INFO lpcsaBuffer
;
893 } WSAQUERYSETA
, *PWSAQUERYSETA
, *LPWSAQUERYSETA
;
895 typedef struct _WSAQuerySetW
{
897 LPWSTR lpszServiceInstanceName
;
898 LPGUID lpServiceClassId
;
899 LPWSAVERSION lpVersion
;
902 LPGUID lpNSProviderId
;
904 DWORD dwNumberOfProtocols
;
905 LPAFPROTOCOLS lpafpProtocols
;
906 LPWSTR lpszQueryString
;
907 DWORD dwNumberOfCsAddrs
;
908 LPCSADDR_INFO lpcsaBuffer
;
911 } WSAQUERYSETW
, *PWSAQUERYSETW
, *LPWSAQUERYSETW
;
913 DECL_WINELIB_TYPE_AW(WSAQUERYSET
)
914 DECL_WINELIB_TYPE_AW(PWSAQUERYSET
)
915 DECL_WINELIB_TYPE_AW(LPWSAQUERYSET
)
917 typedef enum _WSAESETSERVICEOP
{
918 RNRSERVICE_REGISTER
= 0,
919 RNRSERVICE_DEREGISTER
,
921 } WSAESETSERVICEOP
, *PWSAESETSERVICEOP
, *LPWSAESETSERVICEOP
;
923 typedef struct _WSANAMESPACE_INFOA
{
928 LPSTR lpszIdentifier
;
929 } WSANAMESPACE_INFOA
, *PWSANAMESPACE_INFOA
, *LPWSANAMESPACE_INFOA
;
931 typedef struct _WSANAMESPACE_INFOW
{
936 LPWSTR lpszIdentifier
;
937 } WSANAMESPACE_INFOW
, *PWSANAMESPACE_INFOW
, *LPWSANAMESPACE_INFOW
;
939 DECL_WINELIB_TYPE_AW(WSANAMESPACE_INFO
)
940 DECL_WINELIB_TYPE_AW(PWSANAMESPACE_INFO
)
941 DECL_WINELIB_TYPE_AW(LPWSANAMESPACE_INFO
)
943 typedef enum _WSACOMPLETIONTYPE
{
944 NSP_NOTIFY_IMMEDIATELY
= 0,
946 NSP_NOTIFY_EVENT
= 2,
949 } WSACOMPLETIONTYPE
, * PWSACOMPLETIONTYPE
, * LPWSACOMPLETIONTYPE
;
951 typedef struct _WSACOMPLETION
{
952 WSACOMPLETIONTYPE Type
;
960 LPWSAOVERLAPPED lpOverlapped
;
963 LPWSAOVERLAPPED lpOverlapped
;
964 LPWSAOVERLAPPED_COMPLETION_ROUTINE lpfnCompletionProc
;
967 LPWSAOVERLAPPED lpOverlapped
;
972 } WSACOMPLETION
, *PWSACOMPLETION
, *LPWSACOMPLETION
;
974 #define WSADESCRIPTION_LEN 256
975 #define WSASYS_STATUS_LEN 128
977 typedef struct WSAData
985 char szDescription
[WSADESCRIPTION_LEN
+1];
986 char szSystemStatus
[WSASYS_STATUS_LEN
+1];
988 char szDescription
[WSADESCRIPTION_LEN
+1];
989 char szSystemStatus
[WSASYS_STATUS_LEN
+1];
994 } WSADATA
, *LPWSADATA
;
996 #ifndef USE_WS_PREFIX
1003 #ifdef WORDS_BIGENDIAN
1005 static inline u_short
__wine_ushort_noop(u_short s
)
1009 static inline ULONG
__wine_ulong_noop(ULONG l
)
1013 #define htonl __wine_ulong_noop
1014 #define htons __wine_ushort_noop
1015 #define ntohl __wine_ulong_noop
1016 #define ntohs __wine_ushort_noop
1018 #else /* WORDS_BIGENDIAN */
1020 static inline u_short
__wine_ushort_swap(u_short s
)
1022 return (s
>> 8) | (s
<< 8);
1024 static inline ULONG
__wine_ulong_swap(ULONG l
)
1026 return ((ULONG
)__wine_ushort_swap((u_short
)l
) << 16) | __wine_ushort_swap((u_short
)(l
>> 16));
1028 #define htonl __wine_ulong_swap
1029 #define htons __wine_ushort_swap
1030 #define ntohl __wine_ulong_swap
1031 #define ntohs __wine_ushort_swap
1033 #endif /* WORDS_BIGENDIAN */
1034 #endif /* USE_WS_PREFIX */
1036 #define WSAMAKEASYNCREPLY(size, error) MAKELONG(size, error)
1037 #define WSAMAKESELECTREPLY(flags, error) MAKELONG(flags, error)
1038 #define WSAGETASYNCBUFLEN(x) LOWORD(x)
1039 #define WSAGETASYNCERROR(x) HIWORD(x)
1040 #define WSAGETSELECTEVENT(x) LOWORD(x)
1041 #define WSAGETSELECTERROR(x) HIWORD(x)
1044 * Winsock Function Typedefs
1046 * Remember to keep this section in sync with the
1047 * "Prototypes" section in winsock.h.
1050 typedef HANDLE (WINAPI
*LPFN_WSAASYNCGETHOSTBYADDR
)(HWND
,WS(u_int
),const char*,int,int,char*,int);
1051 typedef HANDLE (WINAPI
*LPFN_WSAASYNCGETHOSTBYNAME
)(HWND
,WS(u_int
),const char*,char*,int);
1052 typedef HANDLE (WINAPI
*LPFN_WSAASYNCGETPROTOBYNAME
)(HWND
,WS(u_int
),const char*,char*,int);
1053 typedef HANDLE (WINAPI
*LPFN_WSAASYNCGETPROTOBYNUMBER
)(HWND
,WS(u_int
),int,char*,int);
1054 typedef HANDLE (WINAPI
*LPFN_WSAASYNCGETSERVBYNAME
)(HWND
,WS(u_int
),const char*,const char*,char*,int);
1055 typedef HANDLE (WINAPI
*LPFN_WSAASYNCGETSERVBYPORT
)(HWND
,WS(u_int
),int,const char*,char*,int);
1056 typedef int (WINAPI
*LPFN_WSAASYNCSELECT
)(SOCKET
,HWND
,WS(u_int
),LONG
);
1057 typedef int (WINAPI
*LPFN_WSACANCELASYNCREQUEST
)(HANDLE
);
1058 typedef int (WINAPI
*LPFN_WSACANCELBLOCKINGCALL
)(void);
1059 typedef int (WINAPI
*LPFN_WSACLEANUP
)(void);
1060 typedef int (WINAPI
*LPFN_WSAGETLASTERROR
)(void);
1061 typedef BOOL (WINAPI
*LPFN_WSAISBLOCKING
)(void);
1062 typedef FARPROC (WINAPI
*LPFN_WSASETBLOCKINGHOOK
)(FARPROC
);
1063 typedef void (WINAPI
*LPFN_WSASETLASTERROR
)(int);
1064 typedef int (WINAPI
*LPFN_WSASTARTUP
)(WORD
,LPWSADATA
);
1065 typedef int (WINAPI
*LPFN_WSAUNHOOKBLOCKINGHOOK
)(void);
1067 typedef SOCKET (WINAPI
*LPFN_ACCEPT
)(SOCKET
,struct WS(sockaddr
)*,int*);
1068 typedef int (WINAPI
*LPFN_BIND
)(SOCKET
,const struct WS(sockaddr
)*,int);
1069 typedef int (WINAPI
*LPFN_CLOSESOCKET
)(SOCKET
);
1070 typedef int (WINAPI
*LPFN_CONNECT
)(SOCKET
,const struct WS(sockaddr
)*,int);
1071 typedef struct WS(hostent
)* (WINAPI
*LPFN_GETHOSTBYADDR
)(const char*,int,int);
1072 typedef struct WS(hostent
)* (WINAPI
*LPFN_GETHOSTBYNAME
)(const char*);
1073 typedef int (WINAPI
*LPFN_GETHOSTNAME
)(char*,int);
1074 typedef int (WINAPI
*LPFN_GETPEERNAME
)(SOCKET
,struct WS(sockaddr
)*,int*);
1075 typedef struct WS(protoent
)* (WINAPI
*LPFN_GETPROTOBYNAME
)(const char*);
1076 typedef struct WS(protoent
)* (WINAPI
*LPFN_GETPROTOBYNUMBER
)(int);
1077 #ifdef WS_DEFINE_SELECT
1078 typedef int (WINAPI
* LPFN_SELECT
)(int,WS(fd_set
)*,WS(fd_set
)*,WS(fd_set
)*,const struct WS(timeval
)*);
1080 typedef struct WS(servent
)* (WINAPI
*LPFN_GETSERVBYNAME
)(const char*,const char*);
1081 typedef struct WS(servent
)* (WINAPI
*LPFN_GETSERVBYPORT
)(int,const char*);
1082 typedef int (WINAPI
*LPFN_GETSOCKNAME
)(SOCKET
,struct WS(sockaddr
)*,int*);
1083 typedef int (WINAPI
*LPFN_GETSOCKOPT
)(SOCKET
,int,int,char*,int*);
1084 typedef ULONG (WINAPI
*LPFN_HTONL
)(ULONG
);
1085 typedef WS(u_short
) (WINAPI
*LPFN_HTONS
)(WS(u_short
));
1086 typedef ULONG (WINAPI
*LPFN_INET_ADDR
)(const char*);
1087 typedef char* (WINAPI
*LPFN_INET_NTOA
)(struct WS(in_addr
));
1088 typedef int (WINAPI
*LPFN_IOCTLSOCKET
)(SOCKET
,LONG
,ULONG
*);
1089 typedef int (WINAPI
*LPFN_LISTEN
)(SOCKET
,int);
1090 typedef ULONG (WINAPI
*LPFN_NTOHL
)(ULONG
);
1091 typedef WS(u_short
) (WINAPI
*LPFN_NTOHS
)(WS(u_short
));
1092 typedef int (WINAPI
*LPFN_RECV
)(SOCKET
,char*,int,int);
1093 typedef int (WINAPI
*LPFN_RECVFROM
)(SOCKET
,char*,int,int,struct WS(sockaddr
)*,int*);
1094 typedef int (WINAPI
*LPFN_SEND
)(SOCKET
,const char*,int,int);
1095 typedef int (WINAPI
*LPFN_SENDTO
)(SOCKET
,const char*,int,int,const struct WS(sockaddr
)*,int);
1096 typedef int (WINAPI
*LPFN_SETSOCKOPT
)(SOCKET
,int,int,const char*,int);
1097 typedef int (WINAPI
*LPFN_SHUTDOWN
)(SOCKET
,int);
1098 typedef SOCKET (WINAPI
*LPFN_SOCKET
)(int,int,int);
1099 #endif /* WS_API_TYPEDEFS */
1104 * Winsock2 Prototypes
1106 * Remember to keep this section in sync with the
1107 * "Winsock2 Function Typedefs" section below.
1109 #if WS_API_PROTOTYPES
1110 int WINAPI
__WSAFDIsSet(SOCKET
, WS(fd_set
) *);
1112 SOCKET WINAPI
WS(accept
)(SOCKET
, struct WS(sockaddr
) *, int *);
1113 int WINAPI
WS(bind
)(SOCKET
, const struct WS(sockaddr
) *, int);
1114 int WINAPI
WS(closesocket
)(SOCKET
);
1115 int WINAPI
WS(connect
)(SOCKET
, const struct WS(sockaddr
) *, int);
1116 struct WS(hostent
) * WINAPI
WS(gethostbyaddr
)(const char *, int, int);
1117 struct WS(hostent
) * WINAPI
WS(gethostbyname
)(const char *);
1118 #if defined(__MINGW32__) || defined(_MSC_VER) || defined(__WINE_USE_MSVCRT)
1119 /* gethostname is defined in unistd.h */
1120 int WINAPI
WS(gethostname
)(char *, int);
1122 int WINAPI
WS(getpeername
)(SOCKET
, struct WS(sockaddr
) *, int *);
1123 struct WS(protoent
) * WINAPI
WS(getprotobyname
)(const char *);
1124 struct WS(protoent
) * WINAPI
WS(getprotobynumber
)(int);
1125 struct WS(servent
) * WINAPI
WS(getservbyname
)(const char *, const char *);
1126 struct WS(servent
) * WINAPI
WS(getservbyport
)(int, const char *);
1127 int WINAPI
WS(getsockname
)(SOCKET
, struct WS(sockaddr
) *, int *);
1128 int WINAPI
WS(getsockopt
)(SOCKET
, int, int, char *, int *);
1129 ULONG WINAPI
WS(inet_addr
)(const char *);
1130 char * WINAPI
WS(inet_ntoa
)(struct WS(in_addr
));
1131 int WINAPI
WS(ioctlsocket
)(SOCKET
, LONG
, WS(u_long
) *);
1132 int WINAPI
WS(listen
)(SOCKET
, int);
1133 int WINAPI
WS(recv
)(SOCKET
, char *, int, int);
1134 int WINAPI
WS(recvfrom
)(SOCKET
, char *, int, int, struct WS(sockaddr
) *, int *);
1135 #ifdef WS_DEFINE_SELECT
1136 int WINAPI
WS(select
)(int, WS(fd_set
) *, WS(fd_set
) *, WS(fd_set
) *, const struct WS(timeval
) *);
1138 int WINAPI
WS(send
)(SOCKET
, const char *, int, int);
1139 int WINAPI
WS(sendto
)(SOCKET
, const char *, int, int, const struct WS(sockaddr
) *, int);
1140 int WINAPI
WS(setsockopt
)(SOCKET
, int, int, const char *, int);
1141 int WINAPI
WS(shutdown
)(SOCKET
, int);
1142 SOCKET WINAPI
WS(socket
)(int, int, int);
1144 int WINAPI
GetHostNameW(WCHAR
*, int);
1145 SOCKET WINAPI
WSAAccept(SOCKET
,struct WS(sockaddr
)*,LPINT
,LPCONDITIONPROC
,DWORD_PTR
);
1146 INT WINAPI
WSAAddressToStringA(LPSOCKADDR
,DWORD
,LPWSAPROTOCOL_INFOA
,LPSTR
,LPDWORD
);
1147 INT WINAPI
WSAAddressToStringW(LPSOCKADDR
,DWORD
,LPWSAPROTOCOL_INFOW
,LPWSTR
,LPDWORD
);
1148 #define WSAAddressToString WINELIB_NAME_AW(WSAAddressToString)
1149 HANDLE WINAPI
WSAAsyncGetHostByAddr(HWND
, WS(u_int
), const char *, int, int, char *, int);
1150 HANDLE WINAPI
WSAAsyncGetHostByName(HWND
, WS(u_int
), const char *, char *, int);
1151 HANDLE WINAPI
WSAAsyncGetProtoByName(HWND
, WS(u_int
), const char *, char *, int);
1152 HANDLE WINAPI
WSAAsyncGetProtoByNumber(HWND
, WS(u_int
), int, char *, int);
1153 HANDLE WINAPI
WSAAsyncGetServByName(HWND
, WS(u_int
), const char *, const char *, char *, int);
1154 HANDLE WINAPI
WSAAsyncGetServByPort(HWND
, WS(u_int
), int, const char *, char *, int);
1155 int WINAPI
WSAAsyncSelect(SOCKET
, HWND
, WS(u_int
), LONG
);
1156 int WINAPI
WSACancelAsyncRequest(HANDLE
);
1157 int WINAPI
WSACancelBlockingCall(void);
1158 int WINAPI
WSACleanup(void);
1159 BOOL WINAPI
WSACloseEvent(WSAEVENT
);
1160 int WINAPI
WSAConnect(SOCKET
,const struct WS(sockaddr
)*,int,LPWSABUF
,LPWSABUF
,LPQOS
,LPQOS
);
1161 BOOL WINAPI
WSAConnectByNameA(SOCKET
,const char *,const char *,DWORD
*,struct WS(sockaddr
) *,DWORD
*,struct WS(sockaddr
) *,const struct WS(timeval
) *,WSAOVERLAPPED
*);
1162 BOOL WINAPI
WSAConnectByNameW(SOCKET
,const WCHAR
*,const WCHAR
*,DWORD
*,struct WS(sockaddr
) *,DWORD
*,struct WS(sockaddr
) *,const struct WS(timeval
) *,WSAOVERLAPPED
*);
1163 #define WSAConnectByName WINELIB_NAME_AW(WSAConnectByName)
1164 WSAEVENT WINAPI
WSACreateEvent(void);
1165 INT WINAPI
WSADuplicateSocketA(SOCKET
,DWORD
,LPWSAPROTOCOL_INFOA
);
1166 INT WINAPI
WSADuplicateSocketW(SOCKET
,DWORD
,LPWSAPROTOCOL_INFOW
);
1167 #define WSADuplicateSocket WINELIB_NAME_AW(WSADuplicateSocket)
1168 INT WINAPI
WSAEnumNameSpaceProvidersA(LPDWORD
,LPWSANAMESPACE_INFOA
);
1169 INT WINAPI
WSAEnumNameSpaceProvidersW(LPDWORD
,LPWSANAMESPACE_INFOW
);
1170 #define WSAEnumNameSpaceProviders WINELIB_NAME_AW(WSAEnumNameSpaceProviders)
1171 int WINAPI
WSAEnumNetworkEvents(SOCKET
,WSAEVENT
,LPWSANETWORKEVENTS
);
1172 int WINAPI
WSAEnumProtocolsA(LPINT
,LPWSAPROTOCOL_INFOA
,LPDWORD
);
1173 int WINAPI
WSAEnumProtocolsW(LPINT
,LPWSAPROTOCOL_INFOW
,LPDWORD
);
1174 #define WSAEnumProtocols WINELIB_NAME_AW(WSAEnumProtocols)
1175 int WINAPI
WSAEventSelect(SOCKET
,WSAEVENT
,LONG
);
1176 int WINAPI
WSAGetLastError(void);
1177 BOOL WINAPI
WSAGetOverlappedResult(SOCKET
,LPWSAOVERLAPPED
,LPDWORD
,BOOL
,LPDWORD
);
1178 BOOL WINAPI
WSAGetQOSByName(SOCKET
,LPWSABUF
,LPQOS
);
1179 INT WINAPI
WSAGetServiceClassInfoA(LPGUID
,LPGUID
,LPDWORD
,LPWSASERVICECLASSINFOA
);
1180 INT WINAPI
WSAGetServiceClassInfoW(LPGUID
,LPGUID
,LPDWORD
,LPWSASERVICECLASSINFOW
);
1181 #define WSAGetServiceClassInfo WINELIB_NAME_AW(WSAGetServiceClassInfo)
1182 INT WINAPI
WSAGetServiceClassNameByClassIdA(LPGUID
,LPSTR
,LPDWORD
);
1183 INT WINAPI
WSAGetServiceClassNameByClassIdW(LPGUID
,LPWSTR
,LPDWORD
);
1184 #define WSAGetServiceClassNameByClassId WINELIB_NAME_AW(WSAGetServiceClassNameByClassId)
1185 int WINAPI
WSAHtonl(SOCKET
,ULONG
,ULONG
*);
1186 int WINAPI
WSAHtons(SOCKET
,WS(u_short
),WS(u_short
)*);
1187 int WINAPI
WSAInstallServiceClassA(LPWSASERVICECLASSINFOA
);
1188 int WINAPI
WSAInstallServiceClassW(LPWSASERVICECLASSINFOW
);
1189 #define WSAInstallServiceClass WINELIB_NAME_AW(WSAInstallServiceClass)
1190 int WINAPI
WSAIoctl(SOCKET
,DWORD
,LPVOID
,DWORD
,LPVOID
,DWORD
,LPDWORD
,LPWSAOVERLAPPED
,LPWSAOVERLAPPED_COMPLETION_ROUTINE
);
1191 BOOL WINAPI
WSAIsBlocking(void);
1192 SOCKET WINAPI
WSAJoinLeaf(SOCKET
,const struct WS(sockaddr
)*,int,LPWSABUF
,LPWSABUF
,LPQOS
,LPQOS
,DWORD
);
1193 INT WINAPI
WSALookupServiceBeginA(LPWSAQUERYSETA
,DWORD
,LPHANDLE
);
1194 INT WINAPI
WSALookupServiceBeginW(LPWSAQUERYSETW
,DWORD
,LPHANDLE
);
1195 #define WSALookupServiceBegin WINELIB_NAME_AW(WSALookupServiceBegin)
1196 INT WINAPI
WSALookupServiceEnd(HANDLE
);
1197 INT WINAPI
WSALookupServiceNextA(HANDLE
,DWORD
,LPDWORD
,LPWSAQUERYSETA
);
1198 INT WINAPI
WSALookupServiceNextW(HANDLE
,DWORD
,LPDWORD
,LPWSAQUERYSETW
);
1199 #define WSALookupServiceNext WINELIB_NAME_AW(WSALookupServiceNext)
1200 int WINAPI
WSANSPIoctl(HANDLE
,DWORD
,LPVOID
,DWORD
,LPVOID
,DWORD
,LPDWORD
,LPWSACOMPLETION
);
1201 int WINAPI
WSANtohl(SOCKET
,ULONG
,ULONG
*);
1202 int WINAPI
WSANtohs(SOCKET
,WS(u_short
),WS(u_short
)*);
1203 int WINAPI
WSAPoll(WSAPOLLFD
*,ULONG
,int);
1204 INT WINAPI
WSAProviderConfigChange(LPHANDLE
,LPWSAOVERLAPPED
,LPWSAOVERLAPPED_COMPLETION_ROUTINE
);
1205 int WINAPI
WSARecv(SOCKET
,LPWSABUF
,DWORD
,LPDWORD
,LPDWORD
,LPWSAOVERLAPPED
,LPWSAOVERLAPPED_COMPLETION_ROUTINE
);
1206 int WINAPI
WSARecvDisconnect(SOCKET
,LPWSABUF
);
1207 int WINAPI
WSARecvFrom(SOCKET
,LPWSABUF
,DWORD
,LPDWORD
,LPDWORD
,struct WS(sockaddr
)*,LPINT
,LPWSAOVERLAPPED
,LPWSAOVERLAPPED_COMPLETION_ROUTINE
);
1208 INT WINAPI
WSARemoveServiceClass(LPGUID
);
1209 BOOL WINAPI
WSAResetEvent(WSAEVENT
);
1210 int WINAPI
WSASend(SOCKET
,LPWSABUF
,DWORD
,LPDWORD
,DWORD
,LPWSAOVERLAPPED
,LPWSAOVERLAPPED_COMPLETION_ROUTINE
);
1211 int WINAPI
WSASendDisconnect(SOCKET
,LPWSABUF
);
1212 int WINAPI
WSASendTo(SOCKET
,LPWSABUF
,DWORD
,LPDWORD
,DWORD
,const struct WS(sockaddr
)*,int,LPWSAOVERLAPPED
,LPWSAOVERLAPPED_COMPLETION_ROUTINE
);
1213 FARPROC WINAPI
WSASetBlockingHook(FARPROC
);
1214 BOOL WINAPI
WSASetEvent(WSAEVENT
);
1215 void WINAPI
WSASetLastError(int);
1216 INT WINAPI
WSASetServiceA(LPWSAQUERYSETA
,WSAESETSERVICEOP
,DWORD
);
1217 INT WINAPI
WSASetServiceW(LPWSAQUERYSETW
,WSAESETSERVICEOP
,DWORD
);
1218 #define WSASetService WINELIB_NAME_AW(WSASetService)
1219 SOCKET WINAPI
WSASocketA(int,int,int,LPWSAPROTOCOL_INFOA
,GROUP
,DWORD
);
1220 SOCKET WINAPI
WSASocketW(int,int,int,LPWSAPROTOCOL_INFOW
,GROUP
,DWORD
);
1221 #define WSASocket WINELIB_NAME_AW(WSASocket)
1222 int WINAPI
WSAStartup(WORD
,WSADATA
*);
1223 INT WINAPI
WSAStringToAddressA(LPSTR
,INT
,LPWSAPROTOCOL_INFOA
,LPSOCKADDR
,LPINT
);
1224 INT WINAPI
WSAStringToAddressW(LPWSTR
,INT
,LPWSAPROTOCOL_INFOW
,LPSOCKADDR
,LPINT
);
1225 #define WSAStringToAddress WINELIB_NAME_AW(WSAStringToAddress)
1226 int WINAPI
WSAUnhookBlockingHook(void);
1227 DWORD WINAPI
WSAWaitForMultipleEvents(DWORD
,const WSAEVENT
*,BOOL
,DWORD
,BOOL
);
1228 #endif /* WS_API_PROTOTYPES */
1233 * Winsock2 Function Typedefs
1235 * Remember to keep this section in sync with the
1236 * "Winsock2 Prototypes" section above.
1239 typedef SOCKET (WINAPI
*LPFN_WSAACCEPT
)(SOCKET
,struct WS(sockaddr
)*,LPINT
,LPCONDITIONPROC
,DWORD_PTR
);
1240 typedef INT (WINAPI
*LPFN_WSAADDRESSTOSTRINGA
)(LPSOCKADDR
,DWORD
,LPWSAPROTOCOL_INFOA
,LPSTR
,LPDWORD
);
1241 typedef INT (WINAPI
*LPFN_WSAADDRESSTOSTRINGW
)(LPSOCKADDR
,DWORD
,LPWSAPROTOCOL_INFOW
,LPWSTR
,LPDWORD
);
1242 #define LPFN_WSAADDRESSTOSTRING WINELIB_NAME_AW(LPFN_WSAADDRESSTOSTRING)
1243 typedef BOOL (WINAPI
*LPFN_WSACLOSEEVENT
)(WSAEVENT
);
1244 typedef int (WINAPI
*LPFN_WSACONNECT
)(SOCKET
,const struct WS(sockaddr
)*,int,LPWSABUF
,LPWSABUF
,LPQOS
,LPQOS
);
1245 typedef WSAEVENT (WINAPI
*LPFN_WSACREATEEVENT
)(void);
1246 typedef INT (WINAPI
*LPFN_WSADUPLICATESOCKETA
)(SOCKET
,DWORD
,LPWSAPROTOCOL_INFOA
);
1247 typedef INT (WINAPI
*LPFN_WSADUPLICATESOCKETW
)(SOCKET
,DWORD
,LPWSAPROTOCOL_INFOW
);
1248 #define LPFN_WSADUPLICATESOCKET WINELIB_NAME_AW(LPFN_WSADUPLICATESOCKET)
1249 typedef INT (WINAPI
*LPFN_WSAENUMNAMESPACEPROVIDERSA
)(LPDWORD
,LPWSANAMESPACE_INFOA
);
1250 typedef INT (WINAPI
*LPFN_WSAENUMNAMESPACEPROVIDERSW
)(LPDWORD
,LPWSANAMESPACE_INFOW
);
1251 #define LPFN_WSAENUMNAMESPACEPROVIDERS WINELIB_NAME_AW(LPFN_WSAENUMNAMESPACEPROVIDERS)
1252 typedef int (WINAPI
*LPFN_WSAENUMNETWORKEVENTS
)(SOCKET
,WSAEVENT
,LPWSANETWORKEVENTS
);
1253 typedef int (WINAPI
*LPFN_WSAENUMPROTOCOLSA
)(LPINT
,LPWSAPROTOCOL_INFOA
,LPDWORD
);
1254 typedef int (WINAPI
*LPFN_WSAENUMPROTOCOLSW
)(LPINT
,LPWSAPROTOCOL_INFOW
,LPDWORD
);
1255 #define LPFN_WSAENUMPROTOCOLS WINELIB_NAME_AW(LPFN_WSAENUMPROTOCOLS)
1256 typedef int (WINAPI
*LPFN_WSAEVENTSELECT
)(SOCKET
,WSAEVENT
,LONG
);
1257 typedef BOOL (WINAPI
*LPFN_WSAGETOVERLAPPEDRESULT
)(SOCKET
,LPWSAOVERLAPPED
,LPDWORD
,BOOL
,LPDWORD
);
1258 typedef BOOL (WINAPI
*LPFN_WSAGETQOSBYNAME
)(SOCKET
,LPWSABUF
,LPQOS
);
1259 typedef INT (WINAPI
*LPFN_WSAGETSERVICECLASSINFOA
)(LPGUID
,LPGUID
,LPDWORD
,LPWSASERVICECLASSINFOA
);
1260 typedef INT (WINAPI
*LPFN_WSAGETSERVICECLASSINFOW
)(LPGUID
,LPGUID
,LPDWORD
,LPWSASERVICECLASSINFOW
);
1261 #define LPFN_LPFNWSAGETSERVICECLASSINFO WINELIB_NAME_AW(LPFN_LPFNWSAGETSERVICECLASSINFO)
1262 typedef INT (WINAPI
*LPFN_WSAGETSERVICECLASSNAMEBYCLASSIDA
)(LPGUID
,LPSTR
,LPDWORD
);
1263 typedef INT (WINAPI
*LPFN_WSAGETSERVICECLASSNAMEBYCLASSIDW
)(LPGUID
,LPWSTR
,LPDWORD
);
1264 #define LPFN_WSAGETSERVICECLASSNAMEBYCLASSID WINELIB_NAME_AW(LPFN_WSAGETSERVICECLASSNAMEBYCLASSID)
1265 typedef int (WINAPI
*LPFN_WSAHTONL
)(SOCKET
,ULONG
,ULONG
*);
1266 typedef int (WINAPI
*LPFN_WSAHTONS
)(SOCKET
,WS(u_short
),WS(u_short
)*);
1267 typedef int (WINAPI
*LPFN_WSAINSTALLSERVICECLASSA
)(LPWSASERVICECLASSINFOA
);
1268 typedef int (WINAPI
*LPFN_WSAINSTALLSERVICECLASSW
)(LPWSASERVICECLASSINFOW
);
1269 typedef int (WINAPI
*LPFN_WSAIOCTL
)(SOCKET
,DWORD
,LPVOID
,DWORD
,LPVOID
,DWORD
,LPDWORD
,LPWSAOVERLAPPED
,LPWSAOVERLAPPED_COMPLETION_ROUTINE
);
1270 typedef int (WINAPI
*LPFN_WSAJOINLEAF
)(SOCKET
,const struct WS(sockaddr
)*,int,LPWSABUF
,LPWSABUF
,LPQOS
,LPQOS
,DWORD
);
1271 typedef INT (WINAPI
*LPFN_WSALOOKUPSERVICEBEGINA
)(LPWSAQUERYSETA
,DWORD
,LPHANDLE
);
1272 typedef INT (WINAPI
*LPFN_WSALOOKUPSERVICEBEGINW
)(LPWSAQUERYSETW
,DWORD
,LPHANDLE
);
1273 #define LPFN_WSALOOKUPSERVICEBEGIN WINELIB_NAME_AW(LPFN_WSALOOKUPSERVICEBEGIN)
1274 typedef INT (WINAPI
*LPFN_WSALOOKUPSERVICEEND
)(HANDLE
);
1275 typedef INT (WINAPI
*LPFN_WSALOOKUPSERVICENEXTA
)(HANDLE
,DWORD
,LPDWORD
,LPWSAQUERYSETA
);
1276 typedef INT (WINAPI
*LPFN_WSALOOKUPSERVICENEXTW
)(HANDLE
,DWORD
,LPDWORD
,LPWSAQUERYSETW
);
1277 #define LPFN_WSALOOKUPSERVICENEXT WINELIB_NAME_AW(LPFN_WSALOOKUPSERVICENEXT)
1278 typedef int (WINAPI
*LPFN_WSANSPIOCTL
)(HANDLE
,DWORD
,LPVOID
,DWORD
,LPVOID
,DWORD
,LPDWORD
,LPWSACOMPLETION
);
1279 typedef int (WINAPI
*LPFN_WSANTOHL
)(SOCKET
,ULONG
,ULONG
*);
1280 typedef int (WINAPI
*LPFN_WSANTOHS
)(SOCKET
,WS(u_short
),WS(u_short
)*);
1281 typedef INT (WINAPI
*LPFN_WSAPROVIDERCONFIGCHANGE
)(LPHANDLE
,LPWSAOVERLAPPED
,LPWSAOVERLAPPED_COMPLETION_ROUTINE
);
1282 typedef int (WINAPI
*LPFN_WSAPOLL
)(WSAPOLLFD
*,ULONG
,int);
1283 typedef int (WINAPI
*LPFN_WSARECV
)(SOCKET
,LPWSABUF
,DWORD
,LPDWORD
,LPDWORD
,LPWSAOVERLAPPED
,LPWSAOVERLAPPED_COMPLETION_ROUTINE
);
1284 typedef int (WINAPI
*LPFN_WSARECVDISCONNECT
)(SOCKET
,LPWSABUF
);
1285 typedef int (WINAPI
*LPFN_WSARECVFROM
)(SOCKET
,LPWSABUF
,DWORD
,LPDWORD
,LPDWORD
,struct WS(sockaddr
)*,LPINT
,LPWSAOVERLAPPED
,LPWSAOVERLAPPED_COMPLETION_ROUTINE
);
1286 typedef INT (WINAPI
*LPFN_WSAREMOVESERVICECLASS
)(LPGUID
);
1287 typedef BOOL (WINAPI
*LPFN_WSARESETEVENT
)(WSAEVENT
);
1288 typedef int (WINAPI
*LPFN_WSASEND
)(SOCKET
,LPWSABUF
,DWORD
,LPDWORD
,DWORD
,LPWSAOVERLAPPED
,LPWSAOVERLAPPED_COMPLETION_ROUTINE
);
1289 typedef int (WINAPI
*LPFN_WSASENDDISCONNECT
)(SOCKET
,LPWSABUF
);
1290 typedef int (WINAPI
*LPFN_WSASENDTO
)(SOCKET
,LPWSABUF
,DWORD
,LPDWORD
,DWORD
,const struct WS(sockaddr
)*,int,LPWSAOVERLAPPED
,LPWSAOVERLAPPED_COMPLETION_ROUTINE
);
1291 typedef BOOL (WINAPI
*LPFN_WSASETEVENT
)(WSAEVENT
);
1292 typedef INT (WINAPI
*LPFN_WSASETSERVICEA
)(LPWSAQUERYSETA
,WSAESETSERVICEOP
,DWORD
);
1293 typedef INT (WINAPI
*LPFN_WSASETSERVICEW
)(LPWSAQUERYSETW
,WSAESETSERVICEOP
,DWORD
);
1294 #define LPFN_WSASETSERVICE WINELIB_NAME_AW(LPFN_WSASETSERVICE)
1295 typedef SOCKET (WINAPI
*LPFN_WSASOCKETA
)(int,int,int,LPWSAPROTOCOL_INFOA
,GROUP
,DWORD
);
1296 typedef SOCKET (WINAPI
*LPFN_WSASOCKETW
)(int,int,int,LPWSAPROTOCOL_INFOW
,GROUP
,DWORD
);
1297 typedef INT (WINAPI
*LPFN_WSASTRINGTOADDRESSA
)(LPSTR
,INT
,LPWSAPROTOCOL_INFOA
,LPSOCKADDR
,LPINT
);
1298 typedef INT (WINAPI
*LPFN_WSASTRINGTOADDRESSW
)(LPSTR
,INT
,LPWSAPROTOCOL_INFOA
,LPSOCKADDR
,LPINT
);
1299 #define LPFN_WSASOCKET WINELIB_NAME_AW(LPFN_WSASOCKET)
1300 #define LPFN_WSASTRINGTOADDRESS WINELIB_NAME_AW(LPFN_WSASTRINGTOADDRESS)
1301 typedef DWORD (WINAPI
*LPFN_WSAWAITFORMULTIPLEEVENTS
)(DWORD
,const WSAEVENT
*,BOOL
,DWORD
,BOOL
);
1302 #endif /* WS_API_TYPEDEFS */
1305 /* Condition function return values */
1306 #define CF_ACCEPT 0x0000
1307 #define CF_REJECT 0x0001
1308 #define CF_DEFER 0x0002
1315 #undef WS_API_PROTOTYPES
1316 #undef WS_API_TYPEDEFS
1318 #endif /* __WINSOCK2API__ */