]> The Tcpdump Group git mirrors - tcpdump/blob - tcpdump-stdinc.h
From Hank Leininger <[email protected]>: fix a typo.
[tcpdump] / tcpdump-stdinc.h
1 /*
2 * Copyright (c) 2002
3 * Politecnico di Torino. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that: (1) source code distributions
7 * retain the above copyright notice and this paragraph in its entirety, (2)
8 * distributions including binary code include the above copyright notice and
9 * this paragraph in its entirety in the documentation or other materials
10 * provided with the distribution, and (3) all advertising materials mentioning
11 * features or use of this software display the following acknowledgement:
12 * ``This product includes software developed by the Politecnico
13 * di Torino, and its contributors.'' Neither the name of
14 * the University nor the names of its contributors may be used to endorse
15 * or promote products derived from this software without specific prior
16 * written permission.
17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
18 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
20 *
21 * @(#) $Header: /tcpdump/master/tcpdump/tcpdump-stdinc.h,v 1.5 2003-03-22 06:30:39 guy Exp $ (LBL)
22 */
23
24 /*
25 * Include the appropriate OS header files on Windows and various flavors
26 * of UNIX, and also define some additional items and include various
27 * non-OS header files on Windows, and; this isolates most of the platform
28 * differences to this one file.
29 */
30
31 #ifndef tcpdump_stdinc_h
32 #define tcpdump_stdinc_h
33
34 #ifdef WIN32
35
36 #include <stdio.h>
37 #include <winsock2.h>
38 #include "bittypes.h"
39 #include <ctype.h>
40 #include <time.h>
41 #include <io.h>
42 #include "IP6_misc.h"
43 #include <fcntl.h>
44
45 #ifdef __MINGW32__
46 #include <stdint.h>
47 int* _errno();
48 #define errno (*_errno())
49
50 #define INET_ADDRSTRLEN 16
51 #define INET6_ADDRSTRLEN 46
52
53 #endif /* __MINGW32__ */
54
55 #ifndef toascii
56 #define toascii(c) ((c) & 0x7f)
57 #endif
58
59 #ifndef caddr_t
60 typedef char* caddr_t;
61 #endif /* caddr_t */
62
63 #define MAXHOSTNAMELEN 64
64 #define NI_MAXHOST 1025
65 #define IPPROTO_EGP 8 /* Exterior Gateway Protocol */
66 #define snprintf _snprintf
67 #define vsnprintf _vsnprintf
68 #define RETSIGTYPE void
69
70 #if !defined(__MINGW32__) && !defined(__WATCOMC__)
71 #undef toascii
72 #define isascii __isascii
73 #define toascii __toascii
74 #define stat _stat
75 #define open _open
76 #define fstat _fstat
77 #define read _read
78 #define O_RDONLY _O_RDONLY
79
80 typedef short ino_t;
81 #endif /* __MINGW32__ */
82
83 #else /* WIN32 */
84
85 #include <ctype.h>
86 #include <unistd.h>
87 #include <netdb.h>
88 #include <sys/param.h>
89 #include <sys/types.h> /* concession to AIX */
90 #include <sys/time.h>
91 #include <sys/socket.h>
92 #include <netinet/in.h>
93
94 #ifdef TIME_WITH_SYS_TIME
95 #include <time.h>
96 #endif
97
98 #include <arpa/inet.h>
99
100 #endif /* WIN32 */
101
102 #ifdef INET6
103 #include "ip6.h"
104 #endif
105
106 #if defined(WIN32) || defined(MSDOS)
107 #define FOPEN_READ_TXT "rt"
108 #define FOPEN_READ_BIN "rb"
109 #define FOPEN_WRITE_TXT "wt"
110 #define FOPEN_WRITE_BIN "wb"
111 #else
112 #define FOPEN_READ_TXT "r"
113 #define FOPEN_READ_BIN FOPEN_READ_TXT
114 #define FOPEN_WRITE_TXT "w"
115 #define FOPEN_WRITE_BIN FOPEN_WRITE_TXT
116 #endif
117
118 #endif /* tcpdump_stdinc_h */