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