]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/libpcap/pcap-stdinc.h
MFC r313695, r313760, r314769, r314863, r314865, r316125
[FreeBSD/FreeBSD.git] / contrib / libpcap / pcap-stdinc.h
1 /*
2  * Copyright (c) 2002 - 2005 NetGroup, Politecnico di Torino (Italy)
3  * Copyright (c) 2005 - 2009 CACE Technologies, Inc. Davis (California)
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  *
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.
18  *
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.
30  */
31
32 /*
33  * Copyright (C) 1999 WIDE Project.
34  * All rights reserved.
35  *
36  * Redistribution and use in source and binary forms, with or without
37  * modification, are permitted provided that the following conditions
38  * are met:
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.
47  *
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
58  * SUCH DAMAGE.
59  */
60 #ifndef pcap_stdinc_h
61 #define pcap_stdinc_h
62
63 /*
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')
67  */
68 #ifdef _WINSOCKAPI_
69 #undef _WINSOCKAPI_
70 #endif
71
72 #include <winsock2.h>
73 #include <fcntl.h>
74 #include <time.h>
75 #include <io.h>
76
77 #include <ws2tcpip.h>
78
79 #if defined(_MSC_VER)
80   /*
81    * MSVC.
82    */
83   #if _MSC_VER >= 1800
84     /*
85      * VS 2013 or newer; we have <inttypes.h>.
86      */
87     #include <inttypes.h>
88
89     #define u_int8_t uint8_t
90     #define u_int16_t uint16_t
91     #define u_int32_t uint32_t
92     #define u_int64_t uint64_t
93   #else
94     /*
95      * Earlier VS; we have to define this stuff ourselves.
96      */
97     #ifndef HAVE_U_INT8_T
98       typedef unsigned char u_int8_t;
99       typedef signed char int8_t;
100     #endif
101
102     #ifndef HAVE_U_INT16_T
103       typedef unsigned short u_int16_t;
104       typedef signed short int16_t;
105     #endif
106
107     #ifndef HAVE_U_INT32_T
108       typedef unsigned int u_int32_t;
109       typedef signed int int32_t;
110     #endif
111
112     #ifndef HAVE_U_INT64_T
113       #ifdef _MSC_EXTENSIONS
114         typedef unsigned _int64 u_int64_t;
115         typedef _int64 int64_t;
116       #else /* _MSC_EXTENSIONS */
117         typedef unsigned long long u_int64_t;
118         typedef long long int64_t;
119       #endif
120     #endif
121   #endif
122 #elif defined(__MINGW32__)
123   #include <stdint.h>
124 #endif
125
126 #endif /* pcap_stdinc_h */