1/* MIT License
2 *
3 * Copyright (c) 2004 Daniel Stenberg
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice (including the next
13 * paragraph) shall be included in all copies or substantial portions of the
14 * Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 *
24 * SPDX-License-Identifier: MIT
25 */
26#ifndef HEADER_CARES_CONFIG_WIN32_H
27#define HEADER_CARES_CONFIG_WIN32_H
28
29/* ================================================================ */
30/*   c-ares/config-win32.h - Hand crafted config file for Windows   */
31/* ================================================================ */
32
33/* ---------------------------------------------------------------- */
34/*                          HEADER FILES                            */
35/* ---------------------------------------------------------------- */
36
37/* Define if you have the <assert.h> header file. */
38#define HAVE_ASSERT_H 1
39
40/* Define if you have the <errno.h> header file. */
41#define HAVE_ERRNO_H 1
42
43/* Define if you have the <getopt.h> header file. */
44#if defined(__MINGW32__) || defined(__POCC__)
45#  define HAVE_GETOPT_H 1
46#endif
47
48/* Define if you have the <limits.h> header file. */
49#define HAVE_LIMITS_H 1
50
51/* Define if you have the <process.h> header file. */
52#ifndef __SALFORDC__
53#  define HAVE_PROCESS_H 1
54#endif
55
56/* Define if you have the <signal.h> header file. */
57#define HAVE_SIGNAL_H 1
58
59/* Define if you have the <sys/time.h> header file */
60/* #define HAVE_SYS_TIME_H 1 */
61
62/* Define if you have the <time.h> header file. */
63#define HAVE_TIME_H 1
64
65/* Define if you have the <unistd.h> header file. */
66#if defined(__MINGW32__) || defined(__WATCOMC__) || defined(__LCC__) || \
67  defined(__POCC__)
68#  define HAVE_UNISTD_H 1
69#endif
70
71/* Define if you have the <windows.h> header file. */
72#define HAVE_WINDOWS_H 1
73
74/* Define if you have the <winsock.h> header file. */
75#define HAVE_WINSOCK_H 1
76
77/* Define if you have the <winsock2.h> header file. */
78#ifndef __SALFORDC__
79#  define HAVE_WINSOCK2_H 1
80#endif
81
82/* Define if you have the <ws2tcpip.h> header file. */
83#ifndef __SALFORDC__
84#  define HAVE_WS2TCPIP_H 1
85#endif
86
87/* Define if you have <iphlpapi.h> header file */
88#define HAVE_IPHLPAPI_H 1
89
90/* Define if you have <netioapi.h> header file */
91#ifndef __WATCOMC__
92#  define HAVE_NETIOAPI_H 1
93#endif
94
95#define HAVE_SYS_TYPES_H 1
96#define HAVE_SYS_STAT_H  1
97
98/* If we are building with OpenWatcom, we need to specify that we have
99 * <stdint.h>. */
100#if defined(__WATCOMC__)
101#  define HAVE_STDINT_H
102#endif
103
104/* ---------------------------------------------------------------- */
105/*                        OTHER HEADER INFO                         */
106/* ---------------------------------------------------------------- */
107
108/* Define if you have the ANSI C header files. */
109#define STDC_HEADERS 1
110
111/* ---------------------------------------------------------------- */
112/*                             FUNCTIONS                            */
113/* ---------------------------------------------------------------- */
114
115/* Define if you have the closesocket function. */
116#define HAVE_CLOSESOCKET 1
117
118/* Define if you have the getenv function. */
119#define HAVE_GETENV 1
120
121/* Define if you have the gethostname function. */
122#define HAVE_GETHOSTNAME 1
123
124/* Define if you have the ioctlsocket function. */
125#define HAVE_IOCTLSOCKET 1
126
127/* Define if you have a working ioctlsocket FIONBIO function. */
128#define HAVE_IOCTLSOCKET_FIONBIO 1
129
130/* Define if you have the strcasecmp function. */
131/* #define HAVE_STRCASECMP 1 */
132
133/* Define if you have the strdup function. */
134#define HAVE_STRDUP 1
135
136/* Define if you have the stricmp function. */
137#define HAVE_STRICMP 1
138
139/* Define if you have the strncasecmp function. */
140/* #define HAVE_STRNCASECMP 1 */
141
142/* Define if you have the strnicmp function. */
143#define HAVE_STRNICMP 1
144
145/* Define if you have the recv function. */
146#define HAVE_RECV 1
147
148/* Define to the type of arg 1 for recv. */
149#define RECV_TYPE_ARG1 SOCKET
150
151/* Define to the type of arg 2 for recv. */
152#define RECV_TYPE_ARG2 char *
153
154/* Define to the type of arg 3 for recv. */
155#define RECV_TYPE_ARG3 int
156
157/* Define to the type of arg 4 for recv. */
158#define RECV_TYPE_ARG4 int
159
160/* Define to the function return type for recv. */
161#define RECV_TYPE_RETV int
162
163/* Define if you have the recvfrom function. */
164#define HAVE_RECVFROM 1
165
166/* Define to the type of arg 1 for recvfrom. */
167#define RECVFROM_TYPE_ARG1 SOCKET
168
169/* Define to the type pointed by arg 2 for recvfrom. */
170#define RECVFROM_TYPE_ARG2 char
171
172/* Define to the type of arg 3 for recvfrom. */
173#define RECVFROM_TYPE_ARG3 int
174
175/* Define to the type of arg 4 for recvfrom. */
176#define RECVFROM_TYPE_ARG4 int
177
178/* Define to the type pointed by arg 5 for recvfrom. */
179#define RECVFROM_TYPE_ARG5 struct sockaddr
180
181/* Define to the type pointed by arg 6 for recvfrom. */
182#define RECVFROM_TYPE_ARG6 int
183
184/* Define to the function return type for recvfrom. */
185#define RECVFROM_TYPE_RETV int
186
187/* Define if you have the send function. */
188#define HAVE_SEND 1
189
190/* Define to the type of arg 1 for send. */
191#define SEND_TYPE_ARG1 SOCKET
192
193/* Define to the type qualifier of arg 2 for send. */
194#define SEND_QUAL_ARG2 const
195
196/* Define to the type of arg 2 for send. */
197#define SEND_TYPE_ARG2 char *
198
199/* Define to the type of arg 3 for send. */
200#define SEND_TYPE_ARG3 int
201
202/* Define to the type of arg 4 for send. */
203#define SEND_TYPE_ARG4 int
204
205/* Define to the function return type for send. */
206#define SEND_TYPE_RETV int
207
208/* Specifics for the Watt-32 tcp/ip stack. */
209#ifdef WATT32
210#  define SOCKET                   int
211#  define NS_INADDRSZ              4
212#  define HAVE_ARPA_NAMESER_H      1
213#  define HAVE_ARPA_INET_H         1
214#  define HAVE_NETDB_H             1
215#  define HAVE_NETINET_IN_H        1
216#  define HAVE_SYS_SOCKET_H        1
217#  define HAVE_NETINET_TCP_H       1
218#  define HAVE_AF_INET6            1
219#  define HAVE_PF_INET6            1
220#  define HAVE_STRUCT_IN6_ADDR     1
221#  define HAVE_STRUCT_SOCKADDR_IN6 1
222#  undef HAVE_WINSOCK_H
223#  undef HAVE_WINSOCK2_H
224#  undef HAVE_WS2TCPIP_H
225#endif
226
227/* Threading support enabled */
228#define CARES_THREADS 1
229
230/* ---------------------------------------------------------------- */
231/*                       TYPEDEF REPLACEMENTS                       */
232/* ---------------------------------------------------------------- */
233
234/* ---------------------------------------------------------------- */
235/*                            TYPE SIZES                            */
236/* ---------------------------------------------------------------- */
237
238/* ---------------------------------------------------------------- */
239/*                          STRUCT RELATED                          */
240/* ---------------------------------------------------------------- */
241
242/* Define if you have struct addrinfo. */
243#define HAVE_STRUCT_ADDRINFO 1
244
245/* Define if you have struct sockaddr_storage. */
246#if !defined(__SALFORDC__) && !defined(__BORLANDC__)
247#  define HAVE_STRUCT_SOCKADDR_STORAGE 1
248#endif
249
250/* Define if you have struct timeval. */
251#define HAVE_STRUCT_TIMEVAL 1
252
253/* ---------------------------------------------------------------- */
254/*                        COMPILER SPECIFIC                         */
255/* ---------------------------------------------------------------- */
256
257/* Define to avoid VS2005 complaining about portable C functions. */
258#if defined(_MSC_VER) && (_MSC_VER >= 1400)
259#  define _CRT_SECURE_NO_DEPRECATE  1
260#  define _CRT_NONSTDC_NO_DEPRECATE 1
261#endif
262
263/* Set the Target to Win8 */
264#if defined(_MSC_VER) && (_MSC_VER >= 1500)
265#  define MSVC_MIN_TARGET 0x0602
266#endif
267
268/* MSVC default target settings */
269#if defined(_MSC_VER) && (_MSC_VER >= 1500)
270#  ifndef _WIN32_WINNT
271#    define _WIN32_WINNT MSVC_MIN_TARGET
272#  endif
273#  ifndef WINVER
274#    define WINVER MSVC_MIN_TARGET
275#  endif
276#endif
277
278/* When no build target is specified Pelles C 5.00 and later default build
279   target is Windows Vista. */
280#if defined(__POCC__) && (__POCC__ >= 500)
281#  ifndef _WIN32_WINNT
282#    define _WIN32_WINNT 0x0602
283#  endif
284#  ifndef WINVER
285#    define WINVER 0x0602
286#  endif
287#endif
288
289/* Availability of freeaddrinfo, getaddrinfo and getnameinfo functions is
290   quite convoluted, compiler dependent and even build target dependent. */
291#if defined(HAVE_WS2TCPIP_H)
292#  if defined(__POCC__)
293#    define HAVE_FREEADDRINFO 1
294#    define HAVE_GETADDRINFO  1
295#    define HAVE_GETNAMEINFO  1
296#  elif defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0501)
297#    define HAVE_FREEADDRINFO 1
298#    define HAVE_GETADDRINFO  1
299#    define HAVE_GETNAMEINFO  1
300#  elif defined(_MSC_VER) && (_MSC_VER >= 1200)
301#    define HAVE_FREEADDRINFO 1
302#    define HAVE_GETADDRINFO  1
303#    define HAVE_GETNAMEINFO  1
304#  endif
305#endif
306
307#if defined(__POCC__)
308#  ifndef _MSC_VER
309#    error Microsoft extensions /Ze compiler option is required
310#  endif
311#  ifndef __POCC__OLDNAMES
312#    error Compatibility names /Go compiler option is required
313#  endif
314#endif
315
316/* ---------------------------------------------------------------- */
317/*                         IPV6 COMPATIBILITY                       */
318/* ---------------------------------------------------------------- */
319
320/* Define if you have address family AF_INET6. */
321#ifdef HAVE_WINSOCK2_H
322#  define HAVE_AF_INET6 1
323#endif
324
325/* Define if you have protocol family PF_INET6. */
326#ifdef HAVE_WINSOCK2_H
327#  define HAVE_PF_INET6 1
328#endif
329
330/* Define if you have struct in6_addr. */
331#ifdef HAVE_WS2TCPIP_H
332#  define HAVE_STRUCT_IN6_ADDR 1
333#endif
334
335/* Define if you have struct sockaddr_in6. */
336#ifdef HAVE_WS2TCPIP_H
337#  define HAVE_STRUCT_SOCKADDR_IN6 1
338#endif
339
340/* Define if you have sockaddr_in6 with scopeid. */
341#ifdef HAVE_WS2TCPIP_H
342#  define HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID 1
343#endif
344
345#if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0600) && !defined(__WATCOMC__)
346/* Define if you have if_nametoindex() */
347#  define HAVE_IF_NAMETOINDEX 1
348/* Define if you have if_indextoname() */
349#  define HAVE_IF_INDEXTONAME 1
350/* Define to 1 if you have the `ConvertInterfaceIndexToLuid' function. */
351#  define HAVE_CONVERTINTERFACEINDEXTOLUID 1
352/* Define to 1 if you have the `ConvertInterfaceLuidToNameA' function. */
353#  define HAVE_CONVERTINTERFACELUIDTONAMEA 1
354#endif
355
356/* ---------------------------------------------------------------- */
357/*                              Win CE                              */
358/* ---------------------------------------------------------------- */
359
360/* FIXME: A proper config-win32ce.h should be created to hold these */
361
362/*
363 *  System error codes for Windows CE
364 */
365
366#if defined(_WIN32_WCE) && !defined(HAVE_ERRNO_H)
367#  define ENOENT ERROR_FILE_NOT_FOUND
368#  define ESRCH  ERROR_PATH_NOT_FOUND
369#  define ENOMEM ERROR_NOT_ENOUGH_MEMORY
370#  define ENOSPC ERROR_INVALID_PARAMETER
371#endif
372
373#endif /* HEADER_CARES_CONFIG_WIN32_H */
374