sl@0
|
1 |
/*-
|
sl@0
|
2 |
* Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
|
sl@0
|
3 |
* The Regents of the University of California. All rights reserved.
|
sl@0
|
4 |
*
|
sl@0
|
5 |
* This code is derived from the Stanford/CMU enet packet filter,
|
sl@0
|
6 |
* (net/enet.c) distributed as part of 4.3BSD, and code contributed
|
sl@0
|
7 |
* to Berkeley by Steven McCanne and Van Jacobson both of Lawrence
|
sl@0
|
8 |
* Berkeley Laboratory.
|
sl@0
|
9 |
*
|
sl@0
|
10 |
* Redistribution and use in source and binary forms, with or without
|
sl@0
|
11 |
* modification, are permitted provided that the following conditions
|
sl@0
|
12 |
* are met:
|
sl@0
|
13 |
* 1. Redistributions of source code must retain the above copyright
|
sl@0
|
14 |
* notice, this list of conditions and the following disclaimer.
|
sl@0
|
15 |
* 2. Redistributions in binary form must reproduce the above copyright
|
sl@0
|
16 |
* notice, this list of conditions and the following disclaimer in the
|
sl@0
|
17 |
* documentation and/or other materials provided with the distribution.
|
sl@0
|
18 |
* 3. All advertising materials mentioning features or use of this software
|
sl@0
|
19 |
* must display the following acknowledgement:
|
sl@0
|
20 |
* This product includes software developed by the University of
|
sl@0
|
21 |
* California, Berkeley and its contributors.
|
sl@0
|
22 |
* 4. Neither the name of the University nor the names of its contributors
|
sl@0
|
23 |
* may be used to endorse or promote products derived from this software
|
sl@0
|
24 |
* without specific prior written permission.
|
sl@0
|
25 |
*
|
sl@0
|
26 |
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
sl@0
|
27 |
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
sl@0
|
28 |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
sl@0
|
29 |
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
sl@0
|
30 |
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
sl@0
|
31 |
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
sl@0
|
32 |
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
sl@0
|
33 |
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
sl@0
|
34 |
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
sl@0
|
35 |
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
sl@0
|
36 |
* SUCH DAMAGE.
|
sl@0
|
37 |
*
|
sl@0
|
38 |
* @(#)bpf.h 7.1 (Berkeley) 5/7/91
|
sl@0
|
39 |
*
|
sl@0
|
40 |
* @(#) $Header: /tcpdump/master/libpcap/pcap-bpf.h,v 1.34.2.11 2006/07/27 21:06:17 gianluca Exp $ (LBL)
|
sl@0
|
41 |
*/
|
sl@0
|
42 |
|
sl@0
|
43 |
/*
|
sl@0
|
44 |
* This is libpcap's cut-down version of bpf.h; it includes only
|
sl@0
|
45 |
* the stuff needed for the code generator and the userland BPF
|
sl@0
|
46 |
* interpreter, and the libpcap APIs for setting filters, etc..
|
sl@0
|
47 |
*
|
sl@0
|
48 |
* "pcap-bpf.c" will include the native OS version, as it deals with
|
sl@0
|
49 |
* the OS's BPF implementation.
|
sl@0
|
50 |
*
|
sl@0
|
51 |
* XXX - should this all just be moved to "pcap.h"?
|
sl@0
|
52 |
*/
|
sl@0
|
53 |
|
sl@0
|
54 |
#ifndef BPF_MAJOR_VERSION
|
sl@0
|
55 |
|
sl@0
|
56 |
#ifdef __cplusplus
|
sl@0
|
57 |
extern "C" {
|
sl@0
|
58 |
#endif
|
sl@0
|
59 |
|
sl@0
|
60 |
/* BSD style release date */
|
sl@0
|
61 |
#define BPF_RELEASE 199606
|
sl@0
|
62 |
|
sl@0
|
63 |
#ifdef MSDOS /* must be 32-bit */
|
sl@0
|
64 |
typedef long bpf_int32;
|
sl@0
|
65 |
typedef unsigned long bpf_u_int32;
|
sl@0
|
66 |
#else
|
sl@0
|
67 |
typedef int bpf_int32;
|
sl@0
|
68 |
typedef u_int bpf_u_int32;
|
sl@0
|
69 |
#endif
|
sl@0
|
70 |
|
sl@0
|
71 |
/*
|
sl@0
|
72 |
* Alignment macros. BPF_WORDALIGN rounds up to the next
|
sl@0
|
73 |
* even multiple of BPF_ALIGNMENT.
|
sl@0
|
74 |
*/
|
sl@0
|
75 |
#ifndef __NetBSD__
|
sl@0
|
76 |
#define BPF_ALIGNMENT sizeof(bpf_int32)
|
sl@0
|
77 |
#else
|
sl@0
|
78 |
#define BPF_ALIGNMENT sizeof(long)
|
sl@0
|
79 |
#endif
|
sl@0
|
80 |
#define BPF_WORDALIGN(x) (((x)+(BPF_ALIGNMENT-1))&~(BPF_ALIGNMENT-1))
|
sl@0
|
81 |
|
sl@0
|
82 |
#define BPF_MAXINSNS 512
|
sl@0
|
83 |
#define BPF_MAXBUFSIZE 0x8000
|
sl@0
|
84 |
#define BPF_MINBUFSIZE 32
|
sl@0
|
85 |
|
sl@0
|
86 |
/*
|
sl@0
|
87 |
* Structure for "pcap_compile()", "pcap_setfilter()", etc..
|
sl@0
|
88 |
*/
|
sl@0
|
89 |
struct bpf_program {
|
sl@0
|
90 |
u_int bf_len;
|
sl@0
|
91 |
struct bpf_insn *bf_insns;
|
sl@0
|
92 |
};
|
sl@0
|
93 |
|
sl@0
|
94 |
/*
|
sl@0
|
95 |
* Struct return by BIOCVERSION. This represents the version number of
|
sl@0
|
96 |
* the filter language described by the instruction encodings below.
|
sl@0
|
97 |
* bpf understands a program iff kernel_major == filter_major &&
|
sl@0
|
98 |
* kernel_minor >= filter_minor, that is, if the value returned by the
|
sl@0
|
99 |
* running kernel has the same major number and a minor number equal
|
sl@0
|
100 |
* equal to or less than the filter being downloaded. Otherwise, the
|
sl@0
|
101 |
* results are undefined, meaning an error may be returned or packets
|
sl@0
|
102 |
* may be accepted haphazardly.
|
sl@0
|
103 |
* It has nothing to do with the source code version.
|
sl@0
|
104 |
*/
|
sl@0
|
105 |
struct bpf_version {
|
sl@0
|
106 |
u_short bv_major;
|
sl@0
|
107 |
u_short bv_minor;
|
sl@0
|
108 |
};
|
sl@0
|
109 |
/* Current version number of filter architecture. */
|
sl@0
|
110 |
#define BPF_MAJOR_VERSION 1
|
sl@0
|
111 |
#define BPF_MINOR_VERSION 1
|
sl@0
|
112 |
|
sl@0
|
113 |
/*
|
sl@0
|
114 |
* Data-link level type codes.
|
sl@0
|
115 |
*
|
sl@0
|
116 |
* Do *NOT* add new values to this list without asking
|
sl@0
|
117 |
* "tcpdump-workers@tcpdump.org" for a value. Otherwise, you run the
|
sl@0
|
118 |
* risk of using a value that's already being used for some other purpose,
|
sl@0
|
119 |
* and of having tools that read libpcap-format captures not being able
|
sl@0
|
120 |
* to handle captures with your new DLT_ value, with no hope that they
|
sl@0
|
121 |
* will ever be changed to do so (as that would destroy their ability
|
sl@0
|
122 |
* to read captures using that value for that other purpose).
|
sl@0
|
123 |
*/
|
sl@0
|
124 |
|
sl@0
|
125 |
/*
|
sl@0
|
126 |
* These are the types that are the same on all platforms, and that
|
sl@0
|
127 |
* have been defined by <net/bpf.h> for ages.
|
sl@0
|
128 |
*/
|
sl@0
|
129 |
#define DLT_NULL 0 /* BSD loopback encapsulation */
|
sl@0
|
130 |
#define DLT_EN10MB 1 /* Ethernet (10Mb) */
|
sl@0
|
131 |
#define DLT_EN3MB 2 /* Experimental Ethernet (3Mb) */
|
sl@0
|
132 |
#define DLT_AX25 3 /* Amateur Radio AX.25 */
|
sl@0
|
133 |
#define DLT_PRONET 4 /* Proteon ProNET Token Ring */
|
sl@0
|
134 |
#define DLT_CHAOS 5 /* Chaos */
|
sl@0
|
135 |
#define DLT_IEEE802 6 /* IEEE 802 Networks */
|
sl@0
|
136 |
#define DLT_ARCNET 7 /* ARCNET, with BSD-style header */
|
sl@0
|
137 |
#define DLT_SLIP 8 /* Serial Line IP */
|
sl@0
|
138 |
#define DLT_PPP 9 /* Point-to-point Protocol */
|
sl@0
|
139 |
#define DLT_FDDI 10 /* FDDI */
|
sl@0
|
140 |
|
sl@0
|
141 |
/*
|
sl@0
|
142 |
* These are types that are different on some platforms, and that
|
sl@0
|
143 |
* have been defined by <net/bpf.h> for ages. We use #ifdefs to
|
sl@0
|
144 |
* detect the BSDs that define them differently from the traditional
|
sl@0
|
145 |
* libpcap <net/bpf.h>
|
sl@0
|
146 |
*
|
sl@0
|
147 |
* XXX - DLT_ATM_RFC1483 is 13 in BSD/OS, and DLT_RAW is 14 in BSD/OS,
|
sl@0
|
148 |
* but I don't know what the right #define is for BSD/OS.
|
sl@0
|
149 |
*/
|
sl@0
|
150 |
#define DLT_ATM_RFC1483 11 /* LLC-encapsulated ATM */
|
sl@0
|
151 |
|
sl@0
|
152 |
#ifdef __OpenBSD__
|
sl@0
|
153 |
#define DLT_RAW 14 /* raw IP */
|
sl@0
|
154 |
#else
|
sl@0
|
155 |
#define DLT_RAW 12 /* raw IP */
|
sl@0
|
156 |
#endif
|
sl@0
|
157 |
|
sl@0
|
158 |
/*
|
sl@0
|
159 |
* Given that the only OS that currently generates BSD/OS SLIP or PPP
|
sl@0
|
160 |
* is, well, BSD/OS, arguably everybody should have chosen its values
|
sl@0
|
161 |
* for DLT_SLIP_BSDOS and DLT_PPP_BSDOS, which are 15 and 16, but they
|
sl@0
|
162 |
* didn't. So it goes.
|
sl@0
|
163 |
*/
|
sl@0
|
164 |
#if defined(__NetBSD__) || defined(__FreeBSD__)
|
sl@0
|
165 |
#ifndef DLT_SLIP_BSDOS
|
sl@0
|
166 |
#define DLT_SLIP_BSDOS 13 /* BSD/OS Serial Line IP */
|
sl@0
|
167 |
#define DLT_PPP_BSDOS 14 /* BSD/OS Point-to-point Protocol */
|
sl@0
|
168 |
#endif
|
sl@0
|
169 |
#else
|
sl@0
|
170 |
#define DLT_SLIP_BSDOS 15 /* BSD/OS Serial Line IP */
|
sl@0
|
171 |
#define DLT_PPP_BSDOS 16 /* BSD/OS Point-to-point Protocol */
|
sl@0
|
172 |
#endif
|
sl@0
|
173 |
|
sl@0
|
174 |
/*
|
sl@0
|
175 |
* 17 is used for DLT_OLD_PFLOG in OpenBSD;
|
sl@0
|
176 |
* OBSOLETE: DLT_PFLOG is 117 in OpenBSD now as well. See below.
|
sl@0
|
177 |
* 18 is used for DLT_PFSYNC in OpenBSD; don't use it for anything else.
|
sl@0
|
178 |
*/
|
sl@0
|
179 |
|
sl@0
|
180 |
#define DLT_ATM_CLIP 19 /* Linux Classical-IP over ATM */
|
sl@0
|
181 |
|
sl@0
|
182 |
/*
|
sl@0
|
183 |
* Apparently Redback uses this for its SmartEdge 400/800. I hope
|
sl@0
|
184 |
* nobody else decided to use it, too.
|
sl@0
|
185 |
*/
|
sl@0
|
186 |
#define DLT_REDBACK_SMARTEDGE 32
|
sl@0
|
187 |
|
sl@0
|
188 |
/*
|
sl@0
|
189 |
* These values are defined by NetBSD; other platforms should refrain from
|
sl@0
|
190 |
* using them for other purposes, so that NetBSD savefiles with link
|
sl@0
|
191 |
* types of 50 or 51 can be read as this type on all platforms.
|
sl@0
|
192 |
*/
|
sl@0
|
193 |
#define DLT_PPP_SERIAL 50 /* PPP over serial with HDLC encapsulation */
|
sl@0
|
194 |
#define DLT_PPP_ETHER 51 /* PPP over Ethernet */
|
sl@0
|
195 |
|
sl@0
|
196 |
/*
|
sl@0
|
197 |
* The Axent Raptor firewall - now the Symantec Enterprise Firewall - uses
|
sl@0
|
198 |
* a link-layer type of 99 for the tcpdump it supplies. The link-layer
|
sl@0
|
199 |
* header has 6 bytes of unknown data, something that appears to be an
|
sl@0
|
200 |
* Ethernet type, and 36 bytes that appear to be 0 in at least one capture
|
sl@0
|
201 |
* I've seen.
|
sl@0
|
202 |
*/
|
sl@0
|
203 |
#define DLT_SYMANTEC_FIREWALL 99
|
sl@0
|
204 |
|
sl@0
|
205 |
/*
|
sl@0
|
206 |
* Values between 100 and 103 are used in capture file headers as
|
sl@0
|
207 |
* link-layer types corresponding to DLT_ types that differ
|
sl@0
|
208 |
* between platforms; don't use those values for new DLT_ new types.
|
sl@0
|
209 |
*/
|
sl@0
|
210 |
|
sl@0
|
211 |
/*
|
sl@0
|
212 |
* This value was defined by libpcap 0.5; platforms that have defined
|
sl@0
|
213 |
* it with a different value should define it here with that value -
|
sl@0
|
214 |
* a link type of 104 in a save file will be mapped to DLT_C_HDLC,
|
sl@0
|
215 |
* whatever value that happens to be, so programs will correctly
|
sl@0
|
216 |
* handle files with that link type regardless of the value of
|
sl@0
|
217 |
* DLT_C_HDLC.
|
sl@0
|
218 |
*
|
sl@0
|
219 |
* The name DLT_C_HDLC was used by BSD/OS; we use that name for source
|
sl@0
|
220 |
* compatibility with programs written for BSD/OS.
|
sl@0
|
221 |
*
|
sl@0
|
222 |
* libpcap 0.5 defined it as DLT_CHDLC; we define DLT_CHDLC as well,
|
sl@0
|
223 |
* for source compatibility with programs written for libpcap 0.5.
|
sl@0
|
224 |
*/
|
sl@0
|
225 |
#define DLT_C_HDLC 104 /* Cisco HDLC */
|
sl@0
|
226 |
#define DLT_CHDLC DLT_C_HDLC
|
sl@0
|
227 |
|
sl@0
|
228 |
#define DLT_IEEE802_11 105 /* IEEE 802.11 wireless */
|
sl@0
|
229 |
|
sl@0
|
230 |
/*
|
sl@0
|
231 |
* 106 is reserved for Linux Classical IP over ATM; it's like DLT_RAW,
|
sl@0
|
232 |
* except when it isn't. (I.e., sometimes it's just raw IP, and
|
sl@0
|
233 |
* sometimes it isn't.) We currently handle it as DLT_LINUX_SLL,
|
sl@0
|
234 |
* so that we don't have to worry about the link-layer header.)
|
sl@0
|
235 |
*/
|
sl@0
|
236 |
|
sl@0
|
237 |
/*
|
sl@0
|
238 |
* Frame Relay; BSD/OS has a DLT_FR with a value of 11, but that collides
|
sl@0
|
239 |
* with other values.
|
sl@0
|
240 |
* DLT_FR and DLT_FRELAY packets start with the Q.922 Frame Relay header
|
sl@0
|
241 |
* (DLCI, etc.).
|
sl@0
|
242 |
*/
|
sl@0
|
243 |
#define DLT_FRELAY 107
|
sl@0
|
244 |
|
sl@0
|
245 |
/*
|
sl@0
|
246 |
* OpenBSD DLT_LOOP, for loopback devices; it's like DLT_NULL, except
|
sl@0
|
247 |
* that the AF_ type in the link-layer header is in network byte order.
|
sl@0
|
248 |
*
|
sl@0
|
249 |
* OpenBSD defines it as 12, but that collides with DLT_RAW, so we
|
sl@0
|
250 |
* define it as 108 here. If OpenBSD picks up this file, it should
|
sl@0
|
251 |
* define DLT_LOOP as 12 in its version, as per the comment above -
|
sl@0
|
252 |
* and should not use 108 as a DLT_ value.
|
sl@0
|
253 |
*/
|
sl@0
|
254 |
#define DLT_LOOP 108
|
sl@0
|
255 |
|
sl@0
|
256 |
/*
|
sl@0
|
257 |
* Encapsulated packets for IPsec; DLT_ENC is 13 in OpenBSD, but that's
|
sl@0
|
258 |
* DLT_SLIP_BSDOS in NetBSD, so we don't use 13 for it in OSes other
|
sl@0
|
259 |
* than OpenBSD.
|
sl@0
|
260 |
*/
|
sl@0
|
261 |
#ifdef __OpenBSD__
|
sl@0
|
262 |
#define DLT_ENC 13
|
sl@0
|
263 |
#else
|
sl@0
|
264 |
#define DLT_ENC 109
|
sl@0
|
265 |
#endif
|
sl@0
|
266 |
|
sl@0
|
267 |
/*
|
sl@0
|
268 |
* Values between 110 and 112 are reserved for use in capture file headers
|
sl@0
|
269 |
* as link-layer types corresponding to DLT_ types that might differ
|
sl@0
|
270 |
* between platforms; don't use those values for new DLT_ types
|
sl@0
|
271 |
* other than the corresponding DLT_ types.
|
sl@0
|
272 |
*/
|
sl@0
|
273 |
|
sl@0
|
274 |
/*
|
sl@0
|
275 |
* This is for Linux cooked sockets.
|
sl@0
|
276 |
*/
|
sl@0
|
277 |
#define DLT_LINUX_SLL 113
|
sl@0
|
278 |
|
sl@0
|
279 |
/*
|
sl@0
|
280 |
* Apple LocalTalk hardware.
|
sl@0
|
281 |
*/
|
sl@0
|
282 |
#define DLT_LTALK 114
|
sl@0
|
283 |
|
sl@0
|
284 |
/*
|
sl@0
|
285 |
* Acorn Econet.
|
sl@0
|
286 |
*/
|
sl@0
|
287 |
#define DLT_ECONET 115
|
sl@0
|
288 |
|
sl@0
|
289 |
/*
|
sl@0
|
290 |
* Reserved for use with OpenBSD ipfilter.
|
sl@0
|
291 |
*/
|
sl@0
|
292 |
#define DLT_IPFILTER 116
|
sl@0
|
293 |
|
sl@0
|
294 |
/*
|
sl@0
|
295 |
* OpenBSD DLT_PFLOG; DLT_PFLOG is 17 in OpenBSD, but that's DLT_LANE8023
|
sl@0
|
296 |
* in SuSE 6.3, so we can't use 17 for it in capture-file headers.
|
sl@0
|
297 |
*
|
sl@0
|
298 |
* XXX: is there a conflict with DLT_PFSYNC 18 as well?
|
sl@0
|
299 |
*/
|
sl@0
|
300 |
#ifdef __OpenBSD__
|
sl@0
|
301 |
#define DLT_OLD_PFLOG 17
|
sl@0
|
302 |
#define DLT_PFSYNC 18
|
sl@0
|
303 |
#endif
|
sl@0
|
304 |
#define DLT_PFLOG 117
|
sl@0
|
305 |
|
sl@0
|
306 |
/*
|
sl@0
|
307 |
* Registered for Cisco-internal use.
|
sl@0
|
308 |
*/
|
sl@0
|
309 |
#define DLT_CISCO_IOS 118
|
sl@0
|
310 |
|
sl@0
|
311 |
/*
|
sl@0
|
312 |
* For 802.11 cards using the Prism II chips, with a link-layer
|
sl@0
|
313 |
* header including Prism monitor mode information plus an 802.11
|
sl@0
|
314 |
* header.
|
sl@0
|
315 |
*/
|
sl@0
|
316 |
#define DLT_PRISM_HEADER 119
|
sl@0
|
317 |
|
sl@0
|
318 |
/*
|
sl@0
|
319 |
* Reserved for Aironet 802.11 cards, with an Aironet link-layer header
|
sl@0
|
320 |
* (see Doug Ambrisko's FreeBSD patches).
|
sl@0
|
321 |
*/
|
sl@0
|
322 |
#define DLT_AIRONET_HEADER 120
|
sl@0
|
323 |
|
sl@0
|
324 |
/*
|
sl@0
|
325 |
* Reserved for Siemens HiPath HDLC.
|
sl@0
|
326 |
*/
|
sl@0
|
327 |
#define DLT_HHDLC 121
|
sl@0
|
328 |
|
sl@0
|
329 |
/*
|
sl@0
|
330 |
* This is for RFC 2625 IP-over-Fibre Channel.
|
sl@0
|
331 |
*
|
sl@0
|
332 |
* This is not for use with raw Fibre Channel, where the link-layer
|
sl@0
|
333 |
* header starts with a Fibre Channel frame header; it's for IP-over-FC,
|
sl@0
|
334 |
* where the link-layer header starts with an RFC 2625 Network_Header
|
sl@0
|
335 |
* field.
|
sl@0
|
336 |
*/
|
sl@0
|
337 |
#define DLT_IP_OVER_FC 122
|
sl@0
|
338 |
|
sl@0
|
339 |
/*
|
sl@0
|
340 |
* This is for Full Frontal ATM on Solaris with SunATM, with a
|
sl@0
|
341 |
* pseudo-header followed by an AALn PDU.
|
sl@0
|
342 |
*
|
sl@0
|
343 |
* There may be other forms of Full Frontal ATM on other OSes,
|
sl@0
|
344 |
* with different pseudo-headers.
|
sl@0
|
345 |
*
|
sl@0
|
346 |
* If ATM software returns a pseudo-header with VPI/VCI information
|
sl@0
|
347 |
* (and, ideally, packet type information, e.g. signalling, ILMI,
|
sl@0
|
348 |
* LANE, LLC-multiplexed traffic, etc.), it should not use
|
sl@0
|
349 |
* DLT_ATM_RFC1483, but should get a new DLT_ value, so tcpdump
|
sl@0
|
350 |
* and the like don't have to infer the presence or absence of a
|
sl@0
|
351 |
* pseudo-header and the form of the pseudo-header.
|
sl@0
|
352 |
*/
|
sl@0
|
353 |
#define DLT_SUNATM 123 /* Solaris+SunATM */
|
sl@0
|
354 |
|
sl@0
|
355 |
/*
|
sl@0
|
356 |
* Reserved as per request from Kent Dahlgren <kent@praesum.com>
|
sl@0
|
357 |
* for private use.
|
sl@0
|
358 |
*/
|
sl@0
|
359 |
#define DLT_RIO 124 /* RapidIO */
|
sl@0
|
360 |
#define DLT_PCI_EXP 125 /* PCI Express */
|
sl@0
|
361 |
#define DLT_AURORA 126 /* Xilinx Aurora link layer */
|
sl@0
|
362 |
|
sl@0
|
363 |
/*
|
sl@0
|
364 |
* Header for 802.11 plus a number of bits of link-layer information
|
sl@0
|
365 |
* including radio information, used by some recent BSD drivers as
|
sl@0
|
366 |
* well as the madwifi Atheros driver for Linux.
|
sl@0
|
367 |
*/
|
sl@0
|
368 |
#define DLT_IEEE802_11_RADIO 127 /* 802.11 plus radiotap radio header */
|
sl@0
|
369 |
|
sl@0
|
370 |
/*
|
sl@0
|
371 |
* Reserved for the TZSP encapsulation, as per request from
|
sl@0
|
372 |
* Chris Waters <chris.waters@networkchemistry.com>
|
sl@0
|
373 |
* TZSP is a generic encapsulation for any other link type,
|
sl@0
|
374 |
* which includes a means to include meta-information
|
sl@0
|
375 |
* with the packet, e.g. signal strength and channel
|
sl@0
|
376 |
* for 802.11 packets.
|
sl@0
|
377 |
*/
|
sl@0
|
378 |
#define DLT_TZSP 128 /* Tazmen Sniffer Protocol */
|
sl@0
|
379 |
|
sl@0
|
380 |
/*
|
sl@0
|
381 |
* BSD's ARCNET headers have the source host, destination host,
|
sl@0
|
382 |
* and type at the beginning of the packet; that's what's handed
|
sl@0
|
383 |
* up to userland via BPF.
|
sl@0
|
384 |
*
|
sl@0
|
385 |
* Linux's ARCNET headers, however, have a 2-byte offset field
|
sl@0
|
386 |
* between the host IDs and the type; that's what's handed up
|
sl@0
|
387 |
* to userland via PF_PACKET sockets.
|
sl@0
|
388 |
*
|
sl@0
|
389 |
* We therefore have to have separate DLT_ values for them.
|
sl@0
|
390 |
*/
|
sl@0
|
391 |
#define DLT_ARCNET_LINUX 129 /* ARCNET */
|
sl@0
|
392 |
|
sl@0
|
393 |
/*
|
sl@0
|
394 |
* Juniper-private data link types, as per request from
|
sl@0
|
395 |
* Hannes Gredler <hannes@juniper.net>. The DLT_s are used
|
sl@0
|
396 |
* for passing on chassis-internal metainformation such as
|
sl@0
|
397 |
* QOS profiles, etc..
|
sl@0
|
398 |
*/
|
sl@0
|
399 |
#define DLT_JUNIPER_MLPPP 130
|
sl@0
|
400 |
#define DLT_JUNIPER_MLFR 131
|
sl@0
|
401 |
#define DLT_JUNIPER_ES 132
|
sl@0
|
402 |
#define DLT_JUNIPER_GGSN 133
|
sl@0
|
403 |
#define DLT_JUNIPER_MFR 134
|
sl@0
|
404 |
#define DLT_JUNIPER_ATM2 135
|
sl@0
|
405 |
#define DLT_JUNIPER_SERVICES 136
|
sl@0
|
406 |
#define DLT_JUNIPER_ATM1 137
|
sl@0
|
407 |
|
sl@0
|
408 |
/*
|
sl@0
|
409 |
* Apple IP-over-IEEE 1394, as per a request from Dieter Siegmund
|
sl@0
|
410 |
* <dieter@apple.com>. The header that's presented is an Ethernet-like
|
sl@0
|
411 |
* header:
|
sl@0
|
412 |
*
|
sl@0
|
413 |
* #define FIREWIRE_EUI64_LEN 8
|
sl@0
|
414 |
* struct firewire_header {
|
sl@0
|
415 |
* u_char firewire_dhost[FIREWIRE_EUI64_LEN];
|
sl@0
|
416 |
* u_char firewire_shost[FIREWIRE_EUI64_LEN];
|
sl@0
|
417 |
* u_short firewire_type;
|
sl@0
|
418 |
* };
|
sl@0
|
419 |
*
|
sl@0
|
420 |
* with "firewire_type" being an Ethernet type value, rather than,
|
sl@0
|
421 |
* for example, raw GASP frames being handed up.
|
sl@0
|
422 |
*/
|
sl@0
|
423 |
#define DLT_APPLE_IP_OVER_IEEE1394 138
|
sl@0
|
424 |
|
sl@0
|
425 |
/*
|
sl@0
|
426 |
* Various SS7 encapsulations, as per a request from Jeff Morriss
|
sl@0
|
427 |
* <jeff.morriss[AT]ulticom.com> and subsequent discussions.
|
sl@0
|
428 |
*/
|
sl@0
|
429 |
#define DLT_MTP2_WITH_PHDR 139 /* pseudo-header with various info, followed by MTP2 */
|
sl@0
|
430 |
#define DLT_MTP2 140 /* MTP2, without pseudo-header */
|
sl@0
|
431 |
#define DLT_MTP3 141 /* MTP3, without pseudo-header or MTP2 */
|
sl@0
|
432 |
#define DLT_SCCP 142 /* SCCP, without pseudo-header or MTP2 or MTP3 */
|
sl@0
|
433 |
|
sl@0
|
434 |
/*
|
sl@0
|
435 |
* DOCSIS MAC frames.
|
sl@0
|
436 |
*/
|
sl@0
|
437 |
#define DLT_DOCSIS 143
|
sl@0
|
438 |
|
sl@0
|
439 |
/*
|
sl@0
|
440 |
* Linux-IrDA packets. Protocol defined at http://www.irda.org.
|
sl@0
|
441 |
* Those packets include IrLAP headers and above (IrLMP...), but
|
sl@0
|
442 |
* don't include Phy framing (SOF/EOF/CRC & byte stuffing), because Phy
|
sl@0
|
443 |
* framing can be handled by the hardware and depend on the bitrate.
|
sl@0
|
444 |
* This is exactly the format you would get capturing on a Linux-IrDA
|
sl@0
|
445 |
* interface (irdaX), but not on a raw serial port.
|
sl@0
|
446 |
* Note the capture is done in "Linux-cooked" mode, so each packet include
|
sl@0
|
447 |
* a fake packet header (struct sll_header). This is because IrDA packet
|
sl@0
|
448 |
* decoding is dependant on the direction of the packet (incomming or
|
sl@0
|
449 |
* outgoing).
|
sl@0
|
450 |
* When/if other platform implement IrDA capture, we may revisit the
|
sl@0
|
451 |
* issue and define a real DLT_IRDA...
|
sl@0
|
452 |
* Jean II
|
sl@0
|
453 |
*/
|
sl@0
|
454 |
#define DLT_LINUX_IRDA 144
|
sl@0
|
455 |
|
sl@0
|
456 |
/*
|
sl@0
|
457 |
* Reserved for IBM SP switch and IBM Next Federation switch.
|
sl@0
|
458 |
*/
|
sl@0
|
459 |
#define DLT_IBM_SP 145
|
sl@0
|
460 |
#define DLT_IBM_SN 146
|
sl@0
|
461 |
|
sl@0
|
462 |
/*
|
sl@0
|
463 |
* Reserved for private use. If you have some link-layer header type
|
sl@0
|
464 |
* that you want to use within your organization, with the capture files
|
sl@0
|
465 |
* using that link-layer header type not ever be sent outside your
|
sl@0
|
466 |
* organization, you can use these values.
|
sl@0
|
467 |
*
|
sl@0
|
468 |
* No libpcap release will use these for any purpose, nor will any
|
sl@0
|
469 |
* tcpdump release use them, either.
|
sl@0
|
470 |
*
|
sl@0
|
471 |
* Do *NOT* use these in capture files that you expect anybody not using
|
sl@0
|
472 |
* your private versions of capture-file-reading tools to read; in
|
sl@0
|
473 |
* particular, do *NOT* use them in products, otherwise you may find that
|
sl@0
|
474 |
* people won't be able to use tcpdump, or snort, or Ethereal, or... to
|
sl@0
|
475 |
* read capture files from your firewall/intrusion detection/traffic
|
sl@0
|
476 |
* monitoring/etc. appliance, or whatever product uses that DLT_ value,
|
sl@0
|
477 |
* and you may also find that the developers of those applications will
|
sl@0
|
478 |
* not accept patches to let them read those files.
|
sl@0
|
479 |
*
|
sl@0
|
480 |
* Also, do not use them if somebody might send you a capture using them
|
sl@0
|
481 |
* for *their* private type and tools using them for *your* private type
|
sl@0
|
482 |
* would have to read them.
|
sl@0
|
483 |
*
|
sl@0
|
484 |
* Instead, ask "tcpdump-workers@tcpdump.org" for a new DLT_ value,
|
sl@0
|
485 |
* as per the comment above, and use the type you're given.
|
sl@0
|
486 |
*/
|
sl@0
|
487 |
#define DLT_USER0 147
|
sl@0
|
488 |
#define DLT_USER1 148
|
sl@0
|
489 |
#define DLT_USER2 149
|
sl@0
|
490 |
#define DLT_USER3 150
|
sl@0
|
491 |
#define DLT_USER4 151
|
sl@0
|
492 |
#define DLT_USER5 152
|
sl@0
|
493 |
#define DLT_USER6 153
|
sl@0
|
494 |
#define DLT_USER7 154
|
sl@0
|
495 |
#define DLT_USER8 155
|
sl@0
|
496 |
#define DLT_USER9 156
|
sl@0
|
497 |
#define DLT_USER10 157
|
sl@0
|
498 |
#define DLT_USER11 158
|
sl@0
|
499 |
#define DLT_USER12 159
|
sl@0
|
500 |
#define DLT_USER13 160
|
sl@0
|
501 |
#define DLT_USER14 161
|
sl@0
|
502 |
#define DLT_USER15 162
|
sl@0
|
503 |
|
sl@0
|
504 |
/*
|
sl@0
|
505 |
* For future use with 802.11 captures - defined by AbsoluteValue
|
sl@0
|
506 |
* Systems to store a number of bits of link-layer information
|
sl@0
|
507 |
* including radio information:
|
sl@0
|
508 |
*
|
sl@0
|
509 |
* http://www.shaftnet.org/~pizza/software/capturefrm.txt
|
sl@0
|
510 |
*
|
sl@0
|
511 |
* but it might be used by some non-AVS drivers now or in the
|
sl@0
|
512 |
* future.
|
sl@0
|
513 |
*/
|
sl@0
|
514 |
#define DLT_IEEE802_11_RADIO_AVS 163 /* 802.11 plus AVS radio header */
|
sl@0
|
515 |
|
sl@0
|
516 |
/*
|
sl@0
|
517 |
* Juniper-private data link type, as per request from
|
sl@0
|
518 |
* Hannes Gredler <hannes@juniper.net>. The DLT_s are used
|
sl@0
|
519 |
* for passing on chassis-internal metainformation such as
|
sl@0
|
520 |
* QOS profiles, etc..
|
sl@0
|
521 |
*/
|
sl@0
|
522 |
#define DLT_JUNIPER_MONITOR 164
|
sl@0
|
523 |
|
sl@0
|
524 |
/*
|
sl@0
|
525 |
* Reserved for BACnet MS/TP.
|
sl@0
|
526 |
*/
|
sl@0
|
527 |
#define DLT_BACNET_MS_TP 165
|
sl@0
|
528 |
|
sl@0
|
529 |
/*
|
sl@0
|
530 |
* Another PPP variant as per request from Karsten Keil <kkeil@suse.de>.
|
sl@0
|
531 |
*
|
sl@0
|
532 |
* This is used in some OSes to allow a kernel socket filter to distinguish
|
sl@0
|
533 |
* between incoming and outgoing packets, on a socket intended to
|
sl@0
|
534 |
* supply pppd with outgoing packets so it can do dial-on-demand and
|
sl@0
|
535 |
* hangup-on-lack-of-demand; incoming packets are filtered out so they
|
sl@0
|
536 |
* don't cause pppd to hold the connection up (you don't want random
|
sl@0
|
537 |
* input packets such as port scans, packets from old lost connections,
|
sl@0
|
538 |
* etc. to force the connection to stay up).
|
sl@0
|
539 |
*
|
sl@0
|
540 |
* The first byte of the PPP header (0xff03) is modified to accomodate
|
sl@0
|
541 |
* the direction - 0x00 = IN, 0x01 = OUT.
|
sl@0
|
542 |
*/
|
sl@0
|
543 |
#define DLT_PPP_PPPD 166
|
sl@0
|
544 |
|
sl@0
|
545 |
/*
|
sl@0
|
546 |
* Names for backwards compatibility with older versions of some PPP
|
sl@0
|
547 |
* software; new software should use DLT_PPP_PPPD.
|
sl@0
|
548 |
*/
|
sl@0
|
549 |
#define DLT_PPP_WITH_DIRECTION DLT_PPP_PPPD
|
sl@0
|
550 |
#define DLT_LINUX_PPP_WITHDIRECTION DLT_PPP_PPPD
|
sl@0
|
551 |
|
sl@0
|
552 |
/*
|
sl@0
|
553 |
* Juniper-private data link type, as per request from
|
sl@0
|
554 |
* Hannes Gredler <hannes@juniper.net>. The DLT_s are used
|
sl@0
|
555 |
* for passing on chassis-internal metainformation such as
|
sl@0
|
556 |
* QOS profiles, cookies, etc..
|
sl@0
|
557 |
*/
|
sl@0
|
558 |
#define DLT_JUNIPER_PPPOE 167
|
sl@0
|
559 |
#define DLT_JUNIPER_PPPOE_ATM 168
|
sl@0
|
560 |
|
sl@0
|
561 |
#define DLT_GPRS_LLC 169 /* GPRS LLC */
|
sl@0
|
562 |
#define DLT_GPF_T 170 /* GPF-T (ITU-T G.7041/Y.1303) */
|
sl@0
|
563 |
#define DLT_GPF_F 171 /* GPF-F (ITU-T G.7041/Y.1303) */
|
sl@0
|
564 |
|
sl@0
|
565 |
/*
|
sl@0
|
566 |
* Requested by Oolan Zimmer <oz@gcom.com> for use in Gcom's T1/E1 line
|
sl@0
|
567 |
* monitoring equipment.
|
sl@0
|
568 |
*/
|
sl@0
|
569 |
#define DLT_GCOM_T1E1 172
|
sl@0
|
570 |
#define DLT_GCOM_SERIAL 173
|
sl@0
|
571 |
|
sl@0
|
572 |
/*
|
sl@0
|
573 |
* Juniper-private data link type, as per request from
|
sl@0
|
574 |
* Hannes Gredler <hannes@juniper.net>. The DLT_ is used
|
sl@0
|
575 |
* for internal communication to Physical Interface Cards (PIC)
|
sl@0
|
576 |
*/
|
sl@0
|
577 |
#define DLT_JUNIPER_PIC_PEER 174
|
sl@0
|
578 |
|
sl@0
|
579 |
/*
|
sl@0
|
580 |
* Link types requested by Gregor Maier <gregor@endace.com> of Endace
|
sl@0
|
581 |
* Measurement Systems. They add an ERF header (see
|
sl@0
|
582 |
* http://www.endace.com/support/EndaceRecordFormat.pdf) in front of
|
sl@0
|
583 |
* the link-layer header.
|
sl@0
|
584 |
*/
|
sl@0
|
585 |
#define DLT_ERF_ETH 175 /* Ethernet */
|
sl@0
|
586 |
#define DLT_ERF_POS 176 /* Packet-over-SONET */
|
sl@0
|
587 |
|
sl@0
|
588 |
/*
|
sl@0
|
589 |
* Requested by Daniele Orlandi <daniele@orlandi.com> for raw LAPD
|
sl@0
|
590 |
* for vISDN (http://www.orlandi.com/visdn/). Its link-layer header
|
sl@0
|
591 |
* includes additional information before the LAPD header, so it's
|
sl@0
|
592 |
* not necessarily a generic LAPD header.
|
sl@0
|
593 |
*/
|
sl@0
|
594 |
#define DLT_LINUX_LAPD 177
|
sl@0
|
595 |
|
sl@0
|
596 |
/*
|
sl@0
|
597 |
* Juniper-private data link type, as per request from
|
sl@0
|
598 |
* Hannes Gredler <hannes@juniper.net>.
|
sl@0
|
599 |
* The DLT_ are used for prepending meta-information
|
sl@0
|
600 |
* like interface index, interface name
|
sl@0
|
601 |
* before standard Ethernet, PPP, Frelay & C-HDLC Frames
|
sl@0
|
602 |
*/
|
sl@0
|
603 |
#define DLT_JUNIPER_ETHER 178
|
sl@0
|
604 |
#define DLT_JUNIPER_PPP 179
|
sl@0
|
605 |
#define DLT_JUNIPER_FRELAY 180
|
sl@0
|
606 |
#define DLT_JUNIPER_CHDLC 181
|
sl@0
|
607 |
|
sl@0
|
608 |
/*
|
sl@0
|
609 |
* Multi Link Frame Relay (FRF.16)
|
sl@0
|
610 |
*/
|
sl@0
|
611 |
#define DLT_MFR 182
|
sl@0
|
612 |
|
sl@0
|
613 |
/*
|
sl@0
|
614 |
* Juniper-private data link type, as per request from
|
sl@0
|
615 |
* Hannes Gredler <hannes@juniper.net>.
|
sl@0
|
616 |
* The DLT_ is used for internal communication with a
|
sl@0
|
617 |
* voice Adapter Card (PIC)
|
sl@0
|
618 |
*/
|
sl@0
|
619 |
#define DLT_JUNIPER_VP 183
|
sl@0
|
620 |
|
sl@0
|
621 |
/*
|
sl@0
|
622 |
* Arinc 429 frames.
|
sl@0
|
623 |
* DLT_ requested by Gianluca Varenni <gianluca.varenni@cacetech.com>.
|
sl@0
|
624 |
* Every frame contains a 32bit A429 label.
|
sl@0
|
625 |
* More documentation on Arinc 429 can be found at
|
sl@0
|
626 |
* http://www.condoreng.com/support/downloads/tutorials/ARINCTutorial.pdf
|
sl@0
|
627 |
*/
|
sl@0
|
628 |
#define DLT_A429 184
|
sl@0
|
629 |
|
sl@0
|
630 |
/*
|
sl@0
|
631 |
* Arinc 653 Interpartition Communication messages.
|
sl@0
|
632 |
* DLT_ requested by Gianluca Varenni <gianluca.varenni@cacetech.com>.
|
sl@0
|
633 |
* Please refer to the A653-1 standard for more information.
|
sl@0
|
634 |
*/
|
sl@0
|
635 |
#define DLT_A653_ICM 185
|
sl@0
|
636 |
|
sl@0
|
637 |
/*
|
sl@0
|
638 |
* Controller Area Network (CAN) v. 2.0B packets.
|
sl@0
|
639 |
* DLT_ requested by Gianluca Varenni <gianluca.varenni@cacetech.com>.
|
sl@0
|
640 |
* Used to dump CAN packets coming from a CAN Vector board.
|
sl@0
|
641 |
* More documentation on the CAN v2.0B frames can be found at
|
sl@0
|
642 |
* http://www.can-cia.org/downloads/?269
|
sl@0
|
643 |
*/
|
sl@0
|
644 |
#define DLT_CAN20B 190
|
sl@0
|
645 |
|
sl@0
|
646 |
|
sl@0
|
647 |
/*
|
sl@0
|
648 |
* The instruction encodings.
|
sl@0
|
649 |
*/
|
sl@0
|
650 |
/* instruction classes */
|
sl@0
|
651 |
#define BPF_CLASS(code) ((code) & 0x07)
|
sl@0
|
652 |
#define BPF_LD 0x00
|
sl@0
|
653 |
#define BPF_LDX 0x01
|
sl@0
|
654 |
#define BPF_ST 0x02
|
sl@0
|
655 |
#define BPF_STX 0x03
|
sl@0
|
656 |
#define BPF_ALU 0x04
|
sl@0
|
657 |
#define BPF_JMP 0x05
|
sl@0
|
658 |
#define BPF_RET 0x06
|
sl@0
|
659 |
#define BPF_MISC 0x07
|
sl@0
|
660 |
|
sl@0
|
661 |
/* ld/ldx fields */
|
sl@0
|
662 |
#define BPF_SIZE(code) ((code) & 0x18)
|
sl@0
|
663 |
#define BPF_W 0x00
|
sl@0
|
664 |
#define BPF_H 0x08
|
sl@0
|
665 |
#define BPF_B 0x10
|
sl@0
|
666 |
#define BPF_MODE(code) ((code) & 0xe0)
|
sl@0
|
667 |
#define BPF_IMM 0x00
|
sl@0
|
668 |
#define BPF_ABS 0x20
|
sl@0
|
669 |
#define BPF_IND 0x40
|
sl@0
|
670 |
#define BPF_MEM 0x60
|
sl@0
|
671 |
#define BPF_LEN 0x80
|
sl@0
|
672 |
#define BPF_MSH 0xa0
|
sl@0
|
673 |
|
sl@0
|
674 |
/* alu/jmp fields */
|
sl@0
|
675 |
#define BPF_OP(code) ((code) & 0xf0)
|
sl@0
|
676 |
#define BPF_ADD 0x00
|
sl@0
|
677 |
#define BPF_SUB 0x10
|
sl@0
|
678 |
#define BPF_MUL 0x20
|
sl@0
|
679 |
#define BPF_DIV 0x30
|
sl@0
|
680 |
#define BPF_OR 0x40
|
sl@0
|
681 |
#define BPF_AND 0x50
|
sl@0
|
682 |
#define BPF_LSH 0x60
|
sl@0
|
683 |
#define BPF_RSH 0x70
|
sl@0
|
684 |
#define BPF_NEG 0x80
|
sl@0
|
685 |
#define BPF_JA 0x00
|
sl@0
|
686 |
#define BPF_JEQ 0x10
|
sl@0
|
687 |
#define BPF_JGT 0x20
|
sl@0
|
688 |
#define BPF_JGE 0x30
|
sl@0
|
689 |
#define BPF_JSET 0x40
|
sl@0
|
690 |
#define BPF_SRC(code) ((code) & 0x08)
|
sl@0
|
691 |
#define BPF_K 0x00
|
sl@0
|
692 |
#define BPF_X 0x08
|
sl@0
|
693 |
|
sl@0
|
694 |
/* ret - BPF_K and BPF_X also apply */
|
sl@0
|
695 |
#define BPF_RVAL(code) ((code) & 0x18)
|
sl@0
|
696 |
#define BPF_A 0x10
|
sl@0
|
697 |
|
sl@0
|
698 |
/* misc */
|
sl@0
|
699 |
#define BPF_MISCOP(code) ((code) & 0xf8)
|
sl@0
|
700 |
#define BPF_TAX 0x00
|
sl@0
|
701 |
#define BPF_TXA 0x80
|
sl@0
|
702 |
|
sl@0
|
703 |
/*
|
sl@0
|
704 |
* The instruction data structure.
|
sl@0
|
705 |
*/
|
sl@0
|
706 |
struct bpf_insn {
|
sl@0
|
707 |
u_short code;
|
sl@0
|
708 |
u_char jt;
|
sl@0
|
709 |
u_char jf;
|
sl@0
|
710 |
bpf_int32 k;
|
sl@0
|
711 |
};
|
sl@0
|
712 |
|
sl@0
|
713 |
/*
|
sl@0
|
714 |
* Macros for insn array initializers.
|
sl@0
|
715 |
*/
|
sl@0
|
716 |
#define BPF_STMT(code, k) { (u_short)(code), 0, 0, k }
|
sl@0
|
717 |
#define BPF_JUMP(code, k, jt, jf) { (u_short)(code), jt, jf, k }
|
sl@0
|
718 |
|
sl@0
|
719 |
#if __STDC__ || defined(__cplusplus)
|
sl@0
|
720 |
extern int bpf_validate(struct bpf_insn *, int);
|
sl@0
|
721 |
extern u_int bpf_filter(struct bpf_insn *, u_char *, u_int, u_int);
|
sl@0
|
722 |
#else
|
sl@0
|
723 |
extern int bpf_validate();
|
sl@0
|
724 |
extern u_int bpf_filter();
|
sl@0
|
725 |
#endif
|
sl@0
|
726 |
|
sl@0
|
727 |
/*
|
sl@0
|
728 |
* Number of scratch memory words (for BPF_LD|BPF_MEM and BPF_ST).
|
sl@0
|
729 |
*/
|
sl@0
|
730 |
#define BPF_MEMWORDS 16
|
sl@0
|
731 |
|
sl@0
|
732 |
#ifdef __cplusplus
|
sl@0
|
733 |
}
|
sl@0
|
734 |
#endif
|
sl@0
|
735 |
|
sl@0
|
736 |
#endif
|