Merge from vendor branch OPENSSL:
[dragonfly.git] / contrib / tcpdump-3.8.3 / tcpdump-stdinc.h
1 /*
2  * Copyright (c) 2002 - 2003
3  * NetGroup, Politecnico di Torino (Italy)
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  * @(#) $Header: /tcpdump/master/tcpdump/tcpdump-stdinc.h,v 1.7.2.1 2003/11/16 09:57:50 guy Exp $ (LBL)
33  */
34
35 /*
36  * Include the appropriate OS header files on Windows and various flavors
37  * of UNIX, and also define some additional items and include various
38  * non-OS header files on Windows, and; this isolates most of the platform
39  * differences to this one file.
40  */
41
42 #ifndef tcpdump_stdinc_h
43 #define tcpdump_stdinc_h
44
45 #ifdef WIN32
46
47 #include <stdio.h>
48 #include <winsock2.h>
49 #include "bittypes.h"
50 #include <ctype.h>
51 #include <time.h>
52 #include <io.h>
53 #include "IP6_misc.h"
54 #include <fcntl.h>
55
56 #ifdef __MINGW32__
57 #include <stdint.h>
58 int* _errno();
59 #define errno (*_errno())
60
61 #define INET_ADDRSTRLEN 16
62 #define INET6_ADDRSTRLEN 46
63
64 #endif /* __MINGW32__ */
65
66 #ifndef toascii
67 #define toascii(c) ((c) & 0x7f)
68 #endif
69
70 #ifndef caddr_t
71 typedef char* caddr_t;
72 #endif /* caddr_t */
73
74 #define MAXHOSTNAMELEN  64
75 #define NI_MAXHOST      1025
76 #define snprintf _snprintf
77 #define vsnprintf _vsnprintf
78 #define RETSIGTYPE void
79
80 #if !defined(__MINGW32__) && !defined(__WATCOMC__)
81 #undef toascii
82 #define isascii __isascii
83 #define toascii __toascii
84 #define stat _stat
85 #define open _open
86 #define fstat _fstat
87 #define read _read
88 #define O_RDONLY _O_RDONLY
89
90 typedef short ino_t;
91 #endif /* __MINGW32__ */
92
93 #else /* WIN32 */
94
95 #include <ctype.h>
96 #include <unistd.h>
97 #include <netdb.h>
98 #include <sys/param.h>
99 #include <sys/types.h>                  /* concession to AIX */
100 #include <sys/time.h>
101 #include <sys/socket.h>
102 #include <netinet/in.h>
103
104 #ifdef TIME_WITH_SYS_TIME
105 #include <time.h>
106 #endif
107
108 #include <arpa/inet.h>
109
110 #endif /* WIN32 */
111
112 #ifdef INET6
113 #include "ip6.h"
114 #endif
115
116 #if defined(WIN32) || defined(MSDOS)
117   #define FOPEN_READ_TXT   "rt"
118   #define FOPEN_READ_BIN   "rb"
119   #define FOPEN_WRITE_TXT  "wt"
120   #define FOPEN_WRITE_BIN  "wb"
121 #else
122   #define FOPEN_READ_TXT   "r"
123   #define FOPEN_READ_BIN   FOPEN_READ_TXT
124   #define FOPEN_WRITE_TXT  "w"
125   #define FOPEN_WRITE_BIN  FOPEN_WRITE_TXT
126 #endif
127
128 #endif /* tcpdump_stdinc_h */