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#if defined( __MINGW32__ ) || defined( _MSC_VER )
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 ESHUTDOWN               WSAESHUTDOWN
43
44#if (!defined(_MSC_VER) || (_MSC_VER < 1600))
45#define EINPROGRESS             WSAEINPROGRESS
46#define EALREADY                WSAEALREADY
47#define ENOTSOCK                WSAENOTSOCK
48#define EDESTADDRREQ            WSAEDESTADDRREQ
49#define EMSGSIZE                WSAEMSGSIZE
50#define EPROTOTYPE              WSAEPROTOTYPE
51#define ENOPROTOOPT             WSAENOPROTOOPT
52#define EPROTONOSUPPORT         WSAEPROTONOSUPPORT
53#define ESOCKTNOSUPPORT         WSAESOCKTNOSUPPORT
54#define EOPNOTSUPP              WSAEOPNOTSUPP
55#define EPFNOSUPPORT            WSAEPFNOSUPPORT
56#define EAFNOSUPPORT            WSAEAFNOSUPPORT
57#define EADDRINUSE              WSAEADDRINUSE
58#define EADDRNOTAVAIL           WSAEADDRNOTAVAIL
59#define ENETDOWN                WSAENETDOWN
60#define ENETUNREACH             WSAENETUNREACH
61#define ENETRESET               WSAENETRESET
62#define ECONNABORTED            WSAECONNABORTED
63#define ECONNRESET              WSAECONNRESET
64#define ENOBUFS                 WSAENOBUFS
65#define EISCONN                 WSAEISCONN
66#define ENOTCONN                WSAENOTCONN
67#define ETOOMANYREFS            WSAETOOMANYREFS
68#define ETIMEDOUT               WSAETIMEDOUT
69#define ECONNREFUSED            WSAECONNREFUSED
70#define ELOOP                   WSAELOOP
71#define EHOSTDOWN               WSAEHOSTDOWN
72#define EHOSTUNREACH            WSAEHOSTUNREACH
73#define EPROCLIM                WSAEPROCLIM
74#define EUSERS                  WSAEUSERS
75#define EDQUOT                  WSAEDQUOT
76#define ESTALE                  WSAESTALE
77#define EREMOTE                 WSAEREMOTE
78/* These cause conflicts with the codes from errno.h. Since they are
79   not used in the relevant code (nanoftp, nanohttp), we can leave
80   them disabled.
81#define ENAMETOOLONG            WSAENAMETOOLONG
82#define ENOTEMPTY               WSAENOTEMPTY
83*/
84#endif /* _MSC_VER */
85
86#endif /* __XML_WSOCKCOMPAT_H__ */
87