2 * Copyright (c) 2002 - 2003
3 * NetGroup, Politecnico di Torino (Italy)
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 * @(#) $Header: /tcpdump/master/tcpdump/tcpdump-stdinc.h,v 1.17 2006-05-19 17:55:34 hannes Exp $ (LBL)
37 * Include the appropriate OS header files on Windows and various flavors
38 * of UNIX, and also define some additional items and include various
39 * non-OS header files on Windows, and; this isolates most of the platform
40 * differences to this one file.
43 #ifndef tcpdump_stdinc_h
44 #define tcpdump_stdinc_h
56 #include <sys/types.h>
57 #include <net/netdb.h> /* in wpcap's Win32/include */
59 #if !defined(__MINGW32__) && !defined(__WATCOMC__)
61 #define isascii __isascii
62 #define toascii __toascii
68 #define O_RDONLY _O_RDONLY
71 #endif /* __MINGW32__ */
77 /* Protos for missing/x.c functions (ideally <missing/addrinfo.h>
78 * should be used, but it clashes with <ws2tcpip.h>).
80 extern const char *inet_ntop (int, const void *, char *, size_t);
81 extern int inet_pton (int, const char *, void *);
82 extern int inet_aton (const char *cp, struct in_addr *addr);
84 #ifndef INET6_ADDRSTRLEN
85 #define INET6_ADDRSTRLEN 46
89 #define toascii(c) ((c) & 0x7f)
93 typedef char* caddr_t;
96 #define MAXHOSTNAMELEN 64
97 #define NI_MAXHOST 1025
98 #define snprintf _snprintf
99 #define vsnprintf _vsnprintf
100 #define RETSIGTYPE void
108 #include <inttypes.h>
114 #ifdef HAVE_SYS_BITYPES_H
115 #include <sys/bitypes.h>
117 #include <sys/param.h>
118 #include <sys/types.h> /* concession to AIX */
119 #include <sys/time.h>
120 #include <sys/socket.h>
121 #include <netinet/in.h>
123 #ifdef TIME_WITH_SYS_TIME
127 #include <arpa/inet.h>
135 #if defined(WIN32) || defined(MSDOS)
136 #define FOPEN_READ_TXT "rt"
137 #define FOPEN_READ_BIN "rb"
138 #define FOPEN_WRITE_TXT "wt"
139 #define FOPEN_WRITE_BIN "wb"
141 #define FOPEN_READ_TXT "r"
142 #define FOPEN_READ_BIN FOPEN_READ_TXT
143 #define FOPEN_WRITE_TXT "w"
144 #define FOPEN_WRITE_BIN FOPEN_WRITE_TXT
147 #ifndef INET_ADDRSTRLEN
148 #define INET_ADDRSTRLEN 16
159 #endif /* tcpdump_stdinc_h */