blob: e6a1a993e77958971d42940e211b69daa89145b8 [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
Daniel Veillard48b3eb22009-03-25 09:51:19 +000018#define _inline __inline
Daniel Veillard73dd71e2006-02-09 09:08:46 +000019#endif
20
Rob Richardscb418de2005-10-13 23:12:42 +000021#include <ws2tcpip.h>
Daniel Veillard73dd71e2006-02-09 09:08:46 +000022
Rob Richardscb418de2005-10-13 23:12:42 +000023/* Check if ws2tcpip.h is a recent version which provides getaddrinfo() */
24#if defined(GetAddrInfo)
Rob Richardsc3e24352008-04-09 17:49:09 +000025#include <wspiapi.h>
Rob Richardscb418de2005-10-13 23:12:42 +000026#define HAVE_GETADDRINFO
27#endif
Igor Zlatkovic9524c232002-09-29 17:53:19 +000028#endif
29
Thomas Lemm066c6972012-05-09 18:27:04 +080030#if defined( __MINGW32__ ) || defined( _MSC_VER )
Daniel Veillardaffb8682006-01-04 09:55:16 +000031/* 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
Igor Zlatkovic9524c232002-09-29 17:53:19 +000037#if !defined SOCKLEN_T
38#define SOCKLEN_T int
39#endif
40
41#define EWOULDBLOCK WSAEWOULDBLOCK
Thomas Lemm066c6972012-05-09 18:27:04 +080042#define ESHUTDOWN WSAESHUTDOWN
43
Daniel Veillard8fc913f2012-06-06 11:29:29 +080044#if (!defined(_MSC_VER) || (_MSC_VER < 1600))
Igor Zlatkovic9524c232002-09-29 17:53:19 +000045#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
Igor Zlatkovic9524c232002-09-29 17:53:19 +000067#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*/
Thomas Lemm066c6972012-05-09 18:27:04 +080084#endif /* _MSC_VER */
Igor Zlatkovic9524c232002-09-29 17:53:19 +000085
86#endif /* __XML_WSOCKCOMPAT_H__ */