1 /* WINSOCK.H--definitions to be used with the WINSOCK.DLL
3 * This header file corresponds to version 1.1 of the Windows Sockets
8 # ifndef __WINE_WINSOCK2__
9 # error Please use Winsock2 in Wine
35 #endif /* defined(__cplusplus) */
37 /* proper 4-byte packing */
41 * This section defines the items that conflict with the Unix headers.
44 #ifndef __WINE_USE_MSVCRT
45 /* Get the u_xxx types from the Unix headers. They will do and
46 * doing it this way will avoid redefinitions.
48 # include <sys/types.h>
50 /* Since we are using the MSVCRT headers, we must define the u_xxx
53 typedef unsigned char u_char;
54 typedef unsigned char u_short;
55 typedef unsigned int u_int;
56 typedef unsigned long u_long;
57 #endif /* __WINE_USE_MSVCRT */
83 #define AF_APPLETALK 16
85 #define AF_VOICEVIEW 18
87 #define AF_UNKNOWN1 20
95 #define PF_UNSPEC AF_UNSPEC
96 #define PF_UNIX AF_UNIX
97 #define PF_INET AF_INET
98 #define PF_IMPLINK AF_IMPLINK
100 #define PF_CHAOS AF_CHAOS
102 #define PF_IPX AF_IPX
103 #define PF_ISO AF_ISO
104 #define PF_OSI AF_OSI
105 #define PF_ECMA AF_ECMA
106 #define PF_DATAKIT AF_DATAKIT
107 #define PF_CCITT AF_CCITT
108 #define PF_SNA AF_SNA
109 #define PF_DECnet AF_DECnet
110 #define PF_DLI AF_DLI
111 #define PF_LAT AF_LAT
112 #define PF_HYLINK AF_HYLINK
113 #define PF_APPLETALK AF_APPLETALK
114 #define PF_VOICEVIEW AF_VOICEVIEW
115 #define PF_FIREFOX AF_FIREFOX
116 #define PF_UNKNOWN1 AF_UNKNOWN1
117 #define PF_BAN AF_BAN
118 #define PF_MAX AF_MAX
119 #else /* USE_WS_PREFIX */
120 #define WS_AF_UNSPEC 0
123 #define WS_AF_IMPLINK 3
125 #define WS_AF_CHAOS 5
127 #define WS_AF_IPX WS_AF_NS
129 #define WS_AF_OSI AF_ISO
131 #define WS_AF_DATAKIT 9
132 #define WS_AF_CCITT 10
134 #define WS_AF_DECnet 12
137 #define WS_AF_HYLINK 15
138 #define WS_AF_APPLETALK 16
139 #define WS_AF_NETBIOS 17
140 #define WS_AF_VOICEVIEW 18
141 #define WS_AF_FIREFOX 19
142 #define WS_AF_UNKNOWN1 20
145 #define WS_AF_INET6 23
146 #define WS_AF_CLUSTER 24
147 #define WS_AF_12844 25
148 #define WS_AF_IRDA 26
150 #endif /* USE_WS_PREFIX */
155 #ifndef USE_WS_PREFIX
156 #define SOCK_STREAM 1
160 #define SOCK_SEQPACKET 5
161 #else /* USE_WS_PREFIX */
162 #define WS_SOCK_STREAM 1
163 #define WS_SOCK_DGRAM 2
164 #define WS_SOCK_RAW 3
165 #define WS_SOCK_RDM 4
166 #define WS_SOCK_SEQPACKET 5
167 #endif /* USE_WS_PREFIX */
173 #ifndef USE_WS_PREFIX
175 #define IPPROTO_ICMP 1
176 #define IPPROTO_IGMP 2
177 #define IPPROTO_GGP 3
178 #define IPPROTO_TCP 6
179 #define IPPROTO_UDP 17
180 #define IPPROTO_IDP 22
181 #define IPPROTO_ND 77
182 #define IPPROTO_RAW 255
183 #define IPPROTO_MAX 256
184 #else /* USE_WS_PREFIX */
185 #define WS_IPPROTO_IP 0
186 #define WS_IPPROTO_ICMP 1
187 #define WS_IPPROTO_IGMP 2
188 #define WS_IPPROTO_GGP 3
189 #define WS_IPPROTO_TCP 6
190 #define WS_IPPROTO_UDP 17
191 #define WS_IPPROTO_IDP 22
192 #define WS_IPPROTO_ND 77
193 #define WS_IPPROTO_RAW 255
194 #define WS_IPPROTO_MAX 256
195 #endif /* USE_WS_PREFIX */
197 typedef struct WS(protoent)
202 } PROTOENT, *PPROTOENT, *LPPROTOENT;
211 char* n_name; /* official name of net */
212 char** n_aliases; /* alias list */
213 short n_addrtype; /* net address type */
214 u_long n_net; /* network # */
221 #ifndef USE_WS_PREFIX
222 #define IPPORT_ECHO 7
223 #define IPPORT_DISCARD 9
224 #define IPPORT_SYSTAT 11
225 #define IPPORT_DAYTIME 13
226 #define IPPORT_NETSTAT 15
227 #define IPPORT_FTP 21
228 #define IPPORT_TELNET 23
229 #define IPPORT_SMTP 25
230 #define IPPORT_TIMESERVER 37
231 #define IPPORT_NAMESERVER 42
232 #define IPPORT_WHOIS 43
233 #define IPPORT_MTP 57
234 #define IPPORT_TFTP 69
235 #define IPPORT_RJE 77
236 #define IPPORT_FINGER 79
237 #define IPPORT_TTYLINK 87
238 #define IPPORT_SUPDUP 95
239 #define IPPORT_EXECSERVER 512
240 #define IPPORT_LOGINSERVER 513
241 #define IPPORT_CMDSERVER 514
242 #define IPPORT_EFSSERVER 520
243 #define IPPORT_BIFFUDP 512
244 #define IPPORT_WHOSERVER 513
245 #define IPPORT_ROUTESERVER 520
246 #define IPPORT_RESERVED 1024
247 #else /* USE_WS_PREFIX */
248 #define WS_IPPORT_ECHO 7
249 #define WS_IPPORT_DISCARD 9
250 #define WS_IPPORT_SYSTAT 11
251 #define WS_IPPORT_DAYTIME 13
252 #define WS_IPPORT_NETSTAT 15
253 #define WS_IPPORT_FTP 21
254 #define WS_IPPORT_TELNET 23
255 #define WS_IPPORT_SMTP 25
256 #define WS_IPPORT_TIMESERVER 37
257 #define WS_IPPORT_NAMESERVER 42
258 #define WS_IPPORT_WHOIS 43
259 #define WS_IPPORT_MTP 57
260 #define WS_IPPORT_TFTP 69
261 #define WS_IPPORT_RJE 77
262 #define WS_IPPORT_FINGER 79
263 #define WS_IPPORT_TTYLINK 87
264 #define WS_IPPORT_SUPDUP 95
265 #define WS_IPPORT_EXECSERVER 512
266 #define WS_IPPORT_LOGINSERVER 513
267 #define WS_IPPORT_CMDSERVER 514
268 #define WS_IPPORT_EFSSERVER 520
269 #define WS_IPPORT_BIFFUDP 512
270 #define WS_IPPORT_WHOSERVER 513
271 #define WS_IPPORT_ROUTESERVER 520
272 #define WS_IPPORT_RESERVED 1024
273 #endif /* USE_WS_PREFIX */
275 typedef struct WS(servent)
277 char* s_name; /* official service name */
278 char** s_aliases; /* alias list */
279 short s_port; /* port # */
280 char* s_proto; /* protocol to use */
281 } SERVENT, *PSERVENT, *LPSERVENT;
289 typedef struct WS(hostent)
291 char* h_name; /* official name of host */
292 char** h_aliases; /* alias list */
293 short h_addrtype; /* host address type */
294 short h_length; /* length of address */
295 char** h_addr_list; /* list of addresses from name server */
296 #define h_addr h_addr_list[0] /* address, for backward compat */
297 } HOSTENT, *PHOSTENT, *LPHOSTENT;
304 typedef u_int SOCKET;
307 * This is used instead of -1, since the
308 * SOCKET type is unsigned.
310 #define INVALID_SOCKET (~0)
311 #define SOCKET_ERROR (-1)
313 typedef struct WS(sockaddr)
317 } SOCKADDR, *PSOCKADDR, *LPSOCKADDR;
319 typedef struct WS(linger)
321 u_short l_onoff; /* option on/off */
322 u_short l_linger; /* linger time */
323 } LINGER, *PLINGER, *LPLINGER;
329 #if !defined(USE_WS_PREFIX) && !defined(__WINE_USE_MSVCRT)
330 /* We are not using the WS_ prefix and not using the MSVCRT either so we
331 * risk getting conflicts for everything related to select.
334 /* Too late, the Unix version of stdlib.h was included before winsock.h.
335 * This means select and all the related stuff is already defined and we
336 * cannot override types and function prototypes.
337 * All we can do is disable all these symbols so that they are not used
346 # define FD_SETSIZE Include_winsock_h_before_stdlib_h_or_use_the_MSVCRT_library
347 # define FD_CLR Include_winsock_h_before_stdlib_h_or_use_the_MSVCRT_library
348 # define FD_SET Include_winsock_h_before_stdlib_h_or_use_the_MSVCRT_library
349 # define FD_ZERO Include_winsock_h_before_stdlib_h_or_use_the_MSVCRT_library
350 # define FD_ISSET Include_winsock_h_before_stdlib_h_or_use_the_MSVCRT_library
351 # define fd_set Include_winsock_h_before_stdlib_h_or_use_the_MSVCRT_library
352 # define select Include_winsock_h_before_stdlib_h_or_use_the_MSVCRT_library
354 /* stdlib.h has not been included yet so it's not too late. Include it now
355 * making sure that none of the select symbols is affected. Then we can
356 * define them with our own values.
358 # define fd_set unix_fd_set
359 # define timeval unix_timeval
360 # define select unix_select
371 # define WS_DEFINE_SELECT
375 # define WS_DEFINE_SELECT
376 #endif /* !USE_WS_PREFIX && !__WINE_USE_MSVCRT */
378 #ifdef WS_DEFINE_SELECT
379 # undef WS_DEFINE_SELECT
380 /* Define our own version of select and the associated types and macros */
382 # ifndef USE_WS_PREFIX
384 # define FD_SETSIZE 64
387 # ifndef WS_FD_SETSIZE
388 # define WS_FD_SETSIZE 64
392 typedef struct WS(fd_set)
394 u_int fd_count; /* how many are SET? */
395 # ifndef USE_WS_PREFIX
396 SOCKET fd_array[FD_SETSIZE]; /* an array of SOCKETs */
398 SOCKET fd_array[WS_FD_SETSIZE];/* an array of SOCKETs */
400 } WS(fd_set), FD_SET, *PFD_SET, *LPFD_SET;
402 typedef struct WS(timeval)
404 long tv_sec; /* seconds */
405 long tv_usec; /* and microseconds */
406 } TIMEVAL, *PTIMEVAL, *LPTIMEVAL;
408 #define WINE_FD_CLR(fd, set, cast) do { \
410 for (__i = 0; __i < ((cast*)(set))->fd_count ; __i++) \
412 if (((cast*)(set))->fd_array[__i] == fd) \
414 while (__i < ((cast*)(set))->fd_count-1) \
416 ((cast*)(set))->fd_array[__i] = \
417 ((cast*)(set))->fd_array[__i+1]; \
420 ((cast*)(set))->fd_count--; \
425 #define __WS_FD_SET1(fd, set, cast) do { \
426 if (((cast*)(set))->fd_count < FD_SETSIZE) \
427 ((cast*)(set))->fd_array[((cast*)(set))->fd_count++]=(fd); \
429 /* This version checks if the filedesc is already in the list, and appends it
430 * only if it's not the case
432 #define __WS_FD_SET2(fd, set, cast) do { \
434 for (__i = 0; __i < ((cast*)(set))->fd_count ; __i++) \
436 if ((cast*)(set))->fd_array[__i]=(fd) \
439 if (__i == ((cast*)(set))->fd_count && ((cast*)(set))->fd_count < FD_SETSIZE) \
441 ((cast*)(set))->fd_count++; \
442 ((cast*)(set))->fd_array[__i]=(fd);\
446 #ifndef __WINE_WINSOCK2__
447 #define __WS_FD_SET(fd, set, cast) __WS_FD_SET1((fd),(set), (cast))
449 #define __WS_FD_SET(fd, set, cast) __WS_FD_SET2((fd),(set), (cast))
452 #ifndef USE_WS_PREFIX
453 #define FD_CLR(fd, set) __WS_FD_CLR((fd),(set), WS(fd_set))
454 #define FD_SET(fd, set) __WS_FD_SET((fd),(set), WS(fd_set))
455 #define FD_ZERO(set) (((WS(fd_set)*)(set))->fd_count=0)
456 #define FD_ISSET(fd, set) __WSAFDIsSet((SOCKET)(fd), (WS(fd_set)*)(set))
458 #define WS_FD_CLR(fd, set) WINE_FD_CLR((fd),(set), WS(fd_set))
459 #define WS_FD_SET(fd, set) WINE_FD_SET((fd),(set), WS(fd_set))
460 #define WS_FD_ZERO(set) (((WS(fd_set)*)(set))->fd_count=0)
461 #define WS_FD_ISSET(fd, set) __WSAFDIsSet((SOCKET)(fd), (WS(fd_set)*)(set))
463 #endif /* WS_DEFINE_SELECT */
467 * Internet address (old style... should be updated)
470 #ifndef USE_WS_PREFIX
471 #define IN_CLASSA_NSHIFT 24
472 #define IN_CLASSA_MAX 128
473 #define IN_CLASSA_NET 0xff000000
474 #define IN_CLASSA_HOST 0x00ffffff
475 #define IN_CLASSA(i) (((long)(i) & 0x80000000) == 0)
476 #define IN_CLASSB_NSHIFT 16
477 #define IN_CLASSB_MAX 65536
478 #define IN_CLASSB_NET 0xffff0000
479 #define IN_CLASSB_HOST 0x0000ffff
480 #define IN_CLASSB(i) (((long)(i) & 0xc0000000) == 0x80000000)
481 #define IN_CLASSC_NSHIFT 8
482 #define IN_CLASSC_NET 0xffffff00
483 #define IN_CLASSC_HOST 0x000000ff
484 #define IN_CLASSC(i) (((long)(i) & 0xe0000000) == 0xc0000000)
486 #define WS_IN_CLASSA_NSHIFT 24
487 #define WS_IN_CLASSA_MAX 128
488 #define WS_IN_CLASSA_NET 0xff000000
489 #define WS_IN_CLASSA_HOST 0x00ffffff
490 #define WS_IN_CLASSA(i) (((long)(i) & 0x80000000) == 0)
491 #define WS_IN_CLASSB_NSHIFT 16
492 #define WS_IN_CLASSB_MAX 65536
493 #define WS_IN_CLASSB_NET 0xffff0000
494 #define WS_IN_CLASSB_HOST 0x0000ffff
495 #define WS_IN_CLASSB(i) (((long)(i) & 0xc0000000) == 0x80000000)
496 #define WS_IN_CLASSC_NSHIFT 8
497 #define WS_IN_CLASSC_NET 0xffffff00
498 #define WS_IN_CLASSC_HOST 0x000000ff
499 #define WS_IN_CLASSC(i) (((long)(i) & 0xe0000000) == 0xc0000000)
500 #endif /* USE_WS_PREFIX */
502 #ifndef USE_WS_PREFIX
503 #define INADDR_ANY (u_long)0x00000000
504 #define INADDR_LOOPBACK 0x7f000001
505 #define INADDR_BROADCAST (u_long)0xffffffff
506 #define INADDR_NONE 0xffffffff
508 #define WS_INADDR_ANY (u_long)0x00000000
509 #define WS_INADDR_LOOPBACK 0x7f000001
510 #define WS_INADDR_BROADCAST (u_long)0xffffffff
511 #define WS_INADDR_NONE 0xffffffff
512 #endif /* USE_WS_PREFIX */
514 typedef struct WS(in_addr)
518 u_char s_b1,s_b2,s_b3,s_b4;
525 #ifndef USE_WS_PREFIX
526 #define s_addr S_un.S_addr
527 #define s_host S_un.S_un_b.s_b2
528 #define s_net S_un.S_un_b.s_b1
529 #define s_imp S_un.S_un_w.s_w2
530 #define s_impno S_un.S_un_b.s_b4
531 #define s_lh S_un.S_un_b.s_b3
533 #define WS_s_addr S_un.S_addr
534 #define WS_s_host S_un.S_un_b.s_b2
535 #define WS_s_net S_un.S_un_b.s_b1
536 #define WS_s_imp S_un.S_un_w.s_w2
537 #define WS_s_impno S_un.S_un_b.s_b4
538 #define WS_s_lh S_un.S_un_b.s_b3
539 #endif /* USE_WS_PREFIX */
540 } IN_ADDR, *PIN_ADDR, *LPIN_ADDR;
542 typedef struct WS(sockaddr_in)
546 struct WS(in_addr) sin_addr;
548 } SOCKADDR_IN, *PSOCKADDR_IN, *LPSOCKADDR_IN;
554 #define WSADESCRIPTION_LEN 256
555 #define WSASYS_STATUS_LEN 128
557 typedef struct WS(WSAData)
561 char szDescription[WSADESCRIPTION_LEN+1];
562 char szSystemStatus[WSASYS_STATUS_LEN+1];
566 } WSADATA, *LPWSADATA;
573 #ifndef USE_WS_PREFIX
574 #define SOL_SOCKET 0xffff
575 #define SO_DEBUG 0x0001
576 #define SO_ACCEPTCONN 0x0002
577 #define SO_REUSEADDR 0x0004
578 #define SO_KEEPALIVE 0x0008
579 #define SO_DONTROUTE 0x0010
580 #define SO_BROADCAST 0x0020
581 #define SO_USELOOPBACK 0x0040
582 #define SO_LINGER 0x0080
583 #define SO_OOBINLINE 0x0100
584 #define SO_DONTLINGER (u_int)(~SO_LINGER)
585 #define SO_SNDBUF 0x1001
586 #define SO_RCVBUF 0x1002
587 #define SO_SNDLOWAT 0x1003
588 #define SO_RCVLOWAT 0x1004
589 #define SO_SNDTIMEO 0x1005
590 #define SO_RCVTIMEO 0x1006
591 #define SO_ERROR 0x1007
592 #define SO_TYPE 0x1008
594 #define IOCPARM_MASK 0x7f
595 #define IOC_VOID 0x20000000
596 #define IOC_OUT 0x40000000
597 #define IOC_IN 0x80000000
598 #define IOC_INOUT (IOC_IN|IOC_OUT)
600 #define _IO(x,y) (IOC_VOID|((x)<<8)|(y))
601 #define _IOR(x,y,t) (IOC_OUT|(((UINT)sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|(y))
602 #define _IOW(x,y,t) (IOC_IN|(((UINT)sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|(y))
606 #define WS_SOL_SOCKET 0xffff
607 #define WS_SO_DEBUG 0x0001
608 #define WS_SO_ACCEPTCONN 0x0002
609 #define WS_SO_REUSEADDR 0x0004
610 #define WS_SO_KEEPALIVE 0x0008
611 #define WS_SO_DONTROUTE 0x0010
612 #define WS_SO_BROADCAST 0x0020
613 #define WS_SO_USELOOPBACK 0x0040
614 #define WS_SO_LINGER 0x0080
615 #define WS_SO_OOBINLINE 0x0100
616 #define WS_SO_DONTLINGER (u_int)(~WS_SO_LINGER)
617 #define WS_SO_SNDBUF 0x1001
618 #define WS_SO_RCVBUF 0x1002
619 #define WS_SO_SNDLOWAT 0x1003
620 #define WS_SO_RCVLOWAT 0x1004
621 #define WS_SO_SNDTIMEO 0x1005
622 #define WS_SO_RCVTIMEO 0x1006
623 #define WS_SO_ERROR 0x1007
624 #define WS_SO_TYPE 0x1008
626 #define WS_IOCPARM_MASK 0x7f
627 #define WS_IOC_VOID 0x20000000
628 #define WS_IOC_OUT 0x40000000
629 #define WS_IOC_IN 0x80000000
630 #define WS_IOC_INOUT (WS_IOC_IN|WS_IOC_OUT)
632 #define WS__IO(x,y) (WS_IOC_VOID|((x)<<8)|(y))
633 #define WS__IOR(x,y,t) (WS_IOC_OUT|(((long)sizeof(t)&WS_IOCPARM_MASK)<<16)|((x)<<8)|(y))
634 #define WS__IOW(x,y,t) (WS_IOC_IN|(((long)sizeof(t)&WS_IOCPARM_MASK)<<16)|((x)<<8)|(y))
638 /* IPPROTO_TCP options */
639 #ifndef USE_WS_PREFIX
640 #define TCP_NODELAY 1
642 #define WS_TCP_NODELAY 1
646 * Socket I/O flags (supported by spec 1.1)
648 #ifndef USE_WS_PREFIX
649 #define FIONREAD _IOR('f', 127, u_long)
650 #define FIONBIO _IOW('f', 126, u_long)
651 #define SIOCATMARK _IOR('s', 7, u_long)
653 #define WS_FIONREAD WS__IOR('f', 127, u_long)
654 #define WS_FIONBIO WS__IOW('f', 126, u_long)
655 #define WS_SIOCATMARK WS__IOR('s', 7, u_long)
659 * Maximum queue length specifiable by listen.
661 #ifndef USE_WS_PREFIX
664 #define MSG_OOB 0x0001
665 #define MSG_PEEK 0x0002
666 #define MSG_DONTROUTE 0x0004
667 #define MSG_MAXIOVLEN 0x000a
668 #define MSG_PARTIAL 0x8000
669 #else /* USE_WS_PREFIX */
670 #define WS_SOMAXCONN 5
672 #define WS_MSG_OOB 0x0001
673 #define WS_MSG_PEEK 0x0002
674 #define WS_MSG_DONTROUTE 0x0004
675 #define WS_MSG_MAXIOVLEN 0x000a
676 #define WS_MSG_PARTIAL 0x8000
677 #endif /* USE_WS_PREFIX */
680 * Define constant based on rfc883, used by gethostbyxxxx() calls.
682 #ifndef USE_WS_PREFIX
683 #define MAXGETHOSTSTRUCT 1024
685 #define MAXGETHOSTSTRUCT 1024
690 * Define flags to be used with the WSAAsyncSelect() call.
692 #define FD_READ 0x00000001
693 #define FD_WRITE 0x00000002
694 #define FD_OOB 0x00000004
695 #define FD_ACCEPT 0x00000008
696 #define FD_CONNECT 0x00000010
697 #define FD_CLOSE 0x00000020
699 /* internal per-socket flags */
701 #define FD_WINE_LISTENING 0x10000000
702 #define FD_WINE_NONBLOCKING 0x20000000
703 #define FD_WINE_CONNECTED 0x40000000
704 #define FD_WINE_RAW 0x80000000
705 #define FD_WINE_SERVEVENT 0x01000000
706 #define FD_WINE_INTERNAL 0xFFFF0000
710 * All Windows Sockets error constants are biased by WSABASEERR from
713 #define WSABASEERR 10000
715 * Windows Sockets definitions of regular Microsoft C error constants
717 #define WSAEINTR (WSABASEERR+4)
718 #define WSAEBADF (WSABASEERR+9)
719 #define WSAEACCES (WSABASEERR+13)
720 #define WSAEFAULT (WSABASEERR+14)
721 #define WSAEINVAL (WSABASEERR+22)
722 #define WSAEMFILE (WSABASEERR+24)
725 * Windows Sockets definitions of regular Berkeley error constants
727 #define WSAEWOULDBLOCK (WSABASEERR+35)
728 #define WSAEINPROGRESS (WSABASEERR+36)
729 #define WSAEALREADY (WSABASEERR+37)
730 #define WSAENOTSOCK (WSABASEERR+38)
731 #define WSAEDESTADDRREQ (WSABASEERR+39)
732 #define WSAEMSGSIZE (WSABASEERR+40)
733 #define WSAEPROTOTYPE (WSABASEERR+41)
734 #define WSAENOPROTOOPT (WSABASEERR+42)
735 #define WSAEPROTONOSUPPORT (WSABASEERR+43)
736 #define WSAESOCKTNOSUPPORT (WSABASEERR+44)
737 #define WSAEOPNOTSUPP (WSABASEERR+45)
738 #define WSAEPFNOSUPPORT (WSABASEERR+46)
739 #define WSAEAFNOSUPPORT (WSABASEERR+47)
740 #define WSAEADDRINUSE (WSABASEERR+48)
741 #define WSAEADDRNOTAVAIL (WSABASEERR+49)
742 #define WSAENETDOWN (WSABASEERR+50)
743 #define WSAENETUNREACH (WSABASEERR+51)
744 #define WSAENETRESET (WSABASEERR+52)
745 #define WSAECONNABORTED (WSABASEERR+53)
746 #define WSAECONNRESET (WSABASEERR+54)
747 #define WSAENOBUFS (WSABASEERR+55)
748 #define WSAEISCONN (WSABASEERR+56)
749 #define WSAENOTCONN (WSABASEERR+57)
750 #define WSAESHUTDOWN (WSABASEERR+58)
751 #define WSAETOOMANYREFS (WSABASEERR+59)
752 #define WSAETIMEDOUT (WSABASEERR+60)
753 #define WSAECONNREFUSED (WSABASEERR+61)
754 #define WSAELOOP (WSABASEERR+62)
755 #define WSAENAMETOOLONG (WSABASEERR+63)
756 #define WSAEHOSTDOWN (WSABASEERR+64)
757 #define WSAEHOSTUNREACH (WSABASEERR+65)
758 #define WSAENOTEMPTY (WSABASEERR+66)
759 #define WSAEPROCLIM (WSABASEERR+67)
760 #define WSAEUSERS (WSABASEERR+68)
761 #define WSAEDQUOT (WSABASEERR+69)
762 #define WSAESTALE (WSABASEERR+70)
763 #define WSAEREMOTE (WSABASEERR+71)
766 * Extended Windows Sockets error constant definitions
768 #define WSASYSNOTREADY (WSABASEERR+91)
769 #define WSAVERNOTSUPPORTED (WSABASEERR+92)
770 #define WSANOTINITIALISED (WSABASEERR+93)
773 * Error return codes from gethostbyname() and gethostbyaddr()
774 * (when using the resolver). Note that these errors are
775 * retrieved via WSAGetLastError() and must therefore follow
776 * the rules for avoiding clashes with error numbers from
777 * specific implementations or language run-time systems.
778 * For this reason the codes are based at WSABASEERR+1001.
779 * Note also that [WSA]NO_ADDRESS is defined only for
780 * compatibility purposes.
783 #ifndef USE_WS_PREFIX
784 #define h_errno WSAGetLastError()
786 #define WS_h_errno WSAGetLastError()
789 /* Authoritative Answer: Host not found */
790 #define WSAHOST_NOT_FOUND (WSABASEERR+1001)
792 /* Non-Authoritative: Host not found, or SERVERFAIL */
793 #define WSATRY_AGAIN (WSABASEERR+1002)
795 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
796 #define WSANO_RECOVERY (WSABASEERR+1003)
798 /* Valid name, no data record of requested type */
799 #define WSANO_DATA (WSABASEERR+1004)
801 /* no address, look for MX record */
802 #define WSANO_ADDRESS WSANO_DATA
804 #ifndef USE_WS_PREFIX
805 #define HOST_NOT_FOUND WSAHOST_NOT_FOUND
806 #define TRY_AGAIN WSATRY_AGAIN
807 #define NO_RECOVERY WSANO_RECOVERY
808 #define NO_DATA WSANO_DATA
809 #define NO_ADDRESS WSANO_ADDRESS
810 #endif /* USE_WS_PREFIX */
815 * Windows message parameter composition and decomposition
820 * WSAMAKEASYNCREPLY is intended for use by the Windows Sockets implementation
821 * when constructing the response to a WSAAsyncGetXByY() routine.
823 #define WSAMAKEASYNCREPLY(buflen,error) MAKELONG(buflen,error)
825 * WSAMAKESELECTREPLY is intended for use by the Windows Sockets implementation
826 * when constructing the response to WSAAsyncSelect().
828 #define WSAMAKESELECTREPLY(event,error) MAKELONG(event,error)
830 * WSAGETASYNCBUFLEN is intended for use by the Windows Sockets application
831 * to extract the buffer length from the lParam in the response
834 #define WSAGETASYNCBUFLEN(lParam) LOWORD(lParam)
836 * WSAGETASYNCERROR is intended for use by the Windows Sockets application
837 * to extract the error code from the lParam in the response
840 #define WSAGETASYNCERROR(lParam) HIWORD(lParam)
842 * WSAGETSELECTEVENT is intended for use by the Windows Sockets application
843 * to extract the event code from the lParam in the response
844 * to a WSAAsyncSelect().
846 #define WSAGETSELECTEVENT(lParam) LOWORD(lParam)
848 * WSAGETSELECTERROR is intended for use by the Windows Sockets application
849 * to extract the error code from the lParam in the response
850 * to a WSAAsyncSelect().
852 #define WSAGETSELECTERROR(lParam) HIWORD(lParam)
859 * Remember to keep this section in sync with the
860 * "Winsock Function Typedefs" section in winsock2.h.
862 #if !defined(__WINE_WINSOCK2__) || WS_API_PROTOTYPES
863 HANDLE WINAPI WSAAsyncGetHostByAddr(HWND,u_int,const char*,int,int,char*,int);
864 HANDLE WINAPI WSAAsyncGetHostByName(HWND,u_int,const char*,char*,int);
865 HANDLE WINAPI WSAAsyncGetProtoByName(HWND,u_int,const char*,char*,int);
866 HANDLE WINAPI WSAAsyncGetProtoByNumber(HWND,u_int,int,char*,int);
867 HANDLE WINAPI WSAAsyncGetServByName(HWND,u_int,const char*,const char*,char*,int);
868 HANDLE WINAPI WSAAsyncGetServByPort(HWND,u_int,int,const char*,char*,int);
869 int WINAPI WSAAsyncSelect(SOCKET,HWND,u_int,long);
870 int WINAPI WSACancelAsyncRequest(HANDLE);
871 int WINAPI WSACancelBlockingCall(void);
872 int WINAPI WSACleanup(void);
873 int WINAPI WSAGetLastError(void);
874 BOOL WINAPI WSAIsBlocking(void);
875 FARPROC WINAPI WSASetBlockingHook(FARPROC);
876 void WINAPI WSASetLastError(int);
877 int WINAPI WSAStartup(WORD,LPWSADATA);
878 int WINAPI WSAUnhookBlockingHook(void);
880 SOCKET WINAPI WS(accept)(SOCKET,struct WS(sockaddr)*,int*);
881 int WINAPI WS(bind)(SOCKET,const struct WS(sockaddr)*,int);
882 int WINAPI WS(closesocket)(SOCKET);
883 int WINAPI WS(connect)(SOCKET,const struct WS(sockaddr)*,int);
884 struct WS(hostent)* WINAPI WS(gethostbyaddr)(const char*,int,int);
885 struct WS(hostent)* WINAPI WS(gethostbyname)(const char*);
886 int WINAPI WS(gethostname)(char*,int);
887 int WINAPI WS(getpeername)(SOCKET,struct WS(sockaddr)*,int*);
888 struct WS(protoent)* WINAPI WS(getprotobyname)(const char*);
889 struct WS(protoent)* WINAPI WS(getprotobynumber)(int);
890 #ifdef WS_DEFINE_SELECT
891 int WS(select)(int,WS(fd_set)*,WS(fd_set)*,WS(fd_set)*,const struct WS(timeval)*);
893 struct WS(servent)* WINAPI WS(getservbyname)(const char*,const char*);
894 struct WS(servent)* WINAPI WS(getservbyport)(int,const char*);
895 int WINAPI WS(getsockname)(SOCKET,struct WS(sockaddr)*,int*);
896 int WINAPI WS(getsockopt)(SOCKET,int,int,char*,int*);
897 u_long WINAPI WS(htonl)(u_long);
898 u_short WINAPI WS(htons)(u_short);
899 unsigned long WINAPI WS(inet_addr)(const char*);
900 char* WINAPI WS(inet_ntoa)(struct WS(in_addr));
901 int WINAPI WS(ioctlsocket)(SOCKET,long,u_long*);
902 int WINAPI WS(listen)(SOCKET,int);
903 u_long WINAPI WS(ntohl)(u_long);
904 u_short WINAPI WS(ntohs)(u_short);
905 int WINAPI WS(recv)(SOCKET,char*,int,int);
906 int WINAPI WS(recvfrom)(SOCKET,char*,int,int,struct WS(sockaddr)*,int*);
907 int WINAPI WS(send)(SOCKET,const char*,int,int);
908 int WINAPI WS(sendto)(SOCKET,const char*,int,int,const struct WS(sockaddr)*,int);
909 int WINAPI WS(setsockopt)(SOCKET,int,int,const char*,int);
910 int WINAPI WS(shutdown)(SOCKET,int);
911 SOCKET WINAPI WS(socket)(int,int,int);
914 #if defined(__WINE__) || !defined(__WINE_WINSOCK2__)
915 /* Stuff specific to winsock.h */
917 int WINAPI WSARecvEx(SOCKET,char*,int,int*);
919 #endif /* __WINE_WINSOCK2__ */
920 #endif /* !defined(__WINE_WINSOCK2__) || WS_API_PROTOTYPES */
929 #ifndef __WINE_WINSOCK2__
931 #undef WS_API_PROTOTYPES
932 #undef WS_API_TYPEDEFS
935 #endif /* _WINSOCKAPI_ */