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