1 /* WINSOCK.H--definitions to be used with the WINSOCK.DLL
3 * This header file corresponds to version 1.1 of the Windows Sockets
6 * Copyright (C) the Wine project
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 # ifndef __WINE_WINSOCK2__
25 # error Please use Winsock2 in Wine
51 #endif /* defined(__cplusplus) */
53 /* proper 4-byte packing */
57 * This section defines the items that conflict with the Unix headers.
60 #ifndef __WINE_USE_MSVCRT
61 /* Get the u_xxx types from the Unix headers. They will do and doing it
62 * this way will avoid redefinitions. But on FreeBSD we may get macros
63 * and prototypes for htonl & co. This means the functions will not be
64 * called because of the macros. So this should not harm us too much unless
65 * we try to define our own prototypes (different calling convention).
67 # include <sys/types.h>
68 # if defined(USE_WS_PREFIX) || !defined(htonl)
69 # define WS_DEFINE_HTONL
72 /* Since we are using the MSVCRT headers, we must define the u_xxx
75 typedef unsigned char u_char
;
76 typedef unsigned short u_short
;
77 typedef unsigned int u_int
;
78 typedef unsigned long u_long
;
79 # define WS_DEFINE_HTONL
80 #endif /* __WINE_USE_MSVCRT */
106 #define AF_APPLETALK 16
107 #define AF_NETBIOS 17
108 #define AF_VOICEVIEW 18
109 #define AF_FIREFOX 19
110 #define AF_UNKNOWN1 20
114 #define AF_CLUSTER 24
118 #define PF_UNSPEC AF_UNSPEC
119 #define PF_UNIX AF_UNIX
120 #define PF_INET AF_INET
121 #define PF_IMPLINK AF_IMPLINK
122 #define PF_PUP AF_PUP
123 #define PF_CHAOS AF_CHAOS
125 #define PF_IPX AF_IPX
126 #define PF_ISO AF_ISO
127 #define PF_OSI AF_OSI
128 #define PF_ECMA AF_ECMA
129 #define PF_DATAKIT AF_DATAKIT
130 #define PF_CCITT AF_CCITT
131 #define PF_SNA AF_SNA
132 #define PF_DECnet AF_DECnet
133 #define PF_DLI AF_DLI
134 #define PF_LAT AF_LAT
135 #define PF_HYLINK AF_HYLINK
136 #define PF_APPLETALK AF_APPLETALK
137 #define PF_VOICEVIEW AF_VOICEVIEW
138 #define PF_FIREFOX AF_FIREFOX
139 #define PF_UNKNOWN1 AF_UNKNOWN1
140 #define PF_BAN AF_BAN
141 #define PF_MAX AF_MAX
142 #else /* USE_WS_PREFIX */
143 #define WS_AF_UNSPEC 0
146 #define WS_AF_IMPLINK 3
148 #define WS_AF_CHAOS 5
150 #define WS_AF_IPX WS_AF_NS
152 #define WS_AF_OSI AF_ISO
154 #define WS_AF_DATAKIT 9
155 #define WS_AF_CCITT 10
157 #define WS_AF_DECnet 12
160 #define WS_AF_HYLINK 15
161 #define WS_AF_APPLETALK 16
162 #define WS_AF_NETBIOS 17
163 #define WS_AF_VOICEVIEW 18
164 #define WS_AF_FIREFOX 19
165 #define WS_AF_UNKNOWN1 20
168 #define WS_AF_INET6 23
169 #define WS_AF_CLUSTER 24
170 #define WS_AF_12844 25
171 #define WS_AF_IRDA 26
173 #endif /* USE_WS_PREFIX */
178 #ifndef USE_WS_PREFIX
179 #define SOCK_STREAM 1
183 #define SOCK_SEQPACKET 5
184 #else /* USE_WS_PREFIX */
185 #define WS_SOCK_STREAM 1
186 #define WS_SOCK_DGRAM 2
187 #define WS_SOCK_RAW 3
188 #define WS_SOCK_RDM 4
189 #define WS_SOCK_SEQPACKET 5
190 #endif /* USE_WS_PREFIX */
196 #ifndef USE_WS_PREFIX
198 #define IPPROTO_ICMP 1
199 #define IPPROTO_IGMP 2
200 #define IPPROTO_GGP 3
201 #define IPPROTO_TCP 6
202 #define IPPROTO_UDP 17
203 #define IPPROTO_IDP 22
204 #define IPPROTO_ND 77
205 #define IPPROTO_RAW 255
206 #define IPPROTO_MAX 256
207 #else /* USE_WS_PREFIX */
208 #define WS_IPPROTO_IP 0
209 #define WS_IPPROTO_ICMP 1
210 #define WS_IPPROTO_IGMP 2
211 #define WS_IPPROTO_GGP 3
212 #define WS_IPPROTO_TCP 6
213 #define WS_IPPROTO_UDP 17
214 #define WS_IPPROTO_IDP 22
215 #define WS_IPPROTO_ND 77
216 #define WS_IPPROTO_RAW 255
217 #define WS_IPPROTO_MAX 256
218 #endif /* USE_WS_PREFIX */
220 typedef struct WS(protoent
)
225 } PROTOENT
, *PPROTOENT
, *LPPROTOENT
;
234 char* n_name
; /* official name of net */
235 char** n_aliases
; /* alias list */
236 short n_addrtype
; /* net address type */
237 u_long n_net
; /* network # */
244 #ifndef USE_WS_PREFIX
245 #define IPPORT_ECHO 7
246 #define IPPORT_DISCARD 9
247 #define IPPORT_SYSTAT 11
248 #define IPPORT_DAYTIME 13
249 #define IPPORT_NETSTAT 15
250 #define IPPORT_FTP 21
251 #define IPPORT_TELNET 23
252 #define IPPORT_SMTP 25
253 #define IPPORT_TIMESERVER 37
254 #define IPPORT_NAMESERVER 42
255 #define IPPORT_WHOIS 43
256 #define IPPORT_MTP 57
257 #define IPPORT_TFTP 69
258 #define IPPORT_RJE 77
259 #define IPPORT_FINGER 79
260 #define IPPORT_TTYLINK 87
261 #define IPPORT_SUPDUP 95
262 #define IPPORT_EXECSERVER 512
263 #define IPPORT_LOGINSERVER 513
264 #define IPPORT_CMDSERVER 514
265 #define IPPORT_EFSSERVER 520
266 #define IPPORT_BIFFUDP 512
267 #define IPPORT_WHOSERVER 513
268 #define IPPORT_ROUTESERVER 520
269 #define IPPORT_RESERVED 1024
270 #else /* USE_WS_PREFIX */
271 #define WS_IPPORT_ECHO 7
272 #define WS_IPPORT_DISCARD 9
273 #define WS_IPPORT_SYSTAT 11
274 #define WS_IPPORT_DAYTIME 13
275 #define WS_IPPORT_NETSTAT 15
276 #define WS_IPPORT_FTP 21
277 #define WS_IPPORT_TELNET 23
278 #define WS_IPPORT_SMTP 25
279 #define WS_IPPORT_TIMESERVER 37
280 #define WS_IPPORT_NAMESERVER 42
281 #define WS_IPPORT_WHOIS 43
282 #define WS_IPPORT_MTP 57
283 #define WS_IPPORT_TFTP 69
284 #define WS_IPPORT_RJE 77
285 #define WS_IPPORT_FINGER 79
286 #define WS_IPPORT_TTYLINK 87
287 #define WS_IPPORT_SUPDUP 95
288 #define WS_IPPORT_EXECSERVER 512
289 #define WS_IPPORT_LOGINSERVER 513
290 #define WS_IPPORT_CMDSERVER 514
291 #define WS_IPPORT_EFSSERVER 520
292 #define WS_IPPORT_BIFFUDP 512
293 #define WS_IPPORT_WHOSERVER 513
294 #define WS_IPPORT_ROUTESERVER 520
295 #define WS_IPPORT_RESERVED 1024
296 #endif /* USE_WS_PREFIX */
298 typedef struct WS(servent
)
300 char* s_name
; /* official service name */
301 char** s_aliases
; /* alias list */
302 short s_port
; /* port # */
303 char* s_proto
; /* protocol to use */
304 } SERVENT
, *PSERVENT
, *LPSERVENT
;
312 typedef struct WS(hostent
)
314 char* h_name
; /* official name of host */
315 char** h_aliases
; /* alias list */
316 short h_addrtype
; /* host address type */
317 short h_length
; /* length of address */
318 char** h_addr_list
; /* list of addresses from name server */
319 #define h_addr h_addr_list[0] /* address, for backward compat */
320 } HOSTENT
, *PHOSTENT
, *LPHOSTENT
;
327 typedef u_int SOCKET
;
330 * This is used instead of -1, since the
331 * SOCKET type is unsigned.
333 #define INVALID_SOCKET (~0)
334 #define SOCKET_ERROR (-1)
336 typedef struct WS(sockaddr
)
340 } SOCKADDR
, *PSOCKADDR
, *LPSOCKADDR
;
342 typedef struct WS(linger
)
344 u_short l_onoff
; /* option on/off */
345 u_short l_linger
; /* linger time */
346 } LINGER
, *PLINGER
, *LPLINGER
;
352 #if !defined(USE_WS_PREFIX) && !defined(__WINE_USE_MSVCRT)
353 /* We are not using the WS_ prefix and not using the MSVCRT either so we
354 * risk getting conflicts for everything related to select.
357 /* Too late, the Unix version of stdlib.h was included before winsock.h.
358 * This means select and all the related stuff is already defined and we
359 * cannot override types and function prototypes.
360 * All we can do is disable all these symbols so that they are not used
369 # define FD_SETSIZE Include_winsock_h_before_stdlib_h_or_use_the_MSVCRT_library
370 # define FD_CLR Include_winsock_h_before_stdlib_h_or_use_the_MSVCRT_library
371 # define FD_SET Include_winsock_h_before_stdlib_h_or_use_the_MSVCRT_library
372 # define FD_ZERO Include_winsock_h_before_stdlib_h_or_use_the_MSVCRT_library
373 # define FD_ISSET Include_winsock_h_before_stdlib_h_or_use_the_MSVCRT_library
374 # define fd_set Include_winsock_h_before_stdlib_h_or_use_the_MSVCRT_library
375 # define select Include_winsock_h_before_stdlib_h_or_use_the_MSVCRT_library
377 /* stdlib.h has not been included yet so it's not too late. Include it now
378 * making sure that none of the select symbols is affected. Then we can
379 * define them with our own values.
381 # define fd_set unix_fd_set
382 # define timeval unix_timeval
383 # define select unix_select
394 # define WS_DEFINE_SELECT
398 # define WS_DEFINE_SELECT
399 #endif /* !USE_WS_PREFIX && !__WINE_USE_MSVCRT */
401 #ifdef WS_DEFINE_SELECT
402 # undef WS_DEFINE_SELECT
403 /* Define our own version of select and the associated types and macros */
405 # ifndef USE_WS_PREFIX
407 # define FD_SETSIZE 64
410 # ifndef WS_FD_SETSIZE
411 # define WS_FD_SETSIZE 64
415 typedef struct WS(fd_set
)
417 u_int fd_count
; /* how many are SET? */
418 # ifndef USE_WS_PREFIX
419 SOCKET fd_array
[FD_SETSIZE
]; /* an array of SOCKETs */
421 SOCKET fd_array
[WS_FD_SETSIZE
];/* an array of SOCKETs */
423 } WS(fd_set
), FD_SET
, *PFD_SET
, *LPFD_SET
;
425 typedef struct WS(timeval
)
427 long tv_sec
; /* seconds */
428 long tv_usec
; /* and microseconds */
429 } TIMEVAL
, *PTIMEVAL
, *LPTIMEVAL
;
431 #define WINE_FD_CLR(fd, set, cast) do { \
433 for (__i = 0; __i < ((cast*)(set))->fd_count ; __i++) \
435 if (((cast*)(set))->fd_array[__i] == fd) \
437 while (__i < ((cast*)(set))->fd_count-1) \
439 ((cast*)(set))->fd_array[__i] = \
440 ((cast*)(set))->fd_array[__i+1]; \
443 ((cast*)(set))->fd_count--; \
448 #define __WS_FD_SET1(fd, set, cast) do { \
449 if (((cast*)(set))->fd_count < FD_SETSIZE) \
450 ((cast*)(set))->fd_array[((cast*)(set))->fd_count++]=(fd); \
452 /* This version checks if the filedesc is already in the list, and appends it
453 * only if it's not the case
455 #define __WS_FD_SET2(fd, set, cast) do { \
457 for (__i = 0; __i < ((cast*)(set))->fd_count ; __i++) \
459 if ((cast*)(set))->fd_array[__i]=(fd) \
462 if (__i == ((cast*)(set))->fd_count && ((cast*)(set))->fd_count < FD_SETSIZE) \
464 ((cast*)(set))->fd_count++; \
465 ((cast*)(set))->fd_array[__i]=(fd);\
469 #ifndef __WINE_WINSOCK2__
470 #define __WS_FD_SET(fd, set, cast) __WS_FD_SET1((fd),(set), (cast))
472 #define __WS_FD_SET(fd, set, cast) __WS_FD_SET2((fd),(set), (cast))
475 #ifndef USE_WS_PREFIX
476 #define FD_CLR(fd, set) __WS_FD_CLR((fd),(set), WS(fd_set))
477 #define FD_SET(fd, set) __WS_FD_SET((fd),(set), WS(fd_set))
478 #define FD_ZERO(set) (((WS(fd_set)*)(set))->fd_count=0)
479 #define FD_ISSET(fd, set) __WSAFDIsSet((SOCKET)(fd), (WS(fd_set)*)(set))
481 #define WS_FD_CLR(fd, set) WINE_FD_CLR((fd),(set), WS(fd_set))
482 #define WS_FD_SET(fd, set) WINE_FD_SET((fd),(set), WS(fd_set))
483 #define WS_FD_ZERO(set) (((WS(fd_set)*)(set))->fd_count=0)
484 #define WS_FD_ISSET(fd, set) __WSAFDIsSet((SOCKET)(fd), (WS(fd_set)*)(set))
486 #endif /* WS_DEFINE_SELECT */
490 * Internet address (old style... should be updated)
493 #ifndef USE_WS_PREFIX
494 #define IN_CLASSA_NSHIFT 24
495 #define IN_CLASSA_MAX 128
496 #define IN_CLASSA_NET 0xff000000
497 #define IN_CLASSA_HOST 0x00ffffff
498 #define IN_CLASSA(i) (((long)(i) & 0x80000000) == 0)
499 #define IN_CLASSB_NSHIFT 16
500 #define IN_CLASSB_MAX 65536
501 #define IN_CLASSB_NET 0xffff0000
502 #define IN_CLASSB_HOST 0x0000ffff
503 #define IN_CLASSB(i) (((long)(i) & 0xc0000000) == 0x80000000)
504 #define IN_CLASSC_NSHIFT 8
505 #define IN_CLASSC_NET 0xffffff00
506 #define IN_CLASSC_HOST 0x000000ff
507 #define IN_CLASSC(i) (((long)(i) & 0xe0000000) == 0xc0000000)
509 #define WS_IN_CLASSA_NSHIFT 24
510 #define WS_IN_CLASSA_MAX 128
511 #define WS_IN_CLASSA_NET 0xff000000
512 #define WS_IN_CLASSA_HOST 0x00ffffff
513 #define WS_IN_CLASSA(i) (((long)(i) & 0x80000000) == 0)
514 #define WS_IN_CLASSB_NSHIFT 16
515 #define WS_IN_CLASSB_MAX 65536
516 #define WS_IN_CLASSB_NET 0xffff0000
517 #define WS_IN_CLASSB_HOST 0x0000ffff
518 #define WS_IN_CLASSB(i) (((long)(i) & 0xc0000000) == 0x80000000)
519 #define WS_IN_CLASSC_NSHIFT 8
520 #define WS_IN_CLASSC_NET 0xffffff00
521 #define WS_IN_CLASSC_HOST 0x000000ff
522 #define WS_IN_CLASSC(i) (((long)(i) & 0xe0000000) == 0xc0000000)
523 #endif /* USE_WS_PREFIX */
525 #ifndef USE_WS_PREFIX
526 #define INADDR_ANY (u_long)0x00000000
527 #define INADDR_LOOPBACK 0x7f000001
528 #define INADDR_BROADCAST (u_long)0xffffffff
529 #define INADDR_NONE 0xffffffff
531 #define WS_INADDR_ANY (u_long)0x00000000
532 #define WS_INADDR_LOOPBACK 0x7f000001
533 #define WS_INADDR_BROADCAST (u_long)0xffffffff
534 #define WS_INADDR_NONE 0xffffffff
535 #endif /* USE_WS_PREFIX */
537 typedef struct WS(in_addr
)
541 u_char s_b1
,s_b2
,s_b3
,s_b4
;
548 #ifndef USE_WS_PREFIX
549 #define s_addr S_un.S_addr
550 #define s_host S_un.S_un_b.s_b2
551 #define s_net S_un.S_un_b.s_b1
552 #define s_imp S_un.S_un_w.s_w2
553 #define s_impno S_un.S_un_b.s_b4
554 #define s_lh S_un.S_un_b.s_b3
556 #define WS_s_addr S_un.S_addr
557 #define WS_s_host S_un.S_un_b.s_b2
558 #define WS_s_net S_un.S_un_b.s_b1
559 #define WS_s_imp S_un.S_un_w.s_w2
560 #define WS_s_impno S_un.S_un_b.s_b4
561 #define WS_s_lh S_un.S_un_b.s_b3
562 #endif /* USE_WS_PREFIX */
563 } IN_ADDR
, *PIN_ADDR
, *LPIN_ADDR
;
565 typedef struct WS(sockaddr_in
)
569 struct WS(in_addr
) sin_addr
;
571 } SOCKADDR_IN
, *PSOCKADDR_IN
, *LPSOCKADDR_IN
;
577 #define WSADESCRIPTION_LEN 256
578 #define WSASYS_STATUS_LEN 128
580 typedef struct WS(WSAData
)
584 char szDescription
[WSADESCRIPTION_LEN
+1];
585 char szSystemStatus
[WSASYS_STATUS_LEN
+1];
589 } WSADATA
, *LPWSADATA
;
596 #ifndef USE_WS_PREFIX
597 #define SOL_SOCKET 0xffff
598 #define SO_DEBUG 0x0001
599 #define SO_ACCEPTCONN 0x0002
600 #define SO_REUSEADDR 0x0004
601 #define SO_KEEPALIVE 0x0008
602 #define SO_DONTROUTE 0x0010
603 #define SO_BROADCAST 0x0020
604 #define SO_USELOOPBACK 0x0040
605 #define SO_LINGER 0x0080
606 #define SO_OOBINLINE 0x0100
607 #define SO_DONTLINGER (u_int)(~SO_LINGER)
608 #define SO_SNDBUF 0x1001
609 #define SO_RCVBUF 0x1002
610 #define SO_SNDLOWAT 0x1003
611 #define SO_RCVLOWAT 0x1004
612 #define SO_SNDTIMEO 0x1005
613 #define SO_RCVTIMEO 0x1006
614 #define SO_ERROR 0x1007
615 #define SO_TYPE 0x1008
618 #define IOCPARM_MASK 0x7f
619 #define IOC_VOID 0x20000000
620 #define IOC_OUT 0x40000000
621 #define IOC_IN 0x80000000
622 #define IOC_INOUT (IOC_IN|IOC_OUT)
624 #define _IO(x,y) (IOC_VOID|((x)<<8)|(y))
625 #define _IOR(x,y,t) (IOC_OUT|(((UINT)sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|(y))
626 #define _IOW(x,y,t) (IOC_IN|(((UINT)sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|(y))
630 #define WS_SOL_SOCKET 0xffff
631 #define WS_SO_DEBUG 0x0001
632 #define WS_SO_ACCEPTCONN 0x0002
633 #define WS_SO_REUSEADDR 0x0004
634 #define WS_SO_KEEPALIVE 0x0008
635 #define WS_SO_DONTROUTE 0x0010
636 #define WS_SO_BROADCAST 0x0020
637 #define WS_SO_USELOOPBACK 0x0040
638 #define WS_SO_LINGER 0x0080
639 #define WS_SO_OOBINLINE 0x0100
640 #define WS_SO_DONTLINGER (u_int)(~WS_SO_LINGER)
641 #define WS_SO_SNDBUF 0x1001
642 #define WS_SO_RCVBUF 0x1002
643 #define WS_SO_SNDLOWAT 0x1003
644 #define WS_SO_RCVLOWAT 0x1004
645 #define WS_SO_SNDTIMEO 0x1005
646 #define WS_SO_RCVTIMEO 0x1006
647 #define WS_SO_ERROR 0x1007
648 #define WS_SO_TYPE 0x1008
650 #define WS_IOCPARM_MASK 0x7f
651 #define WS_IOC_VOID 0x20000000
652 #define WS_IOC_OUT 0x40000000
653 #define WS_IOC_IN 0x80000000
654 #define WS_IOC_INOUT (WS_IOC_IN|WS_IOC_OUT)
656 #define WS__IO(x,y) (WS_IOC_VOID|((x)<<8)|(y))
657 #define WS__IOR(x,y,t) (WS_IOC_OUT|(((long)sizeof(t)&WS_IOCPARM_MASK)<<16)|((x)<<8)|(y))
658 #define WS__IOW(x,y,t) (WS_IOC_IN|(((long)sizeof(t)&WS_IOCPARM_MASK)<<16)|((x)<<8)|(y))
662 /* IPPROTO_TCP options */
663 #ifndef USE_WS_PREFIX
664 #define TCP_NODELAY 1
666 #define WS_TCP_NODELAY 1
670 * Socket I/O flags (supported by spec 1.1)
672 #ifndef USE_WS_PREFIX
673 #define FIONREAD _IOR('f', 127, u_long)
674 #define FIONBIO _IOW('f', 126, u_long)
675 #define SIOCATMARK _IOR('s', 7, u_long)
677 #define WS_FIONREAD WS__IOR('f', 127, u_long)
678 #define WS_FIONBIO WS__IOW('f', 126, u_long)
679 #define WS_SIOCATMARK WS__IOR('s', 7, u_long)
683 * Maximum queue length specifiable by listen.
685 #ifndef USE_WS_PREFIX
688 #define MSG_OOB 0x0001
689 #define MSG_PEEK 0x0002
690 #define MSG_DONTROUTE 0x0004
691 #define MSG_MAXIOVLEN 0x000a
692 #define MSG_PARTIAL 0x8000
693 #else /* USE_WS_PREFIX */
694 #define WS_SOMAXCONN 5
696 #define WS_MSG_OOB 0x0001
697 #define WS_MSG_PEEK 0x0002
698 #define WS_MSG_DONTROUTE 0x0004
699 #define WS_MSG_MAXIOVLEN 0x000a
700 #define WS_MSG_PARTIAL 0x8000
701 #endif /* USE_WS_PREFIX */
704 * Define constant based on rfc883, used by gethostbyxxxx() calls.
706 #ifndef USE_WS_PREFIX
707 #define MAXGETHOSTSTRUCT 1024
709 #define MAXGETHOSTSTRUCT 1024
714 * Define flags to be used with the WSAAsyncSelect() call.
716 #define FD_READ 0x00000001
717 #define FD_WRITE 0x00000002
718 #define FD_OOB 0x00000004
719 #define FD_ACCEPT 0x00000008
720 #define FD_CONNECT 0x00000010
721 #define FD_CLOSE 0x00000020
723 /* internal per-socket flags */
725 #define FD_WINE_LISTENING 0x10000000
726 #define FD_WINE_NONBLOCKING 0x20000000
727 #define FD_WINE_CONNECTED 0x40000000
728 #define FD_WINE_RAW 0x80000000
729 #define FD_WINE_INTERNAL 0xFFFF0000
733 * All Windows Sockets error constants are biased by WSABASEERR from
736 #define WSABASEERR 10000
738 * Windows Sockets definitions of regular Microsoft C error constants
740 #define WSAEINTR (WSABASEERR+4)
741 #define WSAEBADF (WSABASEERR+9)
742 #define WSAEACCES (WSABASEERR+13)
743 #define WSAEFAULT (WSABASEERR+14)
744 #define WSAEINVAL (WSABASEERR+22)
745 #define WSAEMFILE (WSABASEERR+24)
748 * Windows Sockets definitions of regular Berkeley error constants
750 #define WSAEWOULDBLOCK (WSABASEERR+35)
751 #define WSAEINPROGRESS (WSABASEERR+36)
752 #define WSAEALREADY (WSABASEERR+37)
753 #define WSAENOTSOCK (WSABASEERR+38)
754 #define WSAEDESTADDRREQ (WSABASEERR+39)
755 #define WSAEMSGSIZE (WSABASEERR+40)
756 #define WSAEPROTOTYPE (WSABASEERR+41)
757 #define WSAENOPROTOOPT (WSABASEERR+42)
758 #define WSAEPROTONOSUPPORT (WSABASEERR+43)
759 #define WSAESOCKTNOSUPPORT (WSABASEERR+44)
760 #define WSAEOPNOTSUPP (WSABASEERR+45)
761 #define WSAEPFNOSUPPORT (WSABASEERR+46)
762 #define WSAEAFNOSUPPORT (WSABASEERR+47)
763 #define WSAEADDRINUSE (WSABASEERR+48)
764 #define WSAEADDRNOTAVAIL (WSABASEERR+49)
765 #define WSAENETDOWN (WSABASEERR+50)
766 #define WSAENETUNREACH (WSABASEERR+51)
767 #define WSAENETRESET (WSABASEERR+52)
768 #define WSAECONNABORTED (WSABASEERR+53)
769 #define WSAECONNRESET (WSABASEERR+54)
770 #define WSAENOBUFS (WSABASEERR+55)
771 #define WSAEISCONN (WSABASEERR+56)
772 #define WSAENOTCONN (WSABASEERR+57)
773 #define WSAESHUTDOWN (WSABASEERR+58)
774 #define WSAETOOMANYREFS (WSABASEERR+59)
775 #define WSAETIMEDOUT (WSABASEERR+60)
776 #define WSAECONNREFUSED (WSABASEERR+61)
777 #define WSAELOOP (WSABASEERR+62)
778 #define WSAENAMETOOLONG (WSABASEERR+63)
779 #define WSAEHOSTDOWN (WSABASEERR+64)
780 #define WSAEHOSTUNREACH (WSABASEERR+65)
781 #define WSAENOTEMPTY (WSABASEERR+66)
782 #define WSAEPROCLIM (WSABASEERR+67)
783 #define WSAEUSERS (WSABASEERR+68)
784 #define WSAEDQUOT (WSABASEERR+69)
785 #define WSAESTALE (WSABASEERR+70)
786 #define WSAEREMOTE (WSABASEERR+71)
789 * Extended Windows Sockets error constant definitions
791 #define WSASYSNOTREADY (WSABASEERR+91)
792 #define WSAVERNOTSUPPORTED (WSABASEERR+92)
793 #define WSANOTINITIALISED (WSABASEERR+93)
796 * Error return codes from gethostbyname() and gethostbyaddr()
797 * (when using the resolver). Note that these errors are
798 * retrieved via WSAGetLastError() and must therefore follow
799 * the rules for avoiding clashes with error numbers from
800 * specific implementations or language run-time systems.
801 * For this reason the codes are based at WSABASEERR+1001.
802 * Note also that [WSA]NO_ADDRESS is defined only for
803 * compatibility purposes.
806 #ifndef USE_WS_PREFIX
807 #define h_errno WSAGetLastError()
809 #define WS_h_errno WSAGetLastError()
812 /* Authoritative Answer: Host not found */
813 #define WSAHOST_NOT_FOUND (WSABASEERR+1001)
815 /* Non-Authoritative: Host not found, or SERVERFAIL */
816 #define WSATRY_AGAIN (WSABASEERR+1002)
818 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
819 #define WSANO_RECOVERY (WSABASEERR+1003)
821 /* Valid name, no data record of requested type */
822 #define WSANO_DATA (WSABASEERR+1004)
824 /* no address, look for MX record */
825 #define WSANO_ADDRESS WSANO_DATA
827 #ifndef USE_WS_PREFIX
828 #define HOST_NOT_FOUND WSAHOST_NOT_FOUND
829 #define TRY_AGAIN WSATRY_AGAIN
830 #define NO_RECOVERY WSANO_RECOVERY
831 #define NO_DATA WSANO_DATA
832 #define NO_ADDRESS WSANO_ADDRESS
833 #endif /* USE_WS_PREFIX */
838 * Windows message parameter composition and decomposition
843 * WSAMAKEASYNCREPLY is intended for use by the Windows Sockets implementation
844 * when constructing the response to a WSAAsyncGetXByY() routine.
846 #define WSAMAKEASYNCREPLY(buflen,error) MAKELONG(buflen,error)
848 * WSAMAKESELECTREPLY is intended for use by the Windows Sockets implementation
849 * when constructing the response to WSAAsyncSelect().
851 #define WSAMAKESELECTREPLY(event,error) MAKELONG(event,error)
853 * WSAGETASYNCBUFLEN is intended for use by the Windows Sockets application
854 * to extract the buffer length from the lParam in the response
857 #define WSAGETASYNCBUFLEN(lParam) LOWORD(lParam)
859 * WSAGETASYNCERROR is intended for use by the Windows Sockets application
860 * to extract the error code from the lParam in the response
863 #define WSAGETASYNCERROR(lParam) HIWORD(lParam)
865 * WSAGETSELECTEVENT is intended for use by the Windows Sockets application
866 * to extract the event code from the lParam in the response
867 * to a WSAAsyncSelect().
869 #define WSAGETSELECTEVENT(lParam) LOWORD(lParam)
871 * WSAGETSELECTERROR is intended for use by the Windows Sockets application
872 * to extract the error code from the lParam in the response
873 * to a WSAAsyncSelect().
875 #define WSAGETSELECTERROR(lParam) HIWORD(lParam)
882 * Remember to keep this section in sync with the
883 * "Winsock Function Typedefs" section in winsock2.h.
885 #if !defined(__WINE_WINSOCK2__) || WS_API_PROTOTYPES
886 HANDLE WINAPI
WSAAsyncGetHostByAddr(HWND
,u_int
,const char*,int,int,char*,int);
887 HANDLE WINAPI
WSAAsyncGetHostByName(HWND
,u_int
,const char*,char*,int);
888 HANDLE WINAPI
WSAAsyncGetProtoByName(HWND
,u_int
,const char*,char*,int);
889 HANDLE WINAPI
WSAAsyncGetProtoByNumber(HWND
,u_int
,int,char*,int);
890 HANDLE WINAPI
WSAAsyncGetServByName(HWND
,u_int
,const char*,const char*,char*,int);
891 HANDLE WINAPI
WSAAsyncGetServByPort(HWND
,u_int
,int,const char*,char*,int);
892 int WINAPI
WSAAsyncSelect(SOCKET
,HWND
,u_int
,long);
893 int WINAPI
WSACancelAsyncRequest(HANDLE
);
894 int WINAPI
WSACancelBlockingCall(void);
895 int WINAPI
WSACleanup(void);
896 int WINAPI
WSAGetLastError(void);
897 BOOL WINAPI
WSAIsBlocking(void);
898 FARPROC WINAPI
WSASetBlockingHook(FARPROC
);
899 void WINAPI
WSASetLastError(int);
900 int WINAPI
WSAStartup(WORD
,LPWSADATA
);
901 int WINAPI
WSAUnhookBlockingHook(void);
903 SOCKET WINAPI
WS(accept
)(SOCKET
,struct WS(sockaddr
)*,int*);
904 int WINAPI
WS(bind
)(SOCKET
,const struct WS(sockaddr
)*,int);
905 int WINAPI
WS(closesocket
)(SOCKET
);
906 int WINAPI
WS(connect
)(SOCKET
,const struct WS(sockaddr
)*,int);
907 struct WS(hostent
)* WINAPI
WS(gethostbyaddr
)(const char*,int,int);
908 struct WS(hostent
)* WINAPI
WS(gethostbyname
)(const char*);
909 /* gethostname not defined because of conflicts with unistd.h */
910 int WINAPI
WS(getpeername
)(SOCKET
,struct WS(sockaddr
)*,int*);
911 struct WS(protoent
)* WINAPI
WS(getprotobyname
)(const char*);
912 struct WS(protoent
)* WINAPI
WS(getprotobynumber
)(int);
913 #ifdef WS_DEFINE_SELECT
914 int WS(select
)(int,WS(fd_set
)*,WS(fd_set
)*,WS(fd_set
)*,const struct WS(timeval
)*);
916 struct WS(servent
)* WINAPI
WS(getservbyname
)(const char*,const char*);
917 struct WS(servent
)* WINAPI
WS(getservbyport
)(int,const char*);
918 int WINAPI
WS(getsockname
)(SOCKET
,struct WS(sockaddr
)*,int*);
919 int WINAPI
WS(getsockopt
)(SOCKET
,int,int,char*,int*);
920 unsigned long WINAPI
WS(inet_addr
)(const char*);
921 char* WINAPI
WS(inet_ntoa
)(struct WS(in_addr
));
922 int WINAPI
WS(ioctlsocket
)(SOCKET
,long,u_long
*);
923 int WINAPI
WS(listen
)(SOCKET
,int);
924 int WINAPI
WS(recv
)(SOCKET
,char*,int,int);
925 int WINAPI
WS(recvfrom
)(SOCKET
,char*,int,int,struct WS(sockaddr
)*,int*);
926 int WINAPI
WS(send
)(SOCKET
,const char*,int,int);
927 int WINAPI
WS(sendto
)(SOCKET
,const char*,int,int,const struct WS(sockaddr
)*,int);
928 int WINAPI
WS(setsockopt
)(SOCKET
,int,int,const char*,int);
929 int WINAPI
WS(shutdown
)(SOCKET
,int);
930 SOCKET WINAPI
WS(socket
)(int,int,int);
932 #ifdef WS_DEFINE_HTONL
933 u_long WINAPI
WS(htonl
)(u_long
);
934 u_short WINAPI
WS(htons
)(u_short
);
935 u_long WINAPI
WS(ntohl
)(u_long
);
936 u_short WINAPI
WS(ntohs
)(u_short
);
939 #if defined(__WINE__) || !defined(__WINE_WINSOCK2__)
940 /* Stuff specific to winsock.h */
944 #endif /* __WINE_WINSOCK2__ */
945 #endif /* !defined(__WINE_WINSOCK2__) || WS_API_PROTOTYPES */
954 #ifndef __WINE_WINSOCK2__
956 #undef WS_API_PROTOTYPES
957 #undef WS_API_TYPEDEFS
960 #endif /* _WINSOCKAPI_ */