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 #include <wspiapi.h>
  25 #define HAVE_GETADDRINFO
  26 #endif
  27 #endif
  28 
  29 #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 
  36 #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__ */