"Fossies" - the Fresh Open Source Software Archive 
Member "ntp-4.2.8p15/ports/winnt/include/config.h" (23 Jun 2020, 15518 Bytes) of package /linux/misc/ntp-4.2.8p15.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
For more information about "config.h" see the
Fossies "Dox" file reference documentation and the latest
Fossies "Diffs" side-by-side code changes report:
4.2.8p14_vs_4.2.8p15.
1 /*
2 * ports/winnt/include/config.h - static Windows config.h
3 *
4 * On most systems config.h is generated by the configure script.
5 * For the Windows port, it's hand-maintained. Compilers earlier
6 * than Visual C++ 2005 are no longer supported, enabling
7 * portable use of "long long" and "%lld".
8 */
9
10 #ifndef CONFIG_H
11 #define CONFIG_H
12
13 /*
14 * Known predifined MS compiler version codes:
15 * 1800: MSVC++ 12.0 (Visual Studio 2013)
16 * 1700: MSVC++ 11.0 (Visual Studio 2012)
17 * 1600: MSVC++ 10.0 (Visual Studio 2010)
18 * 1500: MSVC++ 9.0 (Visual Studio 2008)
19 * 1400: MSVC++ 8.0 (Visual Studio 2005)
20 * 1310: MSVC++ 7.1 (Visual Studio 2003)
21 * 1300: MSVC++ 7.0
22 * 1200: MSVC++ 6.0 (Visual C++ 6)
23 * 1100: MSVC++ 5.0
24 */
25
26 #if defined(_MSC_VER) && _MSC_VER < 1400
27 #error Minimum supported Microsoft compiler is Visual C++ 2005.
28 #endif
29
30 /*
31 * We want structures and prototypes added after Windows NT 4.0 exposed
32 * by Windows header files, so we define _WIN32_WINNT to target Windows
33 * XP (version 5.1). By default, _WIN32_WINNT also controls the minimum
34 * required Windows version to launch the .exe. As we want a single
35 * binary to work on all supported Windows versions, we runtime link
36 * newer functions, and use the linker /version:0x0400 option to
37 * override the .EXE header minimum Windows version.
38 *
39 * When using the VC++ 2008 and later compilers, the resulting binaries
40 * will not work on versions earlier than Windows XP, due to runtime
41 * library dependencies. That is, Visual C++ 2005 is the last version
42 * capable of producing binaries usable with Windows NT 4 and 2000.
43 */
44 #ifndef _WIN32_WINNT
45 #define _WIN32_WINNT 0x0501
46 #endif
47
48 #define __attribute__(x) /* empty */
49 #define _CRT_SECURE_NO_DEPRECATE 1
50
51 /*
52 * ANSI C compliance enabled
53 */
54 #define __STDC__ 1
55
56 /*
57 * Enable the debug build of MS C runtime to dump leaks
58 * at exit time (currently only if run under a debugger).
59 */
60 #if defined(_MSC_VER) && defined(_DEBUG)
61 # define _CRTDBG_MAP_ALLOC
62 # include <stdlib.h>
63 # include <malloc.h>
64 # include <crtdbg.h>
65 /* # define MALLOC_LINT */ /* defers free() */
66 # define EREALLOC_IMPL(ptr, newsz, filenm, loc) \
67 _realloc_dbg(ptr, newsz, _NORMAL_BLOCK, filenm, loc)
68 #endif
69
70 /*
71 * We need to include stdio.h first before we #define snprintf
72 * otherwise we can get errors during the build
73 */
74 #include <stdio.h>
75
76 /* Prevent inclusion of winsock.h in windows.h */
77 #ifndef _WINSOCKAPI_
78 #define _WINSOCKAPI_
79 #endif
80
81 #ifndef __RPCASYNC_H__
82 #define __RPCASYNC_H__
83 #endif
84
85 /*
86 * On Unix struct sock_timeval is equivalent to struct timeval.
87 * On Windows built with 64-bit time_t, sock_timeval.tv_sec is a long
88 * as required by Windows' socket() interface timeout argument, while
89 * timeval.tv_sec is time_t for the more common use as a UTC time
90 * within NTP.
91 *
92 * winsock.h unconditionally defines struct timeval with long tv_sec
93 * instead of time_t tv_sec. We redirect its declaration to struct
94 * sock_timeval instead of struct timeval with a #define.
95 */
96 #define timeval sock_timeval
97
98 /* Include Windows headers */
99 #include <windows.h>
100 #include <winsock2.h>
101 #include <ws2tcpip.h>
102
103 #undef timeval /* see sock_timeval #define and comment above */
104
105 /*
106 * Some definitions we are using are missing in the headers
107 * shipping with VC6. However, if the SDK is installed then the
108 * SDK's headers may declare the missing types. This is at least
109 * the case in the Oct 2001 SDK. That SDK and all subsequent
110 * versions also define the symbol _W64, so we can use that one
111 * to determine whether some types need to be defined, or not.
112 */
113 #ifdef _W64
114 /* VC6 can include wspiapi.h only if the SDK is installed */
115 #include <wspiapi.h>
116 #endif
117
118 #undef interface
119 #include <process.h>
120 #include <time.h> /* time_t for timeval decl */
121 #include <io.h>
122 #include <isc/strerror.h>
123
124 /* ---------------------------------------------------------------------
125 * Above this line are #include lines and the few #define lines
126 * needed before including headers.
127 */
128
129 struct timeval {
130 time_t tv_sec;
131 long tv_usec;
132 };
133
134 /*
135 * ntohl and friends are actual functions on Windows, use our own
136 * macros instead to save the function call overhead. All releases
137 * of Windows are little-endian.
138 */
139 #ifdef ntohl
140 #error ntohl is already defined in ports/winnt/include/config.h
141 #else
142 #define ntohl(ul) (((u_long)(ul) & 0xff) << 24 | \
143 ((u_long)(ul) & 0xff00) << 8 | \
144 ((u_long)(ul) & 0xff0000) >> 8 | \
145 ((u_long)(ul) & 0xff000000) >> 24)
146 #define htonl(ul) ntohl(ul)
147 #define ntohs(us) ((u_short) \
148 (((u_short)(us) & 0xff) << 8 | \
149 ((u_short)(us) & 0xff00) >> 8))
150 #define htons(us) ntohs(us)
151 #endif
152
153 /*
154 * On Unix open() works for tty (serial) devices just fine, while on
155 * Windows refclock serial devices are opened using CreateFile, a lower
156 * level than the CRT-provided descriptors, because the C runtime lacks
157 * tty APIs. For refclocks which wish to use open() as well as or
158 * instead of refclock_open(), tty_open() is equivalent to open() on
159 * Unix and implemented in the Windows port similarly to
160 * refclock_open().
161 */
162 extern int tty_open(const char *, int, int);
163
164 /*
165 * disable use of __declspec(dllexport) by libisc routines
166 */
167 #define ISC_STATIC_WIN 1
168
169 /*
170 * ntp_rfc2553.h has cruft under #ifdef SYS_WINNT which is
171 * appropriate for older Microsoft IPv6 definitions, such
172 * as in_addr6 being the struct type. We can differentiate
173 * the RFC2553-compliant newer headers because they have
174 * #define in_addr6 in6_addr
175 * for backward compatibility. With the newer headers,
176 * we define ISC_PLATFORM_HAVEIPV6 and disable the cruft.
177 */
178 #ifdef in_addr6
179 #define WANT_IPV6
180 #define ISC_PLATFORM_HAVEIPV6
181 #define ISC_PLATFORM_HAVESCOPEID
182 #define HAVE_STRUCT_SOCKADDR_STORAGE
183 #define ISC_PLATFORM_HAVEIN6PKTINFO
184 #endif /* in_addr6 / RFC2553-compliant IPv6 headers */
185
186 #define NO_OPTION_NAME_WARNINGS
187
188 #if !defined( _W64 )
189 /*
190 * if ULONG_PTR needs to be defined then the build environment
191 * is pure 32 bit Windows. Since ULONG_PTR and DWORD have
192 * the same size in 32 bit Windows we can safely define
193 * a replacement.
194 */
195 typedef DWORD ULONG_PTR;
196 /* VC6 doesn't know about socklen_t, except if the SDK is installed */
197 typedef int socklen_t;
198 #endif /* _W64 */
199
200 #define ISC_PLATFORM_NEEDIN6ADDRANY
201 #define HAVE_SOCKADDR_IN6
202
203 /*
204 * The type of the socklen_t defined for getnameinfo() and getaddrinfo()
205 * is int for VS compilers on Windows but the type is already declared
206 */
207 #define GETSOCKNAME_SOCKLEN_TYPE socklen_t
208
209 /*
210 * Older SDKs do not define SO_EXCLUSIVEADDRUSE in winsock2.h
211 */
212 #ifndef SO_EXCLUSIVEADDRUSE
213 #define SO_EXCLUSIVEADDRUSE ((int)(~SO_REUSEADDR))
214 #endif
215
216 #if defined _MSC_VER && _MSC_VER < 1400
217 /*
218 * Use 32-bit time definitions for versions prior to VS 2005
219 * VS 2005 defaults to 64-bit time
220 */
221 # define SIZEOF_TIME_T 4
222 #else
223 # define SIZEOF_TIME_T 8
224 #endif
225
226
227 /*
228 * An attempt to cut down the number of warnings generated during compilation.
229 * All of these should be benign to disable.
230 */
231
232 #pragma warning(disable: 4100) /* unreferenced formal parameter */
233 #pragma warning(disable: 4127) /* conditional expression is constant */
234 #pragma warning(disable: 4996) /* more secure replacement available */
235
236 /*
237 * Windows NT Configuration Values
238 */
239 #if defined _DEBUG /* Use VC standard macro definitions */
240 # define DEBUG 1
241 #endif
242
243 #define __windows__ 1
244 /* Define if you have the ANSI C header files. */
245 #define STDC_HEADERS 1
246
247 #define OPEN_BCAST_SOCKET 1 /* for ntp_io.c */
248 #define TYPEOF_IP_MULTICAST_LOOP BOOL
249 #define SETSOCKOPT_ARG_CAST (const char *)
250 #define HAVE_RANDOM
251 #define SAVECONFIG 1
252
253 /*
254 * Multimedia timer enable
255 */
256 #define USE_MM_TIMER
257
258 /* check for OpenSSL */
259 #ifdef OPENSSL
260 # define USE_OPENSSL_CRYPTO_RAND 1
261 # define AUTOKEY
262 # define HAVE_OPENSSL_CMAC_H
263 # define ENABLE_CMAC
264 #endif
265 extern void arc4random_buf(void *buf, size_t nbytes);
266
267 /*
268 * Keywords and functions that Microsoft maps
269 * to other names
270 */
271 #define inline __inline
272 #define stricmp _stricmp
273 #define strcasecmp _stricmp
274 #define isascii __isascii
275 #define finite _finite
276 #define random rand
277 #define srandom srand
278 #define fdopen _fdopen
279 #define read _read
280 #define open _open
281 #ifndef close
282 #define close _close
283 #endif
284 #define write _write
285 #define strdup _strdup
286 #define alloca _alloca
287 #define stat _stat /*struct stat from <sys/stat.h> */
288 #define fstat _fstat
289 #define unlink _unlink
290 /*
291 * punt on fchmod on Windows
292 */
293 #define fchmod(x,y) {}
294 #define lseek _lseek
295 #define pipe _pipe
296 #define dup2 _dup2
297 /*
298 * scale, unix sleep is seconds, Windows Sleep is msec
299 */
300 #define sleep(x) Sleep((unsigned)(x) * 1000)
301 #define fileno _fileno
302 #define isatty _isatty
303 #define mktemp _mktemp
304 #define getpid _getpid
305 #define timegm _mkgmtime
306 #define errno_to_str isc__strerror
307 /*
308 * symbol returning the name of the current function
309 */
310 #define __func__ __FUNCTION__
311
312 typedef int pid_t; /* PID is an int */
313 typedef int ssize_t; /* ssize is an int */
314
315 /*
316 * Map the stream to the file number
317 */
318 #define STDOUT_FILENO _fileno(stdout)
319 #define STDERR_FILENO _fileno(stderr)
320
321 /*
322 * To minimize Windows-specific changes to the rest of the NTP code,
323 * particularly reference clocks, ntp_stdlib.h will
324 *
325 * #define strerror(e) ntp_strerror(e)
326 *
327 * to deal with our mixture of C runtime (open, write) and Windows
328 * (sockets, serial ports) error codes. This is an ugly hack because
329 * both use the lowest values differently, but particularly for ntpd,
330 * it's not a problem.
331 */
332 #define NTP_REDEFINE_STRERROR
333
334 #define MCAST /* Enable Multicast Support */
335 #define MULTICAST_NONEWSOCKET /* Don't create a new socket for mcast address */
336
337 # define REFCLOCK /* from ntpd.mak */
338
339 /* #define CLOCK_PARSE */
340 #define CLOCK_ACTS
341 #define CLOCK_ARBITER
342 #define CLOCK_ARCRON_MSF
343 #define OWN_PPS_NTP_TIMESTAMP_FROM_COUNTER /* timepps.h */
344 #define HAVE_TIMEPPS_H
345 #define HAVE_PPSAPI
346 #define CLOCK_ATOM
347 #define CLOCK_CHU
348 #define CLOCK_CHRONOLOG
349 #define CLOCK_DUMBCLOCK
350 #define CLOCK_HOPF_SERIAL /* device 38, hopf DCF77/GPS serial line receiver */
351 #define CLOCK_HOPF_PCI /* device 39, hopf DCF77/GPS PCI-Bus receiver */
352 #define CLOCK_JUPITER
353 #define CLOCK_LOCAL
354 #define CLOCK_NMEA
355 #define CLOCK_ONCORE
356 #define CLOCK_PALISADE /* from ntpd.mak */
357 #define CLOCK_PARSE
358 /* parse component drivers */
359 #define CLOCK_COMPUTIME
360 #define CLOCK_DCF7000
361 #define CLOCK_HOPF6021
362 #define CLOCK_MEINBERG
363 #define CLOCK_RAWDCF
364 #define CLOCK_RCC8000
365 #define CLOCK_SCHMID
366 #define CLOCK_TRIMTAIP
367 #define CLOCK_TRIMTSIP
368 #define CLOCK_VARITEXT
369 #define CLOCK_WHARTON_400A
370 /* end parse component drivers */
371 /* # define CLOCK_SHM */
372 #define CLOCK_SPECTRACOM /* refclock_wwvb.c */
373 #define CLOCK_TRIMBLEDC
374 #define CLOCK_TRUETIME
375
376 #define NTP_LITTLE_ENDIAN /* from libntp.mak */
377 #define NTP_POSIX_SOURCE
378
379 #define SYSLOG_FILE /* from libntp.mak */
380
381 #define HAVE_LONG_LONG_INT 1
382 #define HAVE_UNSIGNED_LONG_LONG_INT 1
383 #define HAVE_SIZE_T 1
384 #define HAVE_PTRDIFF_T 1
385
386 #if defined(_MSC_VER) && _MSC_VER >= 1900
387 #define HAVE_WINT_T 1
388 #endif
389
390 # define SIZEOF_SIGNED_CHAR 1
391 # define SIZEOF_SHORT 2
392 # define SIZEOF_INT 4
393 # define SIZEOF_LONG 4
394 # define SIZEOF_LONG_LONG 8
395
396 /* libntp/snprintf.c doesn't know %I64d */
397 #define ISC_PLATFORM_QUADFORMAT "ll"
398
399 # define HAVE_ERRNO_H 1
400 # define HAVE_FCNTL_H 1
401 # define HAVE_LIMITS_H 1
402 # define HAVE_STDARG_H 1
403 # define HAVE_SYS_RESOURCE_H 1
404 # define HAVE_SYS_TIME_H 1
405 # define HAVE_TERMIOS_H 1
406
407 # define HAVE_ALLOCA 1
408 # define HAVE_GETCLOCK 1
409 # define HAVE_MEMMOVE 1
410 # define HAVE_MKTIME 1
411 # define HAVE_SETVBUF 1
412 # define HAVE_STRCHR 1 /* for libopts */
413 # define HAVE_STRDUP 1
414 # define HAVE_STRNLEN 1
415 # define HAVE_MEMCHR 1
416 # define HAVE_TIMEGM 1 /* actually _mkgmtime */
417
418 # define HAVE_STRUCT_TIMESPEC
419 # define HAVE_IO_COMPLETION_PORT
420 # define ISC_PLATFORM_NEEDNTOP
421 # define ISC_PLATFORM_NEEDPTON
422
423 #define HAVE_BSD_NICE /* emulate BSD setpriority() */
424
425 #define HW_WANT_RPL_VSNPRINTF 1
426 #define vsnprintf rpl_vsnprintf
427 #include <stdarg.h>
428 int rpl_vsnprintf(char *, size_t, const char *, va_list);
429 #define HW_WANT_RPL_SNPRINTF 1
430 #define snprintf rpl_snprintf
431 int rpl_snprintf(char *, size_t, const char *, ...);
432 #define HAVE_VSNPRINTF 1
433 #define HAVE_SNPRINTF 1
434
435 typedef char *caddr_t;
436
437 #ifdef _WCTYPE_T_DEFINED /* see vc/include/crtdefs.h */
438 #define HAVE_WINT_T 1
439 #endif
440
441 #ifndef _INTPTR_T_DEFINED
442 typedef long intptr_t;
443 #define _INTPTR_T_DEFINED
444 #endif
445 #define HAVE_INTPTR_T 1
446
447 #ifndef _UINTPTR_T_DEFINED
448 typedef unsigned long uintptr_t;
449 #define _UINTPTR_T_DEFINED
450 #endif
451 #define HAVE_UINTPTR_T 1
452
453 #if !defined( _W64 )
454 /*
455 * if DWORD_PTR needs to be defined then the build environment
456 * is pure 32 bit Windows. Since DWORD_PTR and DWORD have
457 * the same size in 32 bit Windows we can safely define
458 * a replacement.
459 */
460 typedef DWORD DWORD_PTR;
461 #endif
462
463 #define NEED_S_CHAR_TYPEDEF
464
465
466 /* C99 exact size integer support. */
467 #if defined(_MSC_VER) && _MSC_VER<1800
468 # define MISSING_INTTYPES_H 1 /* not provided by VS2012 and earlier */
469 # define MISSING_STDBOOL_H 1 /* not provided by VS2012 and earlier */
470 # define MISSING_C99_STRUCT_INIT 1 /* see [Bug 2728] */
471 #else
472 #if defined(_MSC_VER) && _MSC_VER>=1800
473 /* VS2013 and above support C99 types */
474 # define HAVE_INT8_T 1
475 # define HAVE_UINT8_T 1
476 # define HAVE_INT16_T 1
477 # define HAVE_UINT16_T 1
478 # define HAVE_INT32_T 1
479 # define HAVE_UINT32_T 1
480 #endif
481 #endif
482
483 #if !defined (MISSING_STDBOOL_H)
484 # define HAVE_STDBOOL_H
485 #endif
486 #if !defined(MISSING_INTTYPES_H)
487 # define HAVE_INTTYPES_H 1
488 #elif !defined(MISSING_STDINT_H)
489 # define HAVE_STDINT_H 1
490 #elif !defined(ADDED_EXACT_SIZE_INTEGERS)
491 # define ADDED_EXACT_SIZE_INTEGERS 1
492 typedef __int8 int8_t;
493 typedef unsigned __int8 uint8_t;
494
495 typedef __int16 int16_t;
496 typedef unsigned __int16 uint16_t;
497
498 typedef __int32 int32_t;
499 typedef unsigned __int32 uint32_t;
500
501 typedef __int64 int64_t;
502 typedef unsigned __int64 uint64_t;
503 #endif
504
505
506 /* Directory separator, usually / or \ */
507 #define DIR_SEP '\\'
508
509 #define POSIX_SHELL "/bin/sh" /* libopts/makeshell.c */
510
511 #define ULONG_CONST(a) a ## UL
512
513 #define NOKMEM
514 #define RETSIGTYPE void
515
516 #ifndef STR_SYSTEM
517 #define STR_SYSTEM "Windows"
518 #endif
519
520 #ifndef STR_PROCESSOR
521
522 #define STRINGIZE(arg) #arg
523
524 #ifdef _M_IX86
525 #ifndef _M_IX86_FP
526 #define STR_PROCESSOR "x86"
527 #else
528 #if !_M_IX86_FP
529 #define STR_PROCESSOR "x86"
530 #else
531 #if _M_IX86_FP > 2
532 #define STR_PROCESSOR "x86-FP-" STRINGIZE(_M_IX86_FP)
533 #else
534 #if _M_IX86_FP == 2
535 #define STR_PROCESSOR "x86-SSE2"
536 #else
537 #define STR_PROCESSOR "x86-SSE"
538 #endif /* _M_IX86 == 2 */
539 #endif /* _M_IX86_FP > 2 */
540 #endif /* !_M_IX86_FP */
541 #endif /* !defined(_M_IX86_FP) */
542 #endif /* !defined(_M_IX86) */
543
544 #ifdef _M_IA64
545 #define STR_PROCESSOR "Itanium"
546 #endif
547
548 #ifdef _M_X64
549 #define STR_PROCESSOR "x64"
550 #endif
551
552 #endif /* !defined(STR_PROCESSOR) */
553
554 #undef STRINGIZE
555
556 #define SIOCGIFFLAGS SIO_GET_INTERFACE_LIST /* used in ntp_io.c */
557
558 /* Bug 2978 mitigation -- unless defined elsewhere, do it here*/
559 #ifndef DYNAMIC_INTERLEAVE
560 # define DYNAMIC_INTERLEAVE 0
561 #endif
562
563 /*
564 * Below this line are includes which must happen after the bulk of
565 * config.h is processed. If you need to add another #include to this
566 * file the preferred location is near the top, above the similar
567 * line of hyphens.
568 * ---------------------------------------------------------------------
569 */
570
571 /*
572 * Include standard stat information
573 */
574 #include <isc/stat.h>
575
576 #endif /* CONFIG_H */