]>
The Tcpdump Group git mirrors - libpcap/blob - pcap-stdinc.h
2 * Copyright (c) 2002 - 2005 NetGroup, Politecnico di Torino (Italy)
3 * Copyright (c) 2005 - 2009 CACE Technologies, Inc. Davis (California)
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. Neither the name of the Politecnico di Torino nor the names of its
16 * contributors may be used to endorse or promote products derived from
17 * this software without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 * Copyright (C) 1999 WIDE Project.
34 * All rights reserved.
36 * Redistribution and use in source and binary forms, with or without
37 * modification, are permitted provided that the following conditions
39 * 1. Redistributions of source code must retain the above copyright
40 * notice, this list of conditions and the following disclaimer.
41 * 2. Redistributions in binary form must reproduce the above copyright
42 * notice, this list of conditions and the following disclaimer in the
43 * documentation and/or other materials provided with the distribution.
44 * 3. Neither the name of the project nor the names of its contributors
45 * may be used to endorse or promote products derived from this software
46 * without specific prior written permission.
48 * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
49 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
50 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
51 * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
52 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
53 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
54 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
55 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
56 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
57 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
64 * Avoids a compiler warning in case this was already defined
65 * (someone defined _WINSOCKAPI_ when including 'windows.h', in order
66 * to prevent it from including 'winsock.h')
86 * VS 2015 or newer; we have snprintf() function.
93 * VS 2013 or newer; we have <inttypes.h>.
97 #define u_int8_t uint8_t
98 #define u_int16_t uint16_t
99 #define u_int32_t uint32_t
100 #define u_int64_t uint64_t
103 * Earlier VS; we have to define this stuff ourselves.
105 #ifndef HAVE_U_INT8_T
106 typedef unsigned char u_int8_t
;
107 typedef signed char int8_t;
110 #ifndef HAVE_U_INT16_T
111 typedef unsigned short u_int16_t
;
112 typedef signed short int16_t;
115 #ifndef HAVE_U_INT32_T
116 typedef unsigned int u_int32_t
;
117 typedef signed int int32_t;
120 #ifndef HAVE_U_INT64_T
121 #ifdef _MSC_EXTENSIONS
122 typedef unsigned _int64 u_int64_t
;
123 typedef _int64
int64_t;
124 #else /* _MSC_EXTENSIONS */
125 typedef unsigned long long u_int64_t
;
126 typedef long long int64_t;
130 #elif defined(__MINGW32__)
135 * These may be defined by <inttypes.h>.
137 * XXX - for MSVC, we always want the _MSC_EXTENSIONS versions.
138 * What about other compilers? If, as the MinGW Web site says MinGW
139 * does, the other compilers just use Microsoft's run-time library,
140 * then they should probably use the _MSC_EXTENSIONS even if the
141 * compiler doesn't define _MSC_EXTENSIONS.
144 #ifdef _MSC_EXTENSIONS
145 #define PRId64 "I64d"
152 #ifdef _MSC_EXTENSIONS
153 #define PRIo64 "I64o"
160 #ifdef _MSC_EXTENSIONS
161 #define PRIx64 "I64x"
168 #ifdef _MSC_EXTENSIONS
169 #define PRIu64 "I64u"
176 #define strdup _strdup
179 #if !defined(__cplusplus)
180 #define inline __inline
183 #endif /* pcap_stdinc_h */