xref: /PHP-8.0/ext/sockets/windows_common.h (revision 5d6e923d)
1 /*
2    +----------------------------------------------------------------------+
3    | Copyright (c) The PHP Group                                          |
4    +----------------------------------------------------------------------+
5    | This source file is subject to version 3.01 of the PHP license,      |
6    | that is bundled with this package in the file LICENSE, and is        |
7    | available through the world-wide-web at the following url:           |
8    | http://www.php.net/license/3_01.txt                                  |
9    | If you did not receive a copy of the PHP license and are unable to   |
10    | obtain it through the world-wide-web, please send a note to          |
11    | license@php.net so we can mail you a copy immediately.               |
12    +----------------------------------------------------------------------+
13  */
14 #ifndef WINDOWS_COMMON_H
15 #define WINDOWS_COMMON_H
16 
17 #include <Winsock2.h>
18 #define NTDDI_XP NTDDI_WINXP /* bug in SDK */
19 #include <IPHlpApi.h> /* conflicting definition of CMSG_DATA */
20 #undef NTDDI_XP
21 
22 #define HAVE_IF_NAMETOINDEX 1
23 
24 #define IS_INVALID_SOCKET(a)	(a->bsd_socket == INVALID_SOCKET)
25 
26 #ifdef errno
27 # undef errno
28 #endif
29 #define errno			WSAGetLastError()
30 #define h_errno			WSAGetLastError()
31 #define set_errno(a)	WSASetLastError(a)
32 #define close(a)		closesocket(a)
33 
34 #ifdef ENETUNREACH /* errno.h probably included */
35 # undef EWOULDBLOCK
36 # undef EINPROGRESS
37 # undef EALREADY
38 # undef ENOTSOCK
39 # undef EDESTADDRREQ
40 # undef EMSGSIZE
41 # undef EPROTOTYPE
42 # undef ENOPROTOOPT
43 # undef EPROTONOSUPPORT
44 # undef ESOCKTNOSUPPORT
45 # undef EOPNOTSUPP
46 # undef EPFNOSUPPORT
47 # undef EAFNOSUPPORT
48 # undef EADDRINUSE
49 # undef EADDRNOTAVAIL
50 # undef ENETDOWN
51 # undef ENETUNREACH
52 # undef ENETRESET
53 # undef ECONNABORTED
54 # undef ECONNRESET
55 # undef ENOBUFS
56 # undef EISCONN
57 # undef ENOTCONN
58 # undef ESHUTDOWN
59 # undef ETOOMANYREFS
60 # undef ETIMEDOUT
61 # undef ECONNREFUSED
62 # undef ELOOP
63 # undef ENAMETOOLONG
64 # undef EHOSTDOWN
65 # undef EHOSTUNREACH
66 # undef ENOTEMPTY
67 # undef EPROCLIM
68 # undef EUSERS
69 # undef EDQUOT
70 # undef ESTALE
71 # undef EREMOTE
72 
73 # undef EAGAIN
74 #endif
75 
76 /* section disabled in WinSock2.h */
77 #define EWOULDBLOCK             WSAEWOULDBLOCK
78 #define EINPROGRESS             WSAEINPROGRESS
79 #define EALREADY                WSAEALREADY
80 #define ENOTSOCK                WSAENOTSOCK
81 #define EDESTADDRREQ            WSAEDESTADDRREQ
82 #define EMSGSIZE                WSAEMSGSIZE
83 #define EPROTOTYPE              WSAEPROTOTYPE
84 #define ENOPROTOOPT             WSAENOPROTOOPT
85 #define EPROTONOSUPPORT         WSAEPROTONOSUPPORT
86 #define ESOCKTNOSUPPORT         WSAESOCKTNOSUPPORT
87 #define EOPNOTSUPP              WSAEOPNOTSUPP
88 #define EPFNOSUPPORT            WSAEPFNOSUPPORT
89 #define EAFNOSUPPORT            WSAEAFNOSUPPORT
90 #define EADDRINUSE              WSAEADDRINUSE
91 #define EADDRNOTAVAIL           WSAEADDRNOTAVAIL
92 #define ENETDOWN                WSAENETDOWN
93 #define ENETUNREACH             WSAENETUNREACH
94 #define ENETRESET               WSAENETRESET
95 #define ECONNABORTED            WSAECONNABORTED
96 #define ECONNRESET              WSAECONNRESET
97 #define ENOBUFS                 WSAENOBUFS
98 #define EISCONN                 WSAEISCONN
99 #define ENOTCONN                WSAENOTCONN
100 #define ESHUTDOWN               WSAESHUTDOWN
101 #define ETOOMANYREFS            WSAETOOMANYREFS
102 #define ETIMEDOUT               WSAETIMEDOUT
103 #define ECONNREFUSED            WSAECONNREFUSED
104 #define ELOOP                   WSAELOOP
105 #define ENAMETOOLONG            WSAENAMETOOLONG
106 #define EHOSTDOWN               WSAEHOSTDOWN
107 #define EHOSTUNREACH            WSAEHOSTUNREACH
108 #define ENOTEMPTY               WSAENOTEMPTY
109 #define EPROCLIM                WSAEPROCLIM
110 #define EUSERS                  WSAEUSERS
111 #define EDQUOT                  WSAEDQUOT
112 #define ESTALE                  WSAESTALE
113 #define EREMOTE                 WSAEREMOTE
114 
115 /* and an extra one */
116 #define EAGAIN					WSAEWOULDBLOCK
117 
118 #endif
119