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