wsockcompat.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /* include/wsockcompat.h
  2. * Windows -> Berkeley Sockets compatibility things.
  3. */
  4. #if !defined __XML_WSOCKCOMPAT_H__
  5. #define __XML_WSOCKCOMPAT_H__
  6. #ifdef _WIN32_WCE
  7. #include <winsock.h>
  8. #else
  9. #undef HAVE_ERRNO_H
  10. #include <winsock2.h>
  11. /* the following is a workaround a problem for 'inline' keyword in said
  12. header when compiled with Borland C++ 6 */
  13. #if defined(__BORLANDC__) && !defined(__cplusplus)
  14. #define inline __inline
  15. #define _inline __inline
  16. #endif
  17. #include <ws2tcpip.h>
  18. /* Check if ws2tcpip.h is a recent version which provides getaddrinfo() */
  19. #if defined(GetAddrInfo)
  20. #include <wspiapi.h>
  21. #define HAVE_GETADDRINFO
  22. #endif
  23. #endif
  24. #ifdef __MINGW32__
  25. /* Include <errno.h> here to ensure that it doesn't get included later
  26. * (e.g. by iconv.h) and overwrites the definition of EWOULDBLOCK. */
  27. #include <errno.h>
  28. #undef EWOULDBLOCK
  29. #endif
  30. #if !defined SOCKLEN_T
  31. #define SOCKLEN_T int
  32. #endif
  33. #define EWOULDBLOCK WSAEWOULDBLOCK
  34. #define EINPROGRESS WSAEINPROGRESS
  35. #define EALREADY WSAEALREADY
  36. #define ENOTSOCK WSAENOTSOCK
  37. #define EDESTADDRREQ WSAEDESTADDRREQ
  38. #define EMSGSIZE WSAEMSGSIZE
  39. #define EPROTOTYPE WSAEPROTOTYPE
  40. #define ENOPROTOOPT WSAENOPROTOOPT
  41. #define EPROTONOSUPPORT WSAEPROTONOSUPPORT
  42. #define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT
  43. #define EOPNOTSUPP WSAEOPNOTSUPP
  44. #define EPFNOSUPPORT WSAEPFNOSUPPORT
  45. #define EAFNOSUPPORT WSAEAFNOSUPPORT
  46. #define EADDRINUSE WSAEADDRINUSE
  47. #define EADDRNOTAVAIL WSAEADDRNOTAVAIL
  48. #define ENETDOWN WSAENETDOWN
  49. #define ENETUNREACH WSAENETUNREACH
  50. #define ENETRESET WSAENETRESET
  51. #define ECONNABORTED WSAECONNABORTED
  52. #define ECONNRESET WSAECONNRESET
  53. #define ENOBUFS WSAENOBUFS
  54. #define EISCONN WSAEISCONN
  55. #define ENOTCONN WSAENOTCONN
  56. #define ESHUTDOWN WSAESHUTDOWN
  57. #define ETOOMANYREFS WSAETOOMANYREFS
  58. #define ETIMEDOUT WSAETIMEDOUT
  59. #define ECONNREFUSED WSAECONNREFUSED
  60. #define ELOOP WSAELOOP
  61. #define EHOSTDOWN WSAEHOSTDOWN
  62. #define EHOSTUNREACH WSAEHOSTUNREACH
  63. #define EPROCLIM WSAEPROCLIM
  64. #define EUSERS WSAEUSERS
  65. #define EDQUOT WSAEDQUOT
  66. #define ESTALE WSAESTALE
  67. #define EREMOTE WSAEREMOTE
  68. /* These cause conflicts with the codes from errno.h. Since they are
  69. not used in the relevant code (nanoftp, nanohttp), we can leave
  70. them disabled.
  71. #define ENAMETOOLONG WSAENAMETOOLONG
  72. #define ENOTEMPTY WSAENOTEMPTY
  73. */
  74. #endif /* __XML_WSOCKCOMPAT_H__ */