113498266Sopenharmony_ci#ifndef HEADER_CURL_SETUP_WIN32_H
213498266Sopenharmony_ci#define HEADER_CURL_SETUP_WIN32_H
313498266Sopenharmony_ci/***************************************************************************
413498266Sopenharmony_ci *                                  _   _ ____  _
513498266Sopenharmony_ci *  Project                     ___| | | |  _ \| |
613498266Sopenharmony_ci *                             / __| | | | |_) | |
713498266Sopenharmony_ci *                            | (__| |_| |  _ <| |___
813498266Sopenharmony_ci *                             \___|\___/|_| \_\_____|
913498266Sopenharmony_ci *
1013498266Sopenharmony_ci * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
1113498266Sopenharmony_ci *
1213498266Sopenharmony_ci * This software is licensed as described in the file COPYING, which
1313498266Sopenharmony_ci * you should have received as part of this distribution. The terms
1413498266Sopenharmony_ci * are also available at https://curl.se/docs/copyright.html.
1513498266Sopenharmony_ci *
1613498266Sopenharmony_ci * You may opt to use, copy, modify, merge, publish, distribute and/or sell
1713498266Sopenharmony_ci * copies of the Software, and permit persons to whom the Software is
1813498266Sopenharmony_ci * furnished to do so, under the terms of the COPYING file.
1913498266Sopenharmony_ci *
2013498266Sopenharmony_ci * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
2113498266Sopenharmony_ci * KIND, either express or implied.
2213498266Sopenharmony_ci *
2313498266Sopenharmony_ci * SPDX-License-Identifier: curl
2413498266Sopenharmony_ci *
2513498266Sopenharmony_ci ***************************************************************************/
2613498266Sopenharmony_ci
2713498266Sopenharmony_ci#undef USE_WINSOCK
2813498266Sopenharmony_ci/* ---------------------------------------------------------------- */
2913498266Sopenharmony_ci/*                     Watt-32 TCP/IP SPECIFIC                      */
3013498266Sopenharmony_ci/* ---------------------------------------------------------------- */
3113498266Sopenharmony_ci#ifdef USE_WATT32
3213498266Sopenharmony_ci#  include <tcp.h>
3313498266Sopenharmony_ci#  undef byte
3413498266Sopenharmony_ci#  undef word
3513498266Sopenharmony_ci#  define HAVE_SYS_IOCTL_H
3613498266Sopenharmony_ci#  define HAVE_SYS_SOCKET_H
3713498266Sopenharmony_ci#  define HAVE_NETINET_IN_H
3813498266Sopenharmony_ci#  define HAVE_NETDB_H
3913498266Sopenharmony_ci#  define HAVE_ARPA_INET_H
4013498266Sopenharmony_ci#  define SOCKET int
4113498266Sopenharmony_ci/* ---------------------------------------------------------------- */
4213498266Sopenharmony_ci/*               BSD-style lwIP TCP/IP stack SPECIFIC               */
4313498266Sopenharmony_ci/* ---------------------------------------------------------------- */
4413498266Sopenharmony_ci#elif defined(USE_LWIPSOCK)
4513498266Sopenharmony_ci  /* Define to use BSD-style lwIP TCP/IP stack. */
4613498266Sopenharmony_ci  /* #define USE_LWIPSOCK 1 */
4713498266Sopenharmony_ci#  undef HAVE_GETHOSTNAME
4813498266Sopenharmony_ci#  undef LWIP_POSIX_SOCKETS_IO_NAMES
4913498266Sopenharmony_ci#  undef RECV_TYPE_ARG1
5013498266Sopenharmony_ci#  undef RECV_TYPE_ARG3
5113498266Sopenharmony_ci#  undef SEND_TYPE_ARG1
5213498266Sopenharmony_ci#  undef SEND_TYPE_ARG3
5313498266Sopenharmony_ci#  define HAVE_GETHOSTBYNAME_R
5413498266Sopenharmony_ci#  define HAVE_GETHOSTBYNAME_R_6
5513498266Sopenharmony_ci#  define LWIP_POSIX_SOCKETS_IO_NAMES 0
5613498266Sopenharmony_ci#  define RECV_TYPE_ARG1 int
5713498266Sopenharmony_ci#  define RECV_TYPE_ARG3 size_t
5813498266Sopenharmony_ci#  define SEND_TYPE_ARG1 int
5913498266Sopenharmony_ci#  define SEND_TYPE_ARG3 size_t
6013498266Sopenharmony_ci#elif defined(_WIN32)
6113498266Sopenharmony_ci#  define USE_WINSOCK 2
6213498266Sopenharmony_ci#endif
6313498266Sopenharmony_ci
6413498266Sopenharmony_ci/*
6513498266Sopenharmony_ci * Include header files for windows builds before redefining anything.
6613498266Sopenharmony_ci * Use this preprocessor block only to include or exclude windows.h,
6713498266Sopenharmony_ci * winsock2.h or ws2tcpip.h. Any other windows thing belongs
6813498266Sopenharmony_ci * to any other further and independent block.  Under Cygwin things work
6913498266Sopenharmony_ci * just as under linux (e.g. <sys/socket.h>) and the winsock headers should
7013498266Sopenharmony_ci * never be included when __CYGWIN__ is defined.
7113498266Sopenharmony_ci */
7213498266Sopenharmony_ci
7313498266Sopenharmony_ci#ifdef _WIN32
7413498266Sopenharmony_ci#  if defined(UNICODE) && !defined(_UNICODE)
7513498266Sopenharmony_ci#    error "UNICODE is defined but _UNICODE is not defined"
7613498266Sopenharmony_ci#  endif
7713498266Sopenharmony_ci#  if defined(_UNICODE) && !defined(UNICODE)
7813498266Sopenharmony_ci#    error "_UNICODE is defined but UNICODE is not defined"
7913498266Sopenharmony_ci#  endif
8013498266Sopenharmony_ci/*
8113498266Sopenharmony_ci * Don't include unneeded stuff in Windows headers to avoid compiler
8213498266Sopenharmony_ci * warnings and macro clashes.
8313498266Sopenharmony_ci * Make sure to define this macro before including any Windows headers.
8413498266Sopenharmony_ci */
8513498266Sopenharmony_ci#  ifndef WIN32_LEAN_AND_MEAN
8613498266Sopenharmony_ci#    define WIN32_LEAN_AND_MEAN
8713498266Sopenharmony_ci#  endif
8813498266Sopenharmony_ci#  ifndef NOGDI
8913498266Sopenharmony_ci#    define NOGDI
9013498266Sopenharmony_ci#  endif
9113498266Sopenharmony_ci#  include <winsock2.h>
9213498266Sopenharmony_ci#  include <ws2tcpip.h>
9313498266Sopenharmony_ci#  include <windows.h>
9413498266Sopenharmony_ci#  include <winerror.h>
9513498266Sopenharmony_ci#  include <tchar.h>
9613498266Sopenharmony_ci#  ifdef UNICODE
9713498266Sopenharmony_ci     typedef wchar_t *(*curl_wcsdup_callback)(const wchar_t *str);
9813498266Sopenharmony_ci#  endif
9913498266Sopenharmony_ci#endif
10013498266Sopenharmony_ci
10113498266Sopenharmony_ci/*
10213498266Sopenharmony_ci * Define _WIN32_WINNT_[OS] symbols because not all Windows build systems have
10313498266Sopenharmony_ci * those symbols to compare against, and even those that do may be missing
10413498266Sopenharmony_ci * newer symbols.
10513498266Sopenharmony_ci */
10613498266Sopenharmony_ci
10713498266Sopenharmony_ci#ifndef _WIN32_WINNT_NT4
10813498266Sopenharmony_ci#define _WIN32_WINNT_NT4            0x0400   /* Windows NT 4.0 */
10913498266Sopenharmony_ci#endif
11013498266Sopenharmony_ci#ifndef _WIN32_WINNT_WIN2K
11113498266Sopenharmony_ci#define _WIN32_WINNT_WIN2K          0x0500   /* Windows 2000 */
11213498266Sopenharmony_ci#endif
11313498266Sopenharmony_ci#ifndef _WIN32_WINNT_WINXP
11413498266Sopenharmony_ci#define _WIN32_WINNT_WINXP          0x0501   /* Windows XP */
11513498266Sopenharmony_ci#endif
11613498266Sopenharmony_ci#ifndef _WIN32_WINNT_WS03
11713498266Sopenharmony_ci#define _WIN32_WINNT_WS03           0x0502   /* Windows Server 2003 */
11813498266Sopenharmony_ci#endif
11913498266Sopenharmony_ci#ifndef _WIN32_WINNT_VISTA
12013498266Sopenharmony_ci#define _WIN32_WINNT_VISTA          0x0600   /* Windows Vista */
12113498266Sopenharmony_ci#endif
12213498266Sopenharmony_ci#ifndef _WIN32_WINNT_WS08
12313498266Sopenharmony_ci#define _WIN32_WINNT_WS08           0x0600   /* Windows Server 2008 */
12413498266Sopenharmony_ci#endif
12513498266Sopenharmony_ci#ifndef _WIN32_WINNT_WIN7
12613498266Sopenharmony_ci#define _WIN32_WINNT_WIN7           0x0601   /* Windows 7 */
12713498266Sopenharmony_ci#endif
12813498266Sopenharmony_ci#ifndef _WIN32_WINNT_WIN8
12913498266Sopenharmony_ci#define _WIN32_WINNT_WIN8           0x0602   /* Windows 8 */
13013498266Sopenharmony_ci#endif
13113498266Sopenharmony_ci#ifndef _WIN32_WINNT_WINBLUE
13213498266Sopenharmony_ci#define _WIN32_WINNT_WINBLUE        0x0603   /* Windows 8.1 */
13313498266Sopenharmony_ci#endif
13413498266Sopenharmony_ci#ifndef _WIN32_WINNT_WIN10
13513498266Sopenharmony_ci#define _WIN32_WINNT_WIN10          0x0A00   /* Windows 10 */
13613498266Sopenharmony_ci#endif
13713498266Sopenharmony_ci
13813498266Sopenharmony_ci#endif /* HEADER_CURL_SETUP_WIN32_H */
139