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 27#undef USE_WINSOCK 28/* ---------------------------------------------------------------- */ 29/* Watt-32 TCP/IP SPECIFIC */ 30/* ---------------------------------------------------------------- */ 31#ifdef USE_WATT32 32# include <tcp.h> 33# undef byte 34# undef word 35# define HAVE_SYS_IOCTL_H 36# define HAVE_SYS_SOCKET_H 37# define HAVE_NETINET_IN_H 38# define HAVE_NETDB_H 39# define HAVE_ARPA_INET_H 40# define SOCKET int 41/* ---------------------------------------------------------------- */ 42/* BSD-style lwIP TCP/IP stack SPECIFIC */ 43/* ---------------------------------------------------------------- */ 44#elif defined(USE_LWIPSOCK) 45 /* Define to use BSD-style lwIP TCP/IP stack. */ 46 /* #define USE_LWIPSOCK 1 */ 47# undef HAVE_GETHOSTNAME 48# undef LWIP_POSIX_SOCKETS_IO_NAMES 49# undef RECV_TYPE_ARG1 50# undef RECV_TYPE_ARG3 51# undef SEND_TYPE_ARG1 52# undef SEND_TYPE_ARG3 53# define HAVE_GETHOSTBYNAME_R 54# define HAVE_GETHOSTBYNAME_R_6 55# define LWIP_POSIX_SOCKETS_IO_NAMES 0 56# define RECV_TYPE_ARG1 int 57# define RECV_TYPE_ARG3 size_t 58# define SEND_TYPE_ARG1 int 59# define SEND_TYPE_ARG3 size_t 60#elif defined(_WIN32) 61# define USE_WINSOCK 2 62#endif 63 64/* 65 * Include header files for windows builds before redefining anything. 66 * Use this preprocessor block only to include or exclude windows.h, 67 * winsock2.h or ws2tcpip.h. Any other windows thing belongs 68 * to any other further and independent block. Under Cygwin things work 69 * just as under linux (e.g. <sys/socket.h>) and the winsock headers should 70 * never be included when __CYGWIN__ is defined. 71 */ 72 73#ifdef _WIN32 74# if defined(UNICODE) && !defined(_UNICODE) 75# error "UNICODE is defined but _UNICODE is not defined" 76# endif 77# if defined(_UNICODE) && !defined(UNICODE) 78# error "_UNICODE is defined but UNICODE is not defined" 79# endif 80/* 81 * Don't include unneeded stuff in Windows headers to avoid compiler 82 * warnings and macro clashes. 83 * Make sure to define this macro before including any Windows headers. 84 */ 85# ifndef WIN32_LEAN_AND_MEAN 86# define WIN32_LEAN_AND_MEAN 87# endif 88# ifndef NOGDI 89# define NOGDI 90# endif 91# include <winsock2.h> 92# include <ws2tcpip.h> 93# include <windows.h> 94# include <winerror.h> 95# include <tchar.h> 96# ifdef UNICODE 97 typedef wchar_t *(*curl_wcsdup_callback)(const wchar_t *str); 98# endif 99#endif 100 101/* 102 * Define _WIN32_WINNT_[OS] symbols because not all Windows build systems have 103 * those symbols to compare against, and even those that do may be missing 104 * newer symbols. 105 */ 106 107#ifndef _WIN32_WINNT_NT4 108#define _WIN32_WINNT_NT4 0x0400 /* Windows NT 4.0 */ 109#endif 110#ifndef _WIN32_WINNT_WIN2K 111#define _WIN32_WINNT_WIN2K 0x0500 /* Windows 2000 */ 112#endif 113#ifndef _WIN32_WINNT_WINXP 114#define _WIN32_WINNT_WINXP 0x0501 /* Windows XP */ 115#endif 116#ifndef _WIN32_WINNT_WS03 117#define _WIN32_WINNT_WS03 0x0502 /* Windows Server 2003 */ 118#endif 119#ifndef _WIN32_WINNT_VISTA 120#define _WIN32_WINNT_VISTA 0x0600 /* Windows Vista */ 121#endif 122#ifndef _WIN32_WINNT_WS08 123#define _WIN32_WINNT_WS08 0x0600 /* Windows Server 2008 */ 124#endif 125#ifndef _WIN32_WINNT_WIN7 126#define _WIN32_WINNT_WIN7 0x0601 /* Windows 7 */ 127#endif 128#ifndef _WIN32_WINNT_WIN8 129#define _WIN32_WINNT_WIN8 0x0602 /* Windows 8 */ 130#endif 131#ifndef _WIN32_WINNT_WINBLUE 132#define _WIN32_WINNT_WINBLUE 0x0603 /* Windows 8.1 */ 133#endif 134#ifndef _WIN32_WINNT_WIN10 135#define _WIN32_WINNT_WIN10 0x0A00 /* Windows 10 */ 136#endif 137 138#endif /* HEADER_CURL_SETUP_WIN32_H */ 139