1 /* include/wsockcompat.h
2  * Windows -> Berkeley Sockets compatibility things.
3  */
4 
5 #if !defined __XML_WSOCKCOMPAT_H__
6 #define __XML_WSOCKCOMPAT_H__
7 
8 #ifdef _WIN32_WCE
9 #include <winsock.h>
10 #else
11 #undef HAVE_ERRNO_H
12 #include <winsock2.h>
13 
14 /* the following is a workaround a problem for 'inline' keyword in said
15    header when compiled with Borland C++ 6 */
16 #if defined(__BORLANDC__) && !defined(__cplusplus)
17 #define inline __inline
18 #define _inline __inline
19 #endif
20 
21 #include <ws2tcpip.h>
22 
23 /* Check if ws2tcpip.h is a recent version which provides getaddrinfo() */
24 #if defined(GetAddrInfo)
25 #include <wspiapi.h>
26 #define HAVE_GETADDRINFO
27 #endif
28 #endif
29 
30 #ifdef __MINGW32__
31 /* Include <errno.h> here to ensure that it doesn't get included later
32  * (e.g. by iconv.h) and overwrites the definition of EWOULDBLOCK. */
33 #include <errno.h>
34 #undef EWOULDBLOCK
35 #endif
36 
37 #if !defined SOCKLEN_T
38 #define SOCKLEN_T int
39 #endif
40 
41 #define EWOULDBLOCK             WSAEWOULDBLOCK
42 #define EINPROGRESS             WSAEINPROGRESS
43 #define EALREADY                WSAEALREADY
44 #define ENOTSOCK                WSAENOTSOCK
45 #define EDESTADDRREQ            WSAEDESTADDRREQ
46 #define EMSGSIZE                WSAEMSGSIZE
47 #define EPROTOTYPE              WSAEPROTOTYPE
48 #define ENOPROTOOPT             WSAENOPROTOOPT
49 #define EPROTONOSUPPORT         WSAEPROTONOSUPPORT
50 #define ESOCKTNOSUPPORT         WSAESOCKTNOSUPPORT
51 #define EOPNOTSUPP              WSAEOPNOTSUPP
52 #define EPFNOSUPPORT            WSAEPFNOSUPPORT
53 #define EAFNOSUPPORT            WSAEAFNOSUPPORT
54 #define EADDRINUSE              WSAEADDRINUSE
55 #define EADDRNOTAVAIL           WSAEADDRNOTAVAIL
56 #define ENETDOWN                WSAENETDOWN
57 #define ENETUNREACH             WSAENETUNREACH
58 #define ENETRESET               WSAENETRESET
59 #define ECONNABORTED            WSAECONNABORTED
60 #define ECONNRESET              WSAECONNRESET
61 #define ENOBUFS                 WSAENOBUFS
62 #define EISCONN                 WSAEISCONN
63 #define ENOTCONN                WSAENOTCONN
64 #define ESHUTDOWN               WSAESHUTDOWN
65 #define ETOOMANYREFS            WSAETOOMANYREFS
66 #define ETIMEDOUT               WSAETIMEDOUT
67 #define ECONNREFUSED            WSAECONNREFUSED
68 #define ELOOP                   WSAELOOP
69 #define EHOSTDOWN               WSAEHOSTDOWN
70 #define EHOSTUNREACH            WSAEHOSTUNREACH
71 #define EPROCLIM                WSAEPROCLIM
72 #define EUSERS                  WSAEUSERS
73 #define EDQUOT                  WSAEDQUOT
74 #define ESTALE                  WSAESTALE
75 #define EREMOTE                 WSAEREMOTE
76 /* These cause conflicts with the codes from errno.h. Since they are
77    not used in the relevant code (nanoftp, nanohttp), we can leave
78    them disabled.
79 #define ENAMETOOLONG            WSAENAMETOOLONG
80 #define ENOTEMPTY               WSAENOTEMPTY
81 */
82 
83 #endif /* __XML_WSOCKCOMPAT_H__ */
84