2
0

setup-win32.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. #ifndef HEADER_CURL_SETUP_WIN32_H
  2. #define HEADER_CURL_SETUP_WIN32_H
  3. /***************************************************************************
  4. * _ _ ____ _
  5. * Project ___| | | | _ \| |
  6. * / __| | | | |_) | |
  7. * | (__| |_| | _ <| |___
  8. * \___|\___/|_| \_\_____|
  9. *
  10. * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
  11. *
  12. * This software is licensed as described in the file COPYING, which
  13. * you should have received as part of this distribution. The terms
  14. * are also available at https://curl.se/docs/copyright.html.
  15. *
  16. * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  17. * copies of the Software, and permit persons to whom the Software is
  18. * furnished to do so, under the terms of the COPYING file.
  19. *
  20. * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  21. * KIND, either express or implied.
  22. *
  23. * SPDX-License-Identifier: curl
  24. *
  25. ***************************************************************************/
  26. #undef USE_WINSOCK
  27. /* ---------------------------------------------------------------- */
  28. /* Watt-32 TCP/IP SPECIFIC */
  29. /* ---------------------------------------------------------------- */
  30. #ifdef USE_WATT32
  31. # include <tcp.h>
  32. # undef byte
  33. # undef word
  34. # define HAVE_SYS_IOCTL_H
  35. # define HAVE_SYS_SOCKET_H
  36. # define HAVE_NETINET_IN_H
  37. # define HAVE_NETDB_H
  38. # define HAVE_ARPA_INET_H
  39. # define SOCKET int
  40. /* ---------------------------------------------------------------- */
  41. /* BSD-style lwIP TCP/IP stack SPECIFIC */
  42. /* ---------------------------------------------------------------- */
  43. #elif defined(USE_LWIPSOCK)
  44. /* Define to use BSD-style lwIP TCP/IP stack. */
  45. /* #define USE_LWIPSOCK 1 */
  46. # undef HAVE_GETHOSTNAME
  47. # undef LWIP_POSIX_SOCKETS_IO_NAMES
  48. # undef RECV_TYPE_ARG1
  49. # undef RECV_TYPE_ARG3
  50. # undef SEND_TYPE_ARG1
  51. # undef SEND_TYPE_ARG3
  52. # define HAVE_GETHOSTBYNAME_R
  53. # define HAVE_GETHOSTBYNAME_R_6
  54. # define LWIP_POSIX_SOCKETS_IO_NAMES 0
  55. # define RECV_TYPE_ARG1 int
  56. # define RECV_TYPE_ARG3 size_t
  57. # define SEND_TYPE_ARG1 int
  58. # define SEND_TYPE_ARG3 size_t
  59. #elif defined(_WIN32)
  60. # define USE_WINSOCK 2
  61. #endif
  62. /*
  63. * Include header files for Windows builds before redefining anything.
  64. * Use this preprocessor block only to include or exclude windows.h,
  65. * winsock2.h or ws2tcpip.h. Any other Windows thing belongs
  66. * to any other further and independent block. Under Cygwin things work
  67. * just as under Linux (e.g. <sys/socket.h>) and the Winsock headers should
  68. * never be included when __CYGWIN__ is defined.
  69. */
  70. #ifdef _WIN32
  71. # if defined(UNICODE) && !defined(_UNICODE)
  72. # error "UNICODE is defined but _UNICODE is not defined"
  73. # endif
  74. # if defined(_UNICODE) && !defined(UNICODE)
  75. # error "_UNICODE is defined but UNICODE is not defined"
  76. # endif
  77. /*
  78. * Do not include unneeded stuff in Windows headers to avoid compiler
  79. * warnings and macro clashes.
  80. * Make sure to define this macro before including any Windows headers.
  81. */
  82. # ifndef WIN32_LEAN_AND_MEAN
  83. # define WIN32_LEAN_AND_MEAN
  84. # endif
  85. # ifndef NOGDI
  86. # define NOGDI
  87. # endif
  88. # include <winsock2.h>
  89. # include <ws2tcpip.h>
  90. # include <windows.h>
  91. # include <winerror.h>
  92. # include <tchar.h>
  93. # ifdef UNICODE
  94. typedef wchar_t *(*curl_wcsdup_callback)(const wchar_t *str);
  95. # endif
  96. #endif
  97. /*
  98. * Define _WIN32_WINNT_[OS] symbols because not all Windows build systems have
  99. * those symbols to compare against, and even those that do may be missing
  100. * newer symbols.
  101. */
  102. #ifndef _WIN32_WINNT_NT4
  103. #define _WIN32_WINNT_NT4 0x0400 /* Windows NT 4.0 */
  104. #endif
  105. #ifndef _WIN32_WINNT_WIN2K
  106. #define _WIN32_WINNT_WIN2K 0x0500 /* Windows 2000 */
  107. #endif
  108. #ifndef _WIN32_WINNT_WINXP
  109. #define _WIN32_WINNT_WINXP 0x0501 /* Windows XP */
  110. #endif
  111. #ifndef _WIN32_WINNT_WS03
  112. #define _WIN32_WINNT_WS03 0x0502 /* Windows Server 2003 */
  113. #endif
  114. #ifndef _WIN32_WINNT_VISTA
  115. #define _WIN32_WINNT_VISTA 0x0600 /* Windows Vista */
  116. #endif
  117. #ifndef _WIN32_WINNT_WS08
  118. #define _WIN32_WINNT_WS08 0x0600 /* Windows Server 2008 */
  119. #endif
  120. #ifndef _WIN32_WINNT_WIN7
  121. #define _WIN32_WINNT_WIN7 0x0601 /* Windows 7 */
  122. #endif
  123. #ifndef _WIN32_WINNT_WIN8
  124. #define _WIN32_WINNT_WIN8 0x0602 /* Windows 8 */
  125. #endif
  126. #ifndef _WIN32_WINNT_WINBLUE
  127. #define _WIN32_WINNT_WINBLUE 0x0603 /* Windows 8.1 */
  128. #endif
  129. #ifndef _WIN32_WINNT_WIN10
  130. #define _WIN32_WINNT_WIN10 0x0A00 /* Windows 10 */
  131. #endif
  132. #endif /* HEADER_CURL_SETUP_WIN32_H */