18#if defined(__LP64__) || (!defined(_M_AMD64) && defined(__WINESRC__))
19#if !defined(__ROS_LONG64__)
24#define _GNU_H_WINDOWS32_SOCKETS
30#if !defined ( _BSDTYPES_DEFINED )
40typedef unsigned int u_long;
43#define _BSDTYPES_DEFINED
54#define SD_RECEIVE 0x00
58#ifndef _SYS_TYPES_FD_SET
74#define FD_CLR(fd,set) do { u_int __i;\
75for (__i = 0; __i < ((fd_set FAR*)(set))->fd_count ; __i++) {\
76 if (((fd_set FAR*)(set))->fd_array[__i] == (fd)) {\
77 while (__i < ((fd_set FAR*)(set))->fd_count-1) {\
78 ((fd_set FAR*)(set))->fd_array[__i] = ((fd_set FAR*)(set))->fd_array[__i+1];\
81 ((fd_set FAR*)(set))->fd_count--;\
89#define FD_SET(fd, set) do { \
90 if (((fd_set FAR*)(set))->fd_count < FD_SETSIZE) \
91 ((fd_set FAR*)(set))->fd_array[((fd_set FAR*)(set))->fd_count++]=(fd);\
96#define FD_ZERO(set) (((fd_set FAR*)(set))->fd_count=0)
100#define FD_ISSET(fd, set) __WSAFDIsSet((SOCKET)(fd), (fd_set FAR*)(set))
105#elif !defined(USE_SYS_TYPES_FD_SET)
106#warning "fd_set and associated macros have been defined in sys/types. \
107 This can cause runtime problems with W32 sockets"
110#if !(defined (__INSIDE_CYGWIN__) || defined (__INSIDE_MSYS__))
112#ifndef _TIMEVAL_DEFINED
113#define _TIMEVAL_DEFINED
120#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
122#define timercmp(tvp, uvp, cmp) \
123 (((tvp)->tv_sec != (uvp)->tv_sec) ? \
124 ((tvp)->tv_sec cmp (uvp)->tv_sec) : \
125 ((tvp)->tv_usec cmp (uvp)->tv_usec))
127#define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0
131#define h_addr h_addr_list[0]
146#define _IO(x,y) (IOC_VOID|((x)<<8)|(y))
147#define _IOR(x,y,t) (IOC_OUT|(((LONG)sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|(y))
148#define _IOW(x,y,t) (IOC_IN|(((LONG)sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|(y))
149#define FIONBIO _IOW('f', 126, u_long)
179#define SO_ACCEPTCONN 2
180#define SO_REUSEADDR 4
181#define SO_KEEPALIVE 8
182#define SO_DONTROUTE 16
183#define SO_BROADCAST 32
184#define SO_USELOOPBACK 64
186#define SO_OOBINLINE 256
187#define SO_DONTLINGER (u_int)(~SO_LINGER)
188#define SO_SNDBUF 0x1001
189#define SO_RCVBUF 0x1002
190#define SO_SNDLOWAT 0x1003
191#define SO_RCVLOWAT 0x1004
192#define SO_SNDTIMEO 0x1005
193#define SO_RCVTIMEO 0x1006
194#define SO_ERROR 0x1007
195#define SO_TYPE 0x1008
197#define SO_CONNDATA 0x7000
198#define SO_CONNOPT 0x7001
199#define SO_DISCDATA 0x7002
200#define SO_DISCOPT 0x7003
201#define SO_CONNDATALEN 0x7004
202#define SO_CONNOPTLEN 0x7005
203#define SO_DISCDATALEN 0x7006
204#define SO_DISCOPTLEN 0x7007
205#define SO_OPENTYPE 0x7008
206#define SO_MAXDG 0x7009
207#define SO_MAXPATHDG 0x700A
208#define SO_UPDATE_ACCEPT_CONTEXT 0x700B
209#define SO_CONNECT_TIME 0x700C
211#define SO_SYNCHRONOUS_ALERT 0x10
212#define SO_SYNCHRONOUS_NONALERT 0x20
223#define MSG_DONTROUTE 4
225#define h_errno WSAGetLastError()
226#define HOST_NOT_FOUND WSAHOST_NOT_FOUND
227#define TRY_AGAIN WSATRY_AGAIN
228#define NO_RECOVERY WSANO_RECOVERY
229#define NO_DATA WSANO_DATA
230#define NO_ADDRES WSANO_ADDRESS
241#define IOCPARM_MASK 0x7f
242#define IOC_VOID 0x20000000
243#define IOC_OUT 0x40000000
244#define IOC_IN 0x80000000
245#define IOC_INOUT (IOC_IN|IOC_OUT)
247#define FIONREAD _IOR('f', 127, u_long)
248#define FIOASYNC _IOW('f', 125, u_long)
249#define SIOCSHIWAT _IOW('s', 0, u_long)
250#define SIOCGHIWAT _IOR('s', 1, u_long)
251#define SIOCSLOWAT _IOW('s', 2, u_long)
252#define SIOCGLOWAT _IOR('s', 3, u_long)
253#define SIOCATMARK _IOR('s', 7, u_long)
256#define IPPROTO_ICMP 1
257#define IPPROTO_IGMP 2
260#define IPPROTO_PUP 12
261#define IPPROTO_UDP 17
262#define IPPROTO_IDP 22
264#define IPPROTO_RAW 255
265#define IPPROTO_MAX 256
267#define IPPORT_DISCARD 9
268#define IPPORT_SYSTAT 11
269#define IPPORT_DAYTIME 13
270#define IPPORT_NETSTAT 15
272#define IPPORT_TELNET 23
273#define IPPORT_SMTP 25
274#define IPPORT_TIMESERVER 37
275#define IPPORT_NAMESERVER 42
276#define IPPORT_WHOIS 43
278#define IPPORT_TFTP 69
280#define IPPORT_FINGER 79
281#define IPPORT_TTYLINK 87
282#define IPPORT_SUPDUP 95
283#define IPPORT_EXECSERVER 512
284#define IPPORT_LOGINSERVER 513
285#define IPPORT_CMDSERVER 514
286#define IPPORT_EFSSERVER 520
287#define IPPORT_BIFFUDP 512
288#define IPPORT_WHOSERVER 513
289#define IPPORT_ROUTESERVER 520
290#define IPPORT_RESERVED 1024
291#define IMPLINK_IP 155
292#define IMPLINK_LOWEXPER 156
293#define IMPLINK_HIGHEXPER 158
297#define IN_CLASSA(i) ((LONG)(i)&0x80000000)
298#define IN_CLASSA_NET 0xff000000
299#define IN_CLASSA_NSHIFT 24
300#define IN_CLASSA_HOST 0x00ffffff
301#define IN_CLASSA_MAX 128
302#define IN_CLASSB(i) (((LONG)(i)&0xc0000000)==0x80000000)
303#define IN_CLASSB_NET 0xffff0000
304#define IN_CLASSB_NSHIFT 16
305#define IN_CLASSB_HOST 0x0000ffff
306#define IN_CLASSB_MAX 65536
307#define IN_CLASSC(i) (((LONG)(i)&0xe0000000)==0xc0000000)
308#define IN_CLASSC_NET 0xffffff00
309#define IN_CLASSC_NSHIFT 8
310#define IN_CLASSC_HOST 0xff
311#define INADDR_ANY (u_long)0
312#define INADDR_LOOPBACK 0x7f000001
313#define INADDR_BROADCAST (u_long)0xffffffff
314#define INADDR_NONE 0xffffffff
316#define WSADESCRIPTION_LEN 256
317#define WSASYS_STATUS_LEN 128
319#define IP_MULTICAST_IF 2
320#define IP_MULTICAST_TTL 3
321#define IP_MULTICAST_LOOP 4
322#define IP_ADD_MEMBERSHIP 5
323#define IP_DROP_MEMBERSHIP 6
326#define IP_DONTFRAGMENT 9
328#define IP_DEFAULT_MULTICAST_TTL 1
329#define IP_DEFAULT_MULTICAST_LOOP 1
330#define IP_MAX_MEMBERSHIPS 20
332#define INVALID_SOCKET (SOCKET)(~0)
333#define SOCKET_ERROR (-1)
339#define SOCK_SEQPACKET 5
341#define TCP_NODELAY 0x0001
342#define TCP_BSDURGENT 0x7000
362#define AF_APPLETALK 16
364#define AF_VOICEVIEW 18
366#define AF_UNKNOWN1 20
371#define PF_UNSPEC AF_UNSPEC
372#define PF_UNIX AF_UNIX
373#define PF_INET AF_INET
374#define PF_IMPLINK AF_IMPLINK
376#define PF_CHAOS AF_CHAOS
381#define PF_ECMA AF_ECMA
382#define PF_DATAKIT AF_DATAKIT
383#define PF_CCITT AF_CCITT
385#define PF_DECnet AF_DECnet
388#define PF_HYLINK AF_HYLINK
389#define PF_APPLETALK AF_APPLETALK
390#define PF_VOICEVIEW AF_VOICEVIEW
391#define PF_FIREFOX AF_FIREFOX
392#define PF_UNKNOWN1 AF_UNKNOWN1
395#define PF_INET6 AF_INET6
398#define SOL_SOCKET 0xffff
401#define MSG_MAXIOVLEN 16
402#define MSG_PARTIAL 0x8000
403#define MAXGETHOSTSTRUCT 1024
414#define WSABASEERR 10000
415#define WSAEINTR (WSABASEERR+4)
416#define WSAEBADF (WSABASEERR+9)
417#define WSAEACCES (WSABASEERR+13)
418#define WSAEFAULT (WSABASEERR+14)
419#define WSAEINVAL (WSABASEERR+22)
420#define WSAEMFILE (WSABASEERR+24)
421#define WSAEWOULDBLOCK (WSABASEERR+35)
422#define WSAEINPROGRESS (WSABASEERR+36)
423#define WSAEALREADY (WSABASEERR+37)
424#define WSAENOTSOCK (WSABASEERR+38)
425#define WSAEDESTADDRREQ (WSABASEERR+39)
426#define WSAEMSGSIZE (WSABASEERR+40)
427#define WSAEPROTOTYPE (WSABASEERR+41)
428#define WSAENOPROTOOPT (WSABASEERR+42)
429#define WSAEPROTONOSUPPORT (WSABASEERR+43)
430#define WSAESOCKTNOSUPPORT (WSABASEERR+44)
431#define WSAEOPNOTSUPP (WSABASEERR+45)
432#define WSAEPFNOSUPPORT (WSABASEERR+46)
433#define WSAEAFNOSUPPORT (WSABASEERR+47)
434#define WSAEADDRINUSE (WSABASEERR+48)
435#define WSAEADDRNOTAVAIL (WSABASEERR+49)
436#define WSAENETDOWN (WSABASEERR+50)
437#define WSAENETUNREACH (WSABASEERR+51)
438#define WSAENETRESET (WSABASEERR+52)
439#define WSAECONNABORTED (WSABASEERR+53)
440#define WSAECONNRESET (WSABASEERR+54)
441#define WSAENOBUFS (WSABASEERR+55)
442#define WSAEISCONN (WSABASEERR+56)
443#define WSAENOTCONN (WSABASEERR+57)
444#define WSAESHUTDOWN (WSABASEERR+58)
445#define WSAETOOMANYREFS (WSABASEERR+59)
446#define WSAETIMEDOUT (WSABASEERR+60)
447#define WSAECONNREFUSED (WSABASEERR+61)
448#define WSAELOOP (WSABASEERR+62)
449#define WSAENAMETOOLONG (WSABASEERR+63)
450#define WSAEHOSTDOWN (WSABASEERR+64)
451#define WSAEHOSTUNREACH (WSABASEERR+65)
452#define WSAENOTEMPTY (WSABASEERR+66)
453#define WSAEPROCLIM (WSABASEERR+67)
454#define WSAEUSERS (WSABASEERR+68)
455#define WSAEDQUOT (WSABASEERR+69)
456#define WSAESTALE (WSABASEERR+70)
457#define WSAEREMOTE (WSABASEERR+71)
458#define WSASYSNOTREADY (WSABASEERR+91)
459#define WSAVERNOTSUPPORTED (WSABASEERR+92)
460#define WSANOTINITIALISED (WSABASEERR+93)
461#define WSAEDISCON (WSABASEERR+101)
462#define WSAHOST_NOT_FOUND (WSABASEERR+1001)
463#define WSATRY_AGAIN (WSABASEERR+1002)
464#define WSANO_RECOVERY (WSABASEERR+1003)
465#define WSANO_DATA (WSABASEERR+1004)
466#define WSA_SECURE_HOST_NOT_FOUND (WSABASEERR+1032)
467#define WSA_IPSEC_NAME_POLICY_ERROR (WSABASEERR+1033)
471#define WSANO_ADDRESS WSANO_DATA
473#define TF_DISCONNECT 0x01
474#define TF_REUSE_SOCKET 0x02
475#define TF_WRITE_BEHIND 0x04
477#define WSAMAKEASYNCREPLY(b,e) MAKELONG(b,e)
478#define WSAMAKESELECTREPLY(e,error) MAKELONG(e,error)
479#define WSAGETASYNCBUFLEN(l) LOWORD(l)
480#define WSAGETASYNCERROR(l) HIWORD(l)
481#define WSAGETSELECTEVENT(l) LOWORD(l)
482#define WSAGETSELECTERROR(l) HIWORD(l)
900#if(_WIN32_WINNT >= 0x0501)
903#error WINSOCK2 required.
GLuint GLuint GLsizei GLenum type
GLenum GLuint GLenum GLsizei const GLchar * buf
GLenum const GLvoid * addr
static unsigned int number
#define _Outptr_result_bytebuffer_(size)
#define _In_reads_bytes_(size)
#define _Out_writes_bytes_(size)
#define _Out_writes_bytes_to_(size, count)
#define _Out_writes_bytes_to_opt_(size, count)
#define _In_reads_bytes_opt_(size)
#define _Out_writes_bytes_opt_(size)
unsigned __int3264 UINT_PTR
_In_ DWORD _In_ DWORD _In_ DWORD _Outptr_result_bytebuffer_ LocalSockaddrLength struct sockaddr ** LocalSockaddr
_In_ SOCKET sAcceptSocket
_In_ DWORD _In_ DWORD _In_ DWORD _Outptr_result_bytebuffer_ LocalSockaddrLength struct sockaddr _Out_ LPINT LocalSockaddrLength
_In_ HANDLE _In_ DWORD _In_ DWORD nNumberOfBytesPerSend
_In_ DWORD _In_ DWORD _In_ DWORD _Outptr_result_bytebuffer_ LocalSockaddrLength struct sockaddr _Out_ LPINT _Outptr_result_bytebuffer_ RemoteSockaddrLength struct sockaddr ** RemoteSockaddr
_In_ HANDLE _In_ DWORD nNumberOfBytesToWrite
_In_ SOCKET _In_ DWORD _In_ DWORD _In_ DWORD _Out_ LPDWORD lpdwBytesReceived
_In_ SOCKET _In_ DWORD dwReceiveDataLength
_In_ DWORD _In_ DWORD _In_ DWORD _Outptr_result_bytebuffer_ LocalSockaddrLength struct sockaddr _Out_ LPINT _Outptr_result_bytebuffer_ RemoteSockaddrLength struct sockaddr _Out_ LPINT RemoteSockaddrLength
_In_ SOCKET _In_ DWORD _In_ DWORD _In_ DWORD dwRemoteAddressLength
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS lpTransmitBuffers
_In_ SOCKET _In_ DWORD _In_ DWORD dwLocalAddressLength
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED lpOverlapped
#define __out_data_source(src_sym)
char szDescription[WSADESCRIPTION_LEN+1]
char szSystemStatus[WSASYS_STATUS_LEN+1]
unsigned short iMaxSockets
SOCKET fd_array[FD_SETSIZE]
struct in_addr imr_interface
struct in_addr imr_multiaddr
#define WSASYS_STATUS_LEN
#define WSADESCRIPTION_LEN
int PASCAL FAR send(_In_ SOCKET s, _In_reads_bytes_(len) const char FAR *buf, _In_ int len, _In_ int flags)
struct _TRANSMIT_FILE_BUFFERS * LPTRANSMIT_FILE_BUFFERS
int PASCAL FAR getsockopt(_In_ SOCKET s, _In_ int level, _In_ int optname, _Out_writes_bytes_(*optlen) char FAR *optval, _Inout_ int FAR *optlen)
void PASCAL FAR WSASetLastError(_In_ int iError)
int PASCAL FAR WSACancelAsyncRequest(_In_ HANDLE hAsyncTaskHandle)
struct sockaddr_in * LPSOCKADDR_IN
int PASCAL FAR WSAGetLastError(void)
BOOL PASCAL FAR WSAIsBlocking(void)
int PASCAL FAR WSACleanup(void)
VOID PASCAL FAR GetAcceptExSockaddrs(_In_reads_bytes_(dwReceiveDataLength+dwLocalAddressLength+dwRemoteAddressLength) PVOID lpOutputBuffer, _In_ DWORD dwReceiveDataLength, _In_ DWORD dwLocalAddressLength, _In_ DWORD dwRemoteAddressLength, _Outptr_result_bytebuffer_(*LocalSockaddrLength) struct sockaddr **LocalSockaddr, _Out_ LPINT LocalSockaddrLength, _Outptr_result_bytebuffer_(*RemoteSockaddrLength) struct sockaddr **RemoteSockaddr, _Out_ LPINT RemoteSockaddrLength)
struct hostent * LPHOSTENT
int PASCAL FAR shutdown(_In_ SOCKET s, _In_ int how)
struct hostent * PHOSTENT
struct servent * LPSERVENT
int PASCAL FAR setsockopt(_In_ SOCKET s, _In_ int level, _In_ int optname, _In_reads_bytes_opt_(optlen) const char FAR *optval, _In_ int optlen)
struct hostent FAR *PASCAL FAR gethostbyname(_In_z_ const char FAR *name)
int PASCAL FAR getpeername(_In_ SOCKET s, _Out_writes_bytes_to_(*namelen, *namelen) struct sockaddr FAR *name, _Inout_ int FAR *namelen)
int PASCAL FAR WSARecvEx(_In_ SOCKET s, _Out_writes_bytes_to_(len, return) __out_data_source(NETWORK) char FAR *buf, _In_ int len, _Inout_ int FAR *flags)
struct servent FAR *PASCAL FAR getservbyname(_In_z_ const char FAR *name, _In_z_ const char FAR *proto)
struct _TRANSMIT_FILE_BUFFERS * PTRANSMIT_FILE_BUFFERS
BOOL PASCAL FAR AcceptEx(_In_ SOCKET sListenSocket, _In_ SOCKET sAcceptSocket, _Out_writes_bytes_to_(dwReceiveDataLength+dwLocalAddressLength+dwRemoteAddressLength, *lpdwBytesReceived) PVOID lpOutputBuffer, _In_ DWORD dwReceiveDataLength, _In_ DWORD dwLocalAddressLength, _In_ DWORD dwRemoteAddressLength, _Out_ LPDWORD lpdwBytesReceived, _Inout_ LPOVERLAPPED lpOverlapped)
struct sockaddr_in * PSOCKADDR_IN
int PASCAL FAR WSACancelBlockingCall(void)
HANDLE PASCAL FAR WSAAsyncGetServByName(_In_ HWND hWnd, _In_ u_int wMsg, _In_z_ const char FAR *name, _In_z_ const char FAR *proto, _Out_writes_bytes_(buflen) char FAR *buf, _In_ int buflen)
HANDLE PASCAL FAR WSAAsyncGetProtoByName(_In_ HWND hWnd, _In_ u_int wMsg, _In_z_ const char FAR *name, _Out_writes_bytes_(buflen) char FAR *buf, _In_ int buflen)
struct sockaddr * PSOCKADDR
int PASCAL FAR bind(_In_ SOCKET s, _In_reads_bytes_(namelen) const struct sockaddr FAR *addr, _In_ int namelen)
struct servent FAR *PASCAL FAR getservbyport(_In_ int port, _In_z_ const char FAR *proto)
int PASCAL FAR sendto(_In_ SOCKET s, _In_reads_bytes_(len) const char FAR *buf, _In_ int len, _In_ int flags, _In_reads_bytes_opt_(tolen) const struct sockaddr FAR *to, _In_ int tolen)
FARPROC PASCAL FAR WSASetBlockingHook(_In_ FARPROC lpBlockFunc)
struct timeval * PTIMEVAL
int PASCAL FAR WSAAsyncSelect(_In_ SOCKET s, _In_ HWND hWnd, _In_ u_int wMsg, _In_ long lEvent)
struct WSAData * LPWSADATA
struct timeval * LPTIMEVAL
struct servent * PSERVENT
struct protoent FAR *PASCAL FAR getprotobyname(_In_z_ const char FAR *name)
int PASCAL FAR WSAStartup(_In_ WORD wVersionRequired, _Out_ LPWSADATA lpWSAData)
SOCKET PASCAL FAR accept(_In_ SOCKET s, _Out_writes_bytes_opt_(*addrlen) struct sockaddr FAR *addr, _Inout_opt_ int FAR *addrlen)
struct _TRANSMIT_FILE_BUFFERS TRANSMIT_FILE_BUFFERS
struct protoent * PPROTOENT
int PASCAL FAR recv(_In_ SOCKET s, _Out_writes_bytes_to_(len, return) __out_data_source(NETWORK) char FAR *buf, _In_ int len, _In_ int flags)
HANDLE PASCAL FAR WSAAsyncGetHostByAddr(_In_ HWND hWnd, _In_ u_int wMsg, _In_ const char FAR *addr, _In_ int len, _In_ int type, _Out_writes_bytes_(buflen) char FAR *buf, _In_ int buflen)
int PASCAL FAR recvfrom(_In_ SOCKET s, _Out_writes_bytes_to_(len, return) __out_data_source(NETWORK) char FAR *buf, _In_ int len, _In_ int flags, _Out_writes_bytes_to_opt_(*fromlen, *fromlen) struct sockaddr FAR *from, _Inout_opt_ int FAR *fromlen)
int PASCAL gethostname(char *, int)
struct hostent FAR *PASCAL FAR gethostbyaddr(_In_reads_bytes_(len) const char FAR *addr, _In_ int len, _In_ int type)
SOCKET PASCAL FAR socket(_In_ int af, _In_ int type, _In_ int protocol)
struct protoent * LPPROTOENT
struct sockaddr * LPSOCKADDR
int PASCAL select(int nfds, fd_set *, fd_set *, fd_set *, const struct timeval *)
int PASCAL __WSAFDIsSet(SOCKET, fd_set FAR *)
BOOL PASCAL FAR TransmitFile(_In_ SOCKET hSocket, _In_ HANDLE hFile, _In_ DWORD nNumberOfBytesToWrite, _In_ DWORD nNumberOfBytesPerSend, _Inout_opt_ LPOVERLAPPED lpOverlapped, _In_opt_ LPTRANSMIT_FILE_BUFFERS lpTransmitBuffers, _In_ DWORD dwReserved)
HANDLE PASCAL FAR WSAAsyncGetProtoByNumber(_In_ HWND hWnd, _In_ u_int wMsg, _In_ int number, _Out_writes_bytes_(buflen) char FAR *buf, _In_ int buflen)
HANDLE PASCAL FAR WSAAsyncGetHostByName(_In_ HWND hWnd, _In_ u_int wMsg, _In_z_ const char FAR *name, _Out_writes_bytes_(buflen) char FAR *buf, _In_ int buflen)
int PASCAL FAR listen(_In_ SOCKET s, _In_ int backlog)
int PASCAL FAR WSAUnhookBlockingHook(void)
HANDLE PASCAL FAR WSAAsyncGetServByPort(_In_ HWND hWnd, _In_ u_int wMsg, _In_ int port, _In_ const char FAR *proto, _Out_writes_bytes_(buflen) char FAR *buf, _In_ int buflen)
struct protoent FAR *PASCAL FAR getprotobynumber(_In_ int number)
int PASCAL FAR getsockname(_In_ SOCKET s, _Out_writes_bytes_to_(*namelen, *namelen) struct sockaddr FAR *name, _Inout_ int FAR *namelen)