windows_common.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /*
  2. +----------------------------------------------------------------------+
  3. | Copyright (c) The PHP Group |
  4. +----------------------------------------------------------------------+
  5. | This source file is subject to version 3.01 of the PHP license, |
  6. | that is bundled with this package in the file LICENSE, and is |
  7. | available through the world-wide-web at the following url: |
  8. | https://www.php.net/license/3_01.txt |
  9. | If you did not receive a copy of the PHP license and are unable to |
  10. | obtain it through the world-wide-web, please send a note to |
  11. | license@php.net so we can mail you a copy immediately. |
  12. +----------------------------------------------------------------------+
  13. */
  14. #ifndef WINDOWS_COMMON_H
  15. #define WINDOWS_COMMON_H
  16. #include <Winsock2.h>
  17. #define NTDDI_XP NTDDI_WINXP /* bug in SDK */
  18. #include <IPHlpApi.h> /* conflicting definition of CMSG_DATA */
  19. #undef NTDDI_XP
  20. #define HAVE_IF_NAMETOINDEX 1
  21. #define IS_INVALID_SOCKET(a) (a->bsd_socket == INVALID_SOCKET)
  22. #ifdef errno
  23. # undef errno
  24. #endif
  25. #define errno WSAGetLastError()
  26. #define h_errno WSAGetLastError()
  27. #define set_errno(a) WSASetLastError(a)
  28. #define close(a) closesocket(a)
  29. #ifdef ENETUNREACH /* errno.h probably included */
  30. # undef EWOULDBLOCK
  31. # undef EINPROGRESS
  32. # undef EALREADY
  33. # undef ENOTSOCK
  34. # undef EDESTADDRREQ
  35. # undef EMSGSIZE
  36. # undef EPROTOTYPE
  37. # undef ENOPROTOOPT
  38. # undef EPROTONOSUPPORT
  39. # undef ESOCKTNOSUPPORT
  40. # undef EOPNOTSUPP
  41. # undef EPFNOSUPPORT
  42. # undef EAFNOSUPPORT
  43. # undef EADDRINUSE
  44. # undef EADDRNOTAVAIL
  45. # undef ENETDOWN
  46. # undef ENETUNREACH
  47. # undef ENETRESET
  48. # undef ECONNABORTED
  49. # undef ECONNRESET
  50. # undef ENOBUFS
  51. # undef EISCONN
  52. # undef ENOTCONN
  53. # undef ESHUTDOWN
  54. # undef ETOOMANYREFS
  55. # undef ETIMEDOUT
  56. # undef ECONNREFUSED
  57. # undef ELOOP
  58. # undef ENAMETOOLONG
  59. # undef EHOSTDOWN
  60. # undef EHOSTUNREACH
  61. # undef ENOTEMPTY
  62. # undef EPROCLIM
  63. # undef EUSERS
  64. # undef EDQUOT
  65. # undef ESTALE
  66. # undef EREMOTE
  67. # undef EAGAIN
  68. #endif
  69. /* section disabled in WinSock2.h */
  70. #define EWOULDBLOCK WSAEWOULDBLOCK
  71. #define EINPROGRESS WSAEINPROGRESS
  72. #define EALREADY WSAEALREADY
  73. #define ENOTSOCK WSAENOTSOCK
  74. #define EDESTADDRREQ WSAEDESTADDRREQ
  75. #define EMSGSIZE WSAEMSGSIZE
  76. #define EPROTOTYPE WSAEPROTOTYPE
  77. #define ENOPROTOOPT WSAENOPROTOOPT
  78. #define EPROTONOSUPPORT WSAEPROTONOSUPPORT
  79. #define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT
  80. #define EOPNOTSUPP WSAEOPNOTSUPP
  81. #define EPFNOSUPPORT WSAEPFNOSUPPORT
  82. #define EAFNOSUPPORT WSAEAFNOSUPPORT
  83. #define EADDRINUSE WSAEADDRINUSE
  84. #define EADDRNOTAVAIL WSAEADDRNOTAVAIL
  85. #define ENETDOWN WSAENETDOWN
  86. #define ENETUNREACH WSAENETUNREACH
  87. #define ENETRESET WSAENETRESET
  88. #define ECONNABORTED WSAECONNABORTED
  89. #define ECONNRESET WSAECONNRESET
  90. #define ENOBUFS WSAENOBUFS
  91. #define EISCONN WSAEISCONN
  92. #define ENOTCONN WSAENOTCONN
  93. #define ESHUTDOWN WSAESHUTDOWN
  94. #define ETOOMANYREFS WSAETOOMANYREFS
  95. #define ETIMEDOUT WSAETIMEDOUT
  96. #define ECONNREFUSED WSAECONNREFUSED
  97. #define ELOOP WSAELOOP
  98. #define ENAMETOOLONG WSAENAMETOOLONG
  99. #define EHOSTDOWN WSAEHOSTDOWN
  100. #define EHOSTUNREACH WSAEHOSTUNREACH
  101. #define ENOTEMPTY WSAENOTEMPTY
  102. #define EPROCLIM WSAEPROCLIM
  103. #define EUSERS WSAEUSERS
  104. #define EDQUOT WSAEDQUOT
  105. #define ESTALE WSAESTALE
  106. #define EREMOTE WSAEREMOTE
  107. /* and an extra one */
  108. #define EAGAIN WSAEWOULDBLOCK
  109. #endif