Remove building with NOCRYPTO option
[minix.git] / external / bsd / libpcap / dist / pcap / bpf.h
blob2dc9865bfd71caa04687f965faa1cd671d65177e
1 /* $NetBSD: bpf.h,v 1.7 2015/03/31 21:39:43 christos Exp $ */
3 /*-
4 * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
5 * The Regents of the University of California. All rights reserved.
7 * This code is derived from the Stanford/CMU enet packet filter,
8 * (net/enet.c) distributed as part of 4.3BSD, and code contributed
9 * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence
10 * Berkeley Laboratory.
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 * 3. All advertising materials mentioning features or use of this software
21 * must display the following acknowledgement:
22 * This product includes software developed by the University of
23 * California, Berkeley and its contributors.
24 * 4. Neither the name of the University nor the names of its contributors
25 * may be used to endorse or promote products derived from this software
26 * without specific prior written permission.
28 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
29 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
32 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
34 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
37 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38 * SUCH DAMAGE.
40 * @(#)bpf.h 7.1 (Berkeley) 5/7/91
42 #error "This is not used in NetBSD, we use <net/bpf.h>"
44 * This is libpcap's cut-down version of bpf.h; it includes only
45 * the stuff needed for the code generator and the userland BPF
46 * interpreter, and the libpcap APIs for setting filters, etc..
48 * "pcap-bpf.c" will include the native OS version, as it deals with
49 * the OS's BPF implementation.
51 * At least two programs found by Google Code Search explicitly includes
52 * <pcap/bpf.h> (even though <pcap.h>/<pcap/pcap.h> includes it for you),
53 * so moving that stuff to <pcap/pcap.h> would break the build for some
54 * programs.
58 * If we've already included <net/bpf.h>, don't re-define this stuff.
59 * We assume BSD-style multiple-include protection in <net/bpf.h>,
60 * which is true of all but the oldest versions of FreeBSD and NetBSD,
61 * or Tru64 UNIX-style multiple-include protection (or, at least,
62 * Tru64 UNIX 5.x-style; I don't have earlier versions available to check),
63 * or AIX-style multiple-include protection (or, at least, AIX 5.x-style;
64 * I don't have earlier versions available to check), or QNX-style
65 * multiple-include protection (as per GitHub pull request #394).
67 * We do not check for BPF_MAJOR_VERSION, as that's defined by
68 * <linux/filter.h>, which is directly or indirectly included in some
69 * programs that also include pcap.h, and <linux/filter.h> doesn't
70 * define stuff we need.
72 * This also provides our own multiple-include protection.
74 #if !defined(_NET_BPF_H_) && !defined(_NET_BPF_H_INCLUDED) && !defined(_BPF_H_) && !defined(_H_BPF) && !defined(lib_pcap_bpf_h)
75 #define lib_pcap_bpf_h
77 #ifdef __cplusplus
78 extern "C" {
79 #endif
81 /* BSD style release date */
82 #define BPF_RELEASE 199606
84 #ifdef MSDOS /* must be 32-bit */
85 typedef long bpf_int32;
86 typedef unsigned long bpf_u_int32;
87 #else
88 typedef int bpf_int32;
89 typedef u_int bpf_u_int32;
90 #endif
93 * Alignment macros. BPF_WORDALIGN rounds up to the next
94 * even multiple of BPF_ALIGNMENT.
96 * Tcpdump's print-pflog.c uses this, so we define it here.
98 #ifndef __NetBSD__
99 #define BPF_ALIGNMENT sizeof(bpf_int32)
100 #else
101 #define BPF_ALIGNMENT sizeof(long)
102 #endif
103 #define BPF_WORDALIGN(x) (((x)+(BPF_ALIGNMENT-1))&~(BPF_ALIGNMENT-1))
106 * Structure for "pcap_compile()", "pcap_setfilter()", etc..
108 struct bpf_program {
109 u_int bf_len;
110 struct bpf_insn *bf_insns;
114 * Link-layer header type codes.
116 * Do *NOT* add new values to this list without asking
117 * "tcpdump-workers@lists.tcpdump.org" for a value. Otherwise, you run
118 * the risk of using a value that's already being used for some other
119 * purpose, and of having tools that read libpcap-format captures not
120 * being able to handle captures with your new DLT_ value, with no hope
121 * that they will ever be changed to do so (as that would destroy their
122 * ability to read captures using that value for that other purpose).
124 * See
126 * http://www.tcpdump.org/linktypes.html
128 * for detailed descriptions of some of these link-layer header types.
132 * These are the types that are the same on all platforms, and that
133 * have been defined by <net/bpf.h> for ages.
135 #define DLT_NULL 0 /* BSD loopback encapsulation */
136 #define DLT_EN10MB 1 /* Ethernet (10Mb) */
137 #define DLT_EN3MB 2 /* Experimental Ethernet (3Mb) */
138 #define DLT_AX25 3 /* Amateur Radio AX.25 */
139 #define DLT_PRONET 4 /* Proteon ProNET Token Ring */
140 #define DLT_CHAOS 5 /* Chaos */
141 #define DLT_IEEE802 6 /* 802.5 Token Ring */
142 #define DLT_ARCNET 7 /* ARCNET, with BSD-style header */
143 #define DLT_SLIP 8 /* Serial Line IP */
144 #define DLT_PPP 9 /* Point-to-point Protocol */
145 #define DLT_FDDI 10 /* FDDI */
148 * These are types that are different on some platforms, and that
149 * have been defined by <net/bpf.h> for ages. We use #ifdefs to
150 * detect the BSDs that define them differently from the traditional
151 * libpcap <net/bpf.h>
153 * XXX - DLT_ATM_RFC1483 is 13 in BSD/OS, and DLT_RAW is 14 in BSD/OS,
154 * but I don't know what the right #define is for BSD/OS.
156 #define DLT_ATM_RFC1483 11 /* LLC-encapsulated ATM */
158 #ifdef __OpenBSD__
159 #define DLT_RAW 14 /* raw IP */
160 #else
161 #define DLT_RAW 12 /* raw IP */
162 #endif
165 * Given that the only OS that currently generates BSD/OS SLIP or PPP
166 * is, well, BSD/OS, arguably everybody should have chosen its values
167 * for DLT_SLIP_BSDOS and DLT_PPP_BSDOS, which are 15 and 16, but they
168 * didn't. So it goes.
170 #if defined(__NetBSD__) || defined(__FreeBSD__)
171 #ifndef DLT_SLIP_BSDOS
172 #define DLT_SLIP_BSDOS 13 /* BSD/OS Serial Line IP */
173 #define DLT_PPP_BSDOS 14 /* BSD/OS Point-to-point Protocol */
174 #endif
175 #else
176 #define DLT_SLIP_BSDOS 15 /* BSD/OS Serial Line IP */
177 #define DLT_PPP_BSDOS 16 /* BSD/OS Point-to-point Protocol */
178 #endif
181 * 17 was used for DLT_PFLOG in OpenBSD; it no longer is.
183 * It was DLT_LANE8023 in SuSE 6.3, so we defined LINKTYPE_PFLOG
184 * as 117 so that pflog captures would use a link-layer header type
185 * value that didn't collide with any other values. On all
186 * platforms other than OpenBSD, we defined DLT_PFLOG as 117,
187 * and we mapped between LINKTYPE_PFLOG and DLT_PFLOG.
189 * OpenBSD eventually switched to using 117 for DLT_PFLOG as well.
191 * Don't use 17 for anything else.
193 #if defined(__OpenBSD__) || defined(__NetBSD__)
194 #define DLT_OLD_PFLOG 17
195 #endif
198 * 18 is used for DLT_PFSYNC in OpenBSD, NetBSD, DragonFly BSD and
199 * Mac OS X; don't use it for anything else. (FreeBSD uses 121,
200 * which collides with DLT_HHDLC, even though it doesn't use 18
201 * for anything and doesn't appear to have ever used it for anything.)
203 * We define it as 18 on those platforms; it is, unfortunately, used
204 * for DLT_CIP in Suse 6.3, so we don't define it as DLT_PFSYNC
205 * in general. As the packet format for it, like that for
206 * DLT_PFLOG, is not only OS-dependent but OS-version-dependent,
207 * we don't support printing it in tcpdump except on OSes that
208 * have the relevant header files, so it's not that useful on
209 * other platforms.
211 #if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(__APPLE__)
212 #define DLT_PFSYNC 18
213 #endif
215 #define DLT_ATM_CLIP 19 /* Linux Classical-IP over ATM */
218 * Apparently Redback uses this for its SmartEdge 400/800. I hope
219 * nobody else decided to use it, too.
221 #define DLT_REDBACK_SMARTEDGE 32
224 * These values are defined by NetBSD; other platforms should refrain from
225 * using them for other purposes, so that NetBSD savefiles with link
226 * types of 50 or 51 can be read as this type on all platforms.
228 #define DLT_PPP_SERIAL 50 /* PPP over serial with HDLC encapsulation */
229 #define DLT_PPP_ETHER 51 /* PPP over Ethernet */
232 * The Axent Raptor firewall - now the Symantec Enterprise Firewall - uses
233 * a link-layer type of 99 for the tcpdump it supplies. The link-layer
234 * header has 6 bytes of unknown data, something that appears to be an
235 * Ethernet type, and 36 bytes that appear to be 0 in at least one capture
236 * I've seen.
238 #define DLT_SYMANTEC_FIREWALL 99
241 * Values between 100 and 103 are used in capture file headers as
242 * link-layer header type LINKTYPE_ values corresponding to DLT_ types
243 * that differ between platforms; don't use those values for new DLT_
244 * new types.
248 * Values starting with 104 are used for newly-assigned link-layer
249 * header type values; for those link-layer header types, the DLT_
250 * value returned by pcap_datalink() and passed to pcap_open_dead(),
251 * and the LINKTYPE_ value that appears in capture files, are the
252 * same.
254 * DLT_MATCHING_MIN is the lowest such value; DLT_MATCHING_MAX is
255 * the highest such value.
257 #define DLT_MATCHING_MIN 104
260 * This value was defined by libpcap 0.5; platforms that have defined
261 * it with a different value should define it here with that value -
262 * a link type of 104 in a save file will be mapped to DLT_C_HDLC,
263 * whatever value that happens to be, so programs will correctly
264 * handle files with that link type regardless of the value of
265 * DLT_C_HDLC.
267 * The name DLT_C_HDLC was used by BSD/OS; we use that name for source
268 * compatibility with programs written for BSD/OS.
270 * libpcap 0.5 defined it as DLT_CHDLC; we define DLT_CHDLC as well,
271 * for source compatibility with programs written for libpcap 0.5.
273 #define DLT_C_HDLC 104 /* Cisco HDLC */
274 #define DLT_CHDLC DLT_C_HDLC
276 #define DLT_IEEE802_11 105 /* IEEE 802.11 wireless */
279 * 106 is reserved for Linux Classical IP over ATM; it's like DLT_RAW,
280 * except when it isn't. (I.e., sometimes it's just raw IP, and
281 * sometimes it isn't.) We currently handle it as DLT_LINUX_SLL,
282 * so that we don't have to worry about the link-layer header.)
286 * Frame Relay; BSD/OS has a DLT_FR with a value of 11, but that collides
287 * with other values.
288 * DLT_FR and DLT_FRELAY packets start with the Q.922 Frame Relay header
289 * (DLCI, etc.).
291 #define DLT_FRELAY 107
294 * OpenBSD DLT_LOOP, for loopback devices; it's like DLT_NULL, except
295 * that the AF_ type in the link-layer header is in network byte order.
297 * DLT_LOOP is 12 in OpenBSD, but that's DLT_RAW in other OSes, so
298 * we don't use 12 for it in OSes other than OpenBSD.
300 #ifdef __OpenBSD__
301 #define DLT_LOOP 12
302 #else
303 #define DLT_LOOP 108
304 #endif
307 * Encapsulated packets for IPsec; DLT_ENC is 13 in OpenBSD, but that's
308 * DLT_SLIP_BSDOS in NetBSD, so we don't use 13 for it in OSes other
309 * than OpenBSD.
311 #ifdef __OpenBSD__
312 #define DLT_ENC 13
313 #else
314 #define DLT_ENC 109
315 #endif
318 * Values between 110 and 112 are reserved for use in capture file headers
319 * as link-layer types corresponding to DLT_ types that might differ
320 * between platforms; don't use those values for new DLT_ types
321 * other than the corresponding DLT_ types.
325 * This is for Linux cooked sockets.
327 #define DLT_LINUX_SLL 113
330 * Apple LocalTalk hardware.
332 #define DLT_LTALK 114
335 * Acorn Econet.
337 #define DLT_ECONET 115
340 * Reserved for use with OpenBSD ipfilter.
342 #define DLT_IPFILTER 116
345 * OpenBSD DLT_PFLOG.
347 #define DLT_PFLOG 117
350 * Registered for Cisco-internal use.
352 #define DLT_CISCO_IOS 118
355 * For 802.11 cards using the Prism II chips, with a link-layer
356 * header including Prism monitor mode information plus an 802.11
357 * header.
359 #define DLT_PRISM_HEADER 119
362 * Reserved for Aironet 802.11 cards, with an Aironet link-layer header
363 * (see Doug Ambrisko's FreeBSD patches).
365 #define DLT_AIRONET_HEADER 120
368 * Sigh.
370 * This was reserved for Siemens HiPath HDLC on 2002-01-25, as
371 * requested by Tomas Kukosa.
373 * On 2004-02-25, a FreeBSD checkin to sys/net/bpf.h was made that
374 * assigned 121 as DLT_PFSYNC. Its libpcap does DLT_ <-> LINKTYPE_
375 * mapping, so it probably supports capturing on the pfsync device
376 * but not saving the captured data to a pcap file.
378 * OpenBSD, from which pf came, however, uses 18 for DLT_PFSYNC;
379 * their libpcap does no DLT_ <-> LINKTYPE_ mapping, so it would
380 * use 18 in pcap files as well.
382 * NetBSD and DragonFly BSD also use 18 for DLT_PFSYNC; their
383 * libpcaps do DLT_ <-> LINKTYPE_ mapping, and neither has an entry
384 * for DLT_PFSYNC, so it might not be able to write out dump files
385 * with 18 as the link-layer header type. (Earlier versions might
386 * not have done mapping, in which case they'd work the same way
387 * OpenBSD does.)
389 * Mac OS X defines it as 18, but doesn't appear to use it as of
390 * Mac OS X 10.7.3. Its libpcap does DLT_ <-> LINKTYPE_ mapping.
392 * We'll define DLT_PFSYNC as 121 on FreeBSD and define it as 18 on
393 * all other platforms. We'll define DLT_HHDLC as 121 on everything
394 * except for FreeBSD; anybody who wants to compile, on FreeBSD, code
395 * that uses DLT_HHDLC is out of luck.
397 * We'll define LINKTYPE_PFSYNC as 18, *even on FreeBSD*, and map
398 * it, so that savefiles won't use 121 for PFSYNC - they'll all
399 * use 18. Code that uses pcap_datalink() to determine the link-layer
400 * header type of a savefile won't, when built and run on FreeBSD,
401 * be able to distinguish between LINKTYPE_PFSYNC and LINKTYPE_HHDLC
402 * capture files; code that doesn't, such as the code in Wireshark,
403 * will be able to distinguish between them.
405 #ifdef __FreeBSD__
406 #define DLT_PFSYNC 121
407 #else
408 #define DLT_HHDLC 121
409 #endif
412 * This is for RFC 2625 IP-over-Fibre Channel.
414 * This is not for use with raw Fibre Channel, where the link-layer
415 * header starts with a Fibre Channel frame header; it's for IP-over-FC,
416 * where the link-layer header starts with an RFC 2625 Network_Header
417 * field.
419 #define DLT_IP_OVER_FC 122
422 * This is for Full Frontal ATM on Solaris with SunATM, with a
423 * pseudo-header followed by an AALn PDU.
425 * There may be other forms of Full Frontal ATM on other OSes,
426 * with different pseudo-headers.
428 * If ATM software returns a pseudo-header with VPI/VCI information
429 * (and, ideally, packet type information, e.g. signalling, ILMI,
430 * LANE, LLC-multiplexed traffic, etc.), it should not use
431 * DLT_ATM_RFC1483, but should get a new DLT_ value, so tcpdump
432 * and the like don't have to infer the presence or absence of a
433 * pseudo-header and the form of the pseudo-header.
435 #define DLT_SUNATM 123 /* Solaris+SunATM */
438 * Reserved as per request from Kent Dahlgren <kent@praesum.com>
439 * for private use.
441 #define DLT_RIO 124 /* RapidIO */
442 #define DLT_PCI_EXP 125 /* PCI Express */
443 #define DLT_AURORA 126 /* Xilinx Aurora link layer */
446 * Header for 802.11 plus a number of bits of link-layer information
447 * including radio information, used by some recent BSD drivers as
448 * well as the madwifi Atheros driver for Linux.
450 #define DLT_IEEE802_11_RADIO 127 /* 802.11 plus radiotap radio header */
453 * Reserved for the TZSP encapsulation, as per request from
454 * Chris Waters <chris.waters@networkchemistry.com>
455 * TZSP is a generic encapsulation for any other link type,
456 * which includes a means to include meta-information
457 * with the packet, e.g. signal strength and channel
458 * for 802.11 packets.
460 #define DLT_TZSP 128 /* Tazmen Sniffer Protocol */
463 * BSD's ARCNET headers have the source host, destination host,
464 * and type at the beginning of the packet; that's what's handed
465 * up to userland via BPF.
467 * Linux's ARCNET headers, however, have a 2-byte offset field
468 * between the host IDs and the type; that's what's handed up
469 * to userland via PF_PACKET sockets.
471 * We therefore have to have separate DLT_ values for them.
473 #define DLT_ARCNET_LINUX 129 /* ARCNET */
476 * Juniper-private data link types, as per request from
477 * Hannes Gredler <hannes@juniper.net>. The DLT_s are used
478 * for passing on chassis-internal metainformation such as
479 * QOS profiles, etc..
481 #define DLT_JUNIPER_MLPPP 130
482 #define DLT_JUNIPER_MLFR 131
483 #define DLT_JUNIPER_ES 132
484 #define DLT_JUNIPER_GGSN 133
485 #define DLT_JUNIPER_MFR 134
486 #define DLT_JUNIPER_ATM2 135
487 #define DLT_JUNIPER_SERVICES 136
488 #define DLT_JUNIPER_ATM1 137
491 * Apple IP-over-IEEE 1394, as per a request from Dieter Siegmund
492 * <dieter@apple.com>. The header that's presented is an Ethernet-like
493 * header:
495 * #define FIREWIRE_EUI64_LEN 8
496 * struct firewire_header {
497 * u_char firewire_dhost[FIREWIRE_EUI64_LEN];
498 * u_char firewire_shost[FIREWIRE_EUI64_LEN];
499 * u_short firewire_type;
500 * };
502 * with "firewire_type" being an Ethernet type value, rather than,
503 * for example, raw GASP frames being handed up.
505 #define DLT_APPLE_IP_OVER_IEEE1394 138
508 * Various SS7 encapsulations, as per a request from Jeff Morriss
509 * <jeff.morriss[AT]ulticom.com> and subsequent discussions.
511 #define DLT_MTP2_WITH_PHDR 139 /* pseudo-header with various info, followed by MTP2 */
512 #define DLT_MTP2 140 /* MTP2, without pseudo-header */
513 #define DLT_MTP3 141 /* MTP3, without pseudo-header or MTP2 */
514 #define DLT_SCCP 142 /* SCCP, without pseudo-header or MTP2 or MTP3 */
517 * DOCSIS MAC frames.
519 #define DLT_DOCSIS 143
522 * Linux-IrDA packets. Protocol defined at http://www.irda.org.
523 * Those packets include IrLAP headers and above (IrLMP...), but
524 * don't include Phy framing (SOF/EOF/CRC & byte stuffing), because Phy
525 * framing can be handled by the hardware and depend on the bitrate.
526 * This is exactly the format you would get capturing on a Linux-IrDA
527 * interface (irdaX), but not on a raw serial port.
528 * Note the capture is done in "Linux-cooked" mode, so each packet include
529 * a fake packet header (struct sll_header). This is because IrDA packet
530 * decoding is dependant on the direction of the packet (incomming or
531 * outgoing).
532 * When/if other platform implement IrDA capture, we may revisit the
533 * issue and define a real DLT_IRDA...
534 * Jean II
536 #define DLT_LINUX_IRDA 144
539 * Reserved for IBM SP switch and IBM Next Federation switch.
541 #define DLT_IBM_SP 145
542 #define DLT_IBM_SN 146
545 * Reserved for private use. If you have some link-layer header type
546 * that you want to use within your organization, with the capture files
547 * using that link-layer header type not ever be sent outside your
548 * organization, you can use these values.
550 * No libpcap release will use these for any purpose, nor will any
551 * tcpdump release use them, either.
553 * Do *NOT* use these in capture files that you expect anybody not using
554 * your private versions of capture-file-reading tools to read; in
555 * particular, do *NOT* use them in products, otherwise you may find that
556 * people won't be able to use tcpdump, or snort, or Ethereal, or... to
557 * read capture files from your firewall/intrusion detection/traffic
558 * monitoring/etc. appliance, or whatever product uses that DLT_ value,
559 * and you may also find that the developers of those applications will
560 * not accept patches to let them read those files.
562 * Also, do not use them if somebody might send you a capture using them
563 * for *their* private type and tools using them for *your* private type
564 * would have to read them.
566 * Instead, ask "tcpdump-workers@lists.tcpdump.org" for a new DLT_ value,
567 * as per the comment above, and use the type you're given.
569 #define DLT_USER0 147
570 #define DLT_USER1 148
571 #define DLT_USER2 149
572 #define DLT_USER3 150
573 #define DLT_USER4 151
574 #define DLT_USER5 152
575 #define DLT_USER6 153
576 #define DLT_USER7 154
577 #define DLT_USER8 155
578 #define DLT_USER9 156
579 #define DLT_USER10 157
580 #define DLT_USER11 158
581 #define DLT_USER12 159
582 #define DLT_USER13 160
583 #define DLT_USER14 161
584 #define DLT_USER15 162
587 * For future use with 802.11 captures - defined by AbsoluteValue
588 * Systems to store a number of bits of link-layer information
589 * including radio information:
591 * http://www.shaftnet.org/~pizza/software/capturefrm.txt
593 * but it might be used by some non-AVS drivers now or in the
594 * future.
596 #define DLT_IEEE802_11_RADIO_AVS 163 /* 802.11 plus AVS radio header */
599 * Juniper-private data link type, as per request from
600 * Hannes Gredler <hannes@juniper.net>. The DLT_s are used
601 * for passing on chassis-internal metainformation such as
602 * QOS profiles, etc..
604 #define DLT_JUNIPER_MONITOR 164
607 * BACnet MS/TP frames.
609 #define DLT_BACNET_MS_TP 165
612 * Another PPP variant as per request from Karsten Keil <kkeil@suse.de>.
614 * This is used in some OSes to allow a kernel socket filter to distinguish
615 * between incoming and outgoing packets, on a socket intended to
616 * supply pppd with outgoing packets so it can do dial-on-demand and
617 * hangup-on-lack-of-demand; incoming packets are filtered out so they
618 * don't cause pppd to hold the connection up (you don't want random
619 * input packets such as port scans, packets from old lost connections,
620 * etc. to force the connection to stay up).
622 * The first byte of the PPP header (0xff03) is modified to accomodate
623 * the direction - 0x00 = IN, 0x01 = OUT.
625 #define DLT_PPP_PPPD 166
628 * Names for backwards compatibility with older versions of some PPP
629 * software; new software should use DLT_PPP_PPPD.
631 #define DLT_PPP_WITH_DIRECTION DLT_PPP_PPPD
632 #define DLT_LINUX_PPP_WITHDIRECTION DLT_PPP_PPPD
635 * Juniper-private data link type, as per request from
636 * Hannes Gredler <hannes@juniper.net>. The DLT_s are used
637 * for passing on chassis-internal metainformation such as
638 * QOS profiles, cookies, etc..
640 #define DLT_JUNIPER_PPPOE 167
641 #define DLT_JUNIPER_PPPOE_ATM 168
643 #define DLT_GPRS_LLC 169 /* GPRS LLC */
644 #define DLT_GPF_T 170 /* GPF-T (ITU-T G.7041/Y.1303) */
645 #define DLT_GPF_F 171 /* GPF-F (ITU-T G.7041/Y.1303) */
648 * Requested by Oolan Zimmer <oz@gcom.com> for use in Gcom's T1/E1 line
649 * monitoring equipment.
651 #define DLT_GCOM_T1E1 172
652 #define DLT_GCOM_SERIAL 173
655 * Juniper-private data link type, as per request from
656 * Hannes Gredler <hannes@juniper.net>. The DLT_ is used
657 * for internal communication to Physical Interface Cards (PIC)
659 #define DLT_JUNIPER_PIC_PEER 174
662 * Link types requested by Gregor Maier <gregor@endace.com> of Endace
663 * Measurement Systems. They add an ERF header (see
664 * http://www.endace.com/support/EndaceRecordFormat.pdf) in front of
665 * the link-layer header.
667 #define DLT_ERF_ETH 175 /* Ethernet */
668 #define DLT_ERF_POS 176 /* Packet-over-SONET */
671 * Requested by Daniele Orlandi <daniele@orlandi.com> for raw LAPD
672 * for vISDN (http://www.orlandi.com/visdn/). Its link-layer header
673 * includes additional information before the LAPD header, so it's
674 * not necessarily a generic LAPD header.
676 #define DLT_LINUX_LAPD 177
679 * Juniper-private data link type, as per request from
680 * Hannes Gredler <hannes@juniper.net>.
681 * The DLT_ are used for prepending meta-information
682 * like interface index, interface name
683 * before standard Ethernet, PPP, Frelay & C-HDLC Frames
685 #define DLT_JUNIPER_ETHER 178
686 #define DLT_JUNIPER_PPP 179
687 #define DLT_JUNIPER_FRELAY 180
688 #define DLT_JUNIPER_CHDLC 181
691 * Multi Link Frame Relay (FRF.16)
693 #define DLT_MFR 182
696 * Juniper-private data link type, as per request from
697 * Hannes Gredler <hannes@juniper.net>.
698 * The DLT_ is used for internal communication with a
699 * voice Adapter Card (PIC)
701 #define DLT_JUNIPER_VP 183
704 * Arinc 429 frames.
705 * DLT_ requested by Gianluca Varenni <gianluca.varenni@cacetech.com>.
706 * Every frame contains a 32bit A429 label.
707 * More documentation on Arinc 429 can be found at
708 * http://www.condoreng.com/support/downloads/tutorials/ARINCTutorial.pdf
710 #define DLT_A429 184
713 * Arinc 653 Interpartition Communication messages.
714 * DLT_ requested by Gianluca Varenni <gianluca.varenni@cacetech.com>.
715 * Please refer to the A653-1 standard for more information.
717 #define DLT_A653_ICM 185
720 * USB packets, beginning with a USB setup header; requested by
721 * Paolo Abeni <paolo.abeni@email.it>.
723 #define DLT_USB 186
726 * Bluetooth HCI UART transport layer (part H:4); requested by
727 * Paolo Abeni.
729 #define DLT_BLUETOOTH_HCI_H4 187
732 * IEEE 802.16 MAC Common Part Sublayer; requested by Maria Cruz
733 * <cruz_petagay@bah.com>.
735 #define DLT_IEEE802_16_MAC_CPS 188
738 * USB packets, beginning with a Linux USB header; requested by
739 * Paolo Abeni <paolo.abeni@email.it>.
741 #define DLT_USB_LINUX 189
744 * Controller Area Network (CAN) v. 2.0B packets.
745 * DLT_ requested by Gianluca Varenni <gianluca.varenni@cacetech.com>.
746 * Used to dump CAN packets coming from a CAN Vector board.
747 * More documentation on the CAN v2.0B frames can be found at
748 * http://www.can-cia.org/downloads/?269
750 #define DLT_CAN20B 190
753 * IEEE 802.15.4, with address fields padded, as is done by Linux
754 * drivers; requested by Juergen Schimmer.
756 #define DLT_IEEE802_15_4_LINUX 191
759 * Per Packet Information encapsulated packets.
760 * DLT_ requested by Gianluca Varenni <gianluca.varenni@cacetech.com>.
762 #define DLT_PPI 192
765 * Header for 802.16 MAC Common Part Sublayer plus a radiotap radio header;
766 * requested by Charles Clancy.
768 #define DLT_IEEE802_16_MAC_CPS_RADIO 193
771 * Juniper-private data link type, as per request from
772 * Hannes Gredler <hannes@juniper.net>.
773 * The DLT_ is used for internal communication with a
774 * integrated service module (ISM).
776 #define DLT_JUNIPER_ISM 194
779 * IEEE 802.15.4, exactly as it appears in the spec (no padding, no
780 * nothing); requested by Mikko Saarnivala <mikko.saarnivala@sensinode.com>.
781 * For this one, we expect the FCS to be present at the end of the frame;
782 * if the frame has no FCS, DLT_IEEE802_15_4_NOFCS should be used.
784 #define DLT_IEEE802_15_4 195
787 * Various link-layer types, with a pseudo-header, for SITA
788 * (http://www.sita.aero/); requested by Fulko Hew (fulko.hew@gmail.com).
790 #define DLT_SITA 196
793 * Various link-layer types, with a pseudo-header, for Endace DAG cards;
794 * encapsulates Endace ERF records. Requested by Stephen Donnelly
795 * <stephen@endace.com>.
797 #define DLT_ERF 197
800 * Special header prepended to Ethernet packets when capturing from a
801 * u10 Networks board. Requested by Phil Mulholland
802 * <phil@u10networks.com>.
804 #define DLT_RAIF1 198
807 * IPMB packet for IPMI, beginning with the I2C slave address, followed
808 * by the netFn and LUN, etc.. Requested by Chanthy Toeung
809 * <chanthy.toeung@ca.kontron.com>.
811 #define DLT_IPMB 199
814 * Juniper-private data link type, as per request from
815 * Hannes Gredler <hannes@juniper.net>.
816 * The DLT_ is used for capturing data on a secure tunnel interface.
818 #define DLT_JUNIPER_ST 200
821 * Bluetooth HCI UART transport layer (part H:4), with pseudo-header
822 * that includes direction information; requested by Paolo Abeni.
824 #define DLT_BLUETOOTH_HCI_H4_WITH_PHDR 201
827 * AX.25 packet with a 1-byte KISS header; see
829 * http://www.ax25.net/kiss.htm
831 * as per Richard Stearn <richard@rns-stearn.demon.co.uk>.
833 #define DLT_AX25_KISS 202
836 * LAPD packets from an ISDN channel, starting with the address field,
837 * with no pseudo-header.
838 * Requested by Varuna De Silva <varunax@gmail.com>.
840 #define DLT_LAPD 203
843 * Variants of various link-layer headers, with a one-byte direction
844 * pseudo-header prepended - zero means "received by this host",
845 * non-zero (any non-zero value) means "sent by this host" - as per
846 * Will Barker <w.barker@zen.co.uk>.
848 #define DLT_PPP_WITH_DIR 204 /* PPP - don't confuse with DLT_PPP_WITH_DIRECTION */
849 #define DLT_C_HDLC_WITH_DIR 205 /* Cisco HDLC */
850 #define DLT_FRELAY_WITH_DIR 206 /* Frame Relay */
851 #define DLT_LAPB_WITH_DIR 207 /* LAPB */
854 * 208 is reserved for an as-yet-unspecified proprietary link-layer
855 * type, as requested by Will Barker.
859 * IPMB with a Linux-specific pseudo-header; as requested by Alexey Neyman
860 * <avn@pigeonpoint.com>.
862 #define DLT_IPMB_LINUX 209
865 * FlexRay automotive bus - http://www.flexray.com/ - as requested
866 * by Hannes Kaelber <hannes.kaelber@x2e.de>.
868 #define DLT_FLEXRAY 210
871 * Media Oriented Systems Transport (MOST) bus for multimedia
872 * transport - http://www.mostcooperation.com/ - as requested
873 * by Hannes Kaelber <hannes.kaelber@x2e.de>.
875 #define DLT_MOST 211
878 * Local Interconnect Network (LIN) bus for vehicle networks -
879 * http://www.lin-subbus.org/ - as requested by Hannes Kaelber
880 * <hannes.kaelber@x2e.de>.
882 #define DLT_LIN 212
885 * X2E-private data link type used for serial line capture,
886 * as requested by Hannes Kaelber <hannes.kaelber@x2e.de>.
888 #define DLT_X2E_SERIAL 213
891 * X2E-private data link type used for the Xoraya data logger
892 * family, as requested by Hannes Kaelber <hannes.kaelber@x2e.de>.
894 #define DLT_X2E_XORAYA 214
897 * IEEE 802.15.4, exactly as it appears in the spec (no padding, no
898 * nothing), but with the PHY-level data for non-ASK PHYs (4 octets
899 * of 0 as preamble, one octet of SFD, one octet of frame length+
900 * reserved bit, and then the MAC-layer data, starting with the
901 * frame control field).
903 * Requested by Max Filippov <jcmvbkbc@gmail.com>.
905 #define DLT_IEEE802_15_4_NONASK_PHY 215
908 * David Gibson <david@gibson.dropbear.id.au> requested this for
909 * captures from the Linux kernel /dev/input/eventN devices. This
910 * is used to communicate keystrokes and mouse movements from the
911 * Linux kernel to display systems, such as Xorg.
913 #define DLT_LINUX_EVDEV 216
916 * GSM Um and Abis interfaces, preceded by a "gsmtap" header.
918 * Requested by Harald Welte <laforge@gnumonks.org>.
920 #define DLT_GSMTAP_UM 217
921 #define DLT_GSMTAP_ABIS 218
924 * MPLS, with an MPLS label as the link-layer header.
925 * Requested by Michele Marchetto <michele@openbsd.org> on behalf
926 * of OpenBSD.
928 #define DLT_MPLS 219
931 * USB packets, beginning with a Linux USB header, with the USB header
932 * padded to 64 bytes; required for memory-mapped access.
934 #define DLT_USB_LINUX_MMAPPED 220
937 * DECT packets, with a pseudo-header; requested by
938 * Matthias Wenzel <tcpdump@mazzoo.de>.
940 #define DLT_DECT 221
943 * From: "Lidwa, Eric (GSFC-582.0)[SGT INC]" <eric.lidwa-1@nasa.gov>
944 * Date: Mon, 11 May 2009 11:18:30 -0500
946 * DLT_AOS. We need it for AOS Space Data Link Protocol.
947 * I have already written dissectors for but need an OK from
948 * legal before I can submit a patch.
951 #define DLT_AOS 222
954 * Wireless HART (Highway Addressable Remote Transducer)
955 * From the HART Communication Foundation
956 * IES/PAS 62591
958 * Requested by Sam Roberts <vieuxtech@gmail.com>.
960 #define DLT_WIHART 223
963 * Fibre Channel FC-2 frames, beginning with a Frame_Header.
964 * Requested by Kahou Lei <kahou82@gmail.com>.
966 #define DLT_FC_2 224
969 * Fibre Channel FC-2 frames, beginning with an encoding of the
970 * SOF, and ending with an encoding of the EOF.
972 * The encodings represent the frame delimiters as 4-byte sequences
973 * representing the corresponding ordered sets, with K28.5
974 * represented as 0xBC, and the D symbols as the corresponding
975 * byte values; for example, SOFi2, which is K28.5 - D21.5 - D1.2 - D21.2,
976 * is represented as 0xBC 0xB5 0x55 0x55.
978 * Requested by Kahou Lei <kahou82@gmail.com>.
980 #define DLT_FC_2_WITH_FRAME_DELIMS 225
983 * Solaris ipnet pseudo-header; requested by Darren Reed <Darren.Reed@Sun.COM>.
985 * The pseudo-header starts with a one-byte version number; for version 2,
986 * the pseudo-header is:
988 * struct dl_ipnetinfo {
989 * u_int8_t dli_version;
990 * u_int8_t dli_family;
991 * u_int16_t dli_htype;
992 * u_int32_t dli_pktlen;
993 * u_int32_t dli_ifindex;
994 * u_int32_t dli_grifindex;
995 * u_int32_t dli_zsrc;
996 * u_int32_t dli_zdst;
997 * };
999 * dli_version is 2 for the current version of the pseudo-header.
1001 * dli_family is a Solaris address family value, so it's 2 for IPv4
1002 * and 26 for IPv6.
1004 * dli_htype is a "hook type" - 0 for incoming packets, 1 for outgoing
1005 * packets, and 2 for packets arriving from another zone on the same
1006 * machine.
1008 * dli_pktlen is the length of the packet data following the pseudo-header
1009 * (so the captured length minus dli_pktlen is the length of the
1010 * pseudo-header, assuming the entire pseudo-header was captured).
1012 * dli_ifindex is the interface index of the interface on which the
1013 * packet arrived.
1015 * dli_grifindex is the group interface index number (for IPMP interfaces).
1017 * dli_zsrc is the zone identifier for the source of the packet.
1019 * dli_zdst is the zone identifier for the destination of the packet.
1021 * A zone number of 0 is the global zone; a zone number of 0xffffffff
1022 * means that the packet arrived from another host on the network, not
1023 * from another zone on the same machine.
1025 * An IPv4 or IPv6 datagram follows the pseudo-header; dli_family indicates
1026 * which of those it is.
1028 #define DLT_IPNET 226
1031 * CAN (Controller Area Network) frames, with a pseudo-header as supplied
1032 * by Linux SocketCAN. See Documentation/networking/can.txt in the Linux
1033 * source.
1035 * Requested by Felix Obenhuber <felix@obenhuber.de>.
1037 #define DLT_CAN_SOCKETCAN 227
1040 * Raw IPv4/IPv6; different from DLT_RAW in that the DLT_ value specifies
1041 * whether it's v4 or v6. Requested by Darren Reed <Darren.Reed@Sun.COM>.
1043 #define DLT_IPV4 228
1044 #define DLT_IPV6 229
1047 * IEEE 802.15.4, exactly as it appears in the spec (no padding, no
1048 * nothing), and with no FCS at the end of the frame; requested by
1049 * Jon Smirl <jonsmirl@gmail.com>.
1051 #define DLT_IEEE802_15_4_NOFCS 230
1054 * Raw D-Bus:
1056 * http://www.freedesktop.org/wiki/Software/dbus
1058 * messages:
1060 * http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-messages
1062 * starting with the endianness flag, followed by the message type, etc.,
1063 * but without the authentication handshake before the message sequence:
1065 * http://dbus.freedesktop.org/doc/dbus-specification.html#auth-protocol
1067 * Requested by Martin Vidner <martin@vidner.net>.
1069 #define DLT_DBUS 231
1072 * Juniper-private data link type, as per request from
1073 * Hannes Gredler <hannes@juniper.net>.
1075 #define DLT_JUNIPER_VS 232
1076 #define DLT_JUNIPER_SRX_E2E 233
1077 #define DLT_JUNIPER_FIBRECHANNEL 234
1080 * DVB-CI (DVB Common Interface for communication between a PC Card
1081 * module and a DVB receiver). See
1083 * http://www.kaiser.cx/pcap-dvbci.html
1085 * for the specification.
1087 * Requested by Martin Kaiser <martin@kaiser.cx>.
1089 #define DLT_DVB_CI 235
1092 * Variant of 3GPP TS 27.010 multiplexing protocol (similar to, but
1093 * *not* the same as, 27.010). Requested by Hans-Christoph Schemmel
1094 * <hans-christoph.schemmel@cinterion.com>.
1096 #define DLT_MUX27010 236
1099 * STANAG 5066 D_PDUs. Requested by M. Baris Demiray
1100 * <barisdemiray@gmail.com>.
1102 #define DLT_STANAG_5066_D_PDU 237
1105 * Juniper-private data link type, as per request from
1106 * Hannes Gredler <hannes@juniper.net>.
1108 #define DLT_JUNIPER_ATM_CEMIC 238
1111 * NetFilter LOG messages
1112 * (payload of netlink NFNL_SUBSYS_ULOG/NFULNL_MSG_PACKET packets)
1114 * Requested by Jakub Zawadzki <darkjames-ws@darkjames.pl>
1116 #define DLT_NFLOG 239
1119 * Hilscher Gesellschaft fuer Systemautomation mbH link-layer type
1120 * for Ethernet packets with a 4-byte pseudo-header and always
1121 * with the payload including the FCS, as supplied by their
1122 * netANALYZER hardware and software.
1124 * Requested by Holger P. Frommer <HPfrommer@hilscher.com>
1126 #define DLT_NETANALYZER 240
1129 * Hilscher Gesellschaft fuer Systemautomation mbH link-layer type
1130 * for Ethernet packets with a 4-byte pseudo-header and FCS and
1131 * with the Ethernet header preceded by 7 bytes of preamble and
1132 * 1 byte of SFD, as supplied by their netANALYZER hardware and
1133 * software.
1135 * Requested by Holger P. Frommer <HPfrommer@hilscher.com>
1137 #define DLT_NETANALYZER_TRANSPARENT 241
1140 * IP-over-InfiniBand, as specified by RFC 4391.
1142 * Requested by Petr Sumbera <petr.sumbera@oracle.com>.
1144 #define DLT_IPOIB 242
1147 * MPEG-2 transport stream (ISO 13818-1/ITU-T H.222.0).
1149 * Requested by Guy Martin <gmsoft@tuxicoman.be>.
1151 #define DLT_MPEG_2_TS 243
1154 * ng4T GmbH's UMTS Iub/Iur-over-ATM and Iub/Iur-over-IP format as
1155 * used by their ng40 protocol tester.
1157 * Requested by Jens Grimmer <jens.grimmer@ng4t.com>.
1159 #define DLT_NG40 244
1162 * Pseudo-header giving adapter number and flags, followed by an NFC
1163 * (Near-Field Communications) Logical Link Control Protocol (LLCP) PDU,
1164 * as specified by NFC Forum Logical Link Control Protocol Technical
1165 * Specification LLCP 1.1.
1167 * Requested by Mike Wakerly <mikey@google.com>.
1169 #define DLT_NFC_LLCP 245
1172 * 245 is used as LINKTYPE_PFSYNC; do not use it for any other purpose.
1174 * DLT_PFSYNC has different values on different platforms, and all of
1175 * them collide with something used elsewhere. On platforms that
1176 * don't already define it, define it as 245.
1178 #if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__DragonFly__) && !defined(__APPLE__)
1179 #define DLT_PFSYNC 246
1180 #endif
1183 * Raw InfiniBand packets, starting with the Local Routing Header.
1185 * Requested by Oren Kladnitsky <orenk@mellanox.com>.
1187 #define DLT_INFINIBAND 247
1190 * SCTP, with no lower-level protocols (i.e., no IPv4 or IPv6).
1192 * Requested by Michael Tuexen <Michael.Tuexen@lurchi.franken.de>.
1194 #define DLT_SCTP 248
1197 * USB packets, beginning with a USBPcap header.
1199 * Requested by Tomasz Mon <desowin@gmail.com>
1201 #define DLT_USBPCAP 249
1204 * Schweitzer Engineering Laboratories "RTAC" product serial-line
1205 * packets.
1207 * Requested by Chris Bontje <chris_bontje@selinc.com>.
1209 #define DLT_RTAC_SERIAL 250
1212 * Bluetooth Low Energy air interface link-layer packets.
1214 * Requested by Mike Kershaw <dragorn@kismetwireless.net>.
1216 #define DLT_BLUETOOTH_LE_LL 251
1219 * DLT type for upper-protocol layer PDU saves from wireshark.
1221 * the actual contents are determined by two TAGs stored with each
1222 * packet:
1223 * EXP_PDU_TAG_LINKTYPE the link type (LINKTYPE_ value) of the
1224 * original packet.
1226 * EXP_PDU_TAG_PROTO_NAME the name of the wireshark dissector
1227 * that can make sense of the data stored.
1229 #define DLT_WIRESHARK_UPPER_PDU 252
1232 * DLT type for the netlink protocol (nlmon devices).
1234 #define DLT_NETLINK 253
1237 * Bluetooth Linux Monitor headers for the BlueZ stack.
1239 #define DLT_BLUETOOTH_LINUX_MONITOR 254
1242 * Bluetooth Basic Rate/Enhanced Data Rate baseband packets, as
1243 * captured by Ubertooth.
1245 #define DLT_BLUETOOTH_BREDR_BB 255
1248 * Bluetooth Low Energy link layer packets, as captured by Ubertooth.
1250 #define DLT_BLUETOOTH_LE_LL_WITH_PHDR 256
1253 * PROFIBUS data link layer.
1255 #define DLT_PROFIBUS_DL 257
1258 * Apple's DLT_PKTAP headers.
1260 * Sadly, the folks at Apple either had no clue that the DLT_USERn values
1261 * are for internal use within an organization and partners only, and
1262 * didn't know that the right way to get a link-layer header type is to
1263 * ask tcpdump.org for one, or knew and didn't care, so they just
1264 * used DLT_USER2, which causes problems for everything except for
1265 * their version of tcpdump.
1267 * So I'll just give them one; hopefully this will show up in a
1268 * libpcap release in time for them to get this into 10.10 Big Sur
1269 * or whatever Mavericks' successor is called. LINKTYPE_PKTAP
1270 * will be 258 *even on OS X*; that is *intentional*, so that
1271 * PKTAP files look the same on *all* OSes (different OSes can have
1272 * different numerical values for a given DLT_, but *MUST NOT* have
1273 * different values for what goes in a file, as files can be moved
1274 * between OSes!).
1276 * When capturing, on a system with a Darwin-based OS, on a device
1277 * that returns 149 (DLT_USER2 and Apple's DLT_PKTAP) with this
1278 * version of libpcap, the DLT_ value for the pcap_t will be DLT_PKTAP,
1279 * and that will continue to be DLT_USER2 on Darwin-based OSes. That way,
1280 * binary compatibility with Mavericks is preserved for programs using
1281 * this version of libpcap. This does mean that if you were using
1282 * DLT_USER2 for some capture device on OS X, you can't do so with
1283 * this version of libpcap, just as you can't with Apple's libpcap -
1284 * on OS X, they define DLT_PKTAP to be DLT_USER2, so programs won't
1285 * be able to distinguish between PKTAP and whatever you were using
1286 * DLT_USER2 for.
1288 * If the program saves the capture to a file using this version of
1289 * libpcap's pcap_dump code, the LINKTYPE_ value in the file will be
1290 * LINKTYPE_PKTAP, which will be 258, even on Darwin-based OSes.
1291 * That way, the file will *not* be a DLT_USER2 file. That means
1292 * that the latest version of tcpdump, when built with this version
1293 * of libpcap, and sufficiently recent versions of Wireshark will
1294 * be able to read those files and interpret them correctly; however,
1295 * Apple's version of tcpdump in OS X 10.9 won't be able to handle
1296 * them. (Hopefully, Apple will pick up this version of libpcap,
1297 * and the corresponding version of tcpdump, so that tcpdump will
1298 * be able to handle the old LINKTYPE_USER2 captures *and* the new
1299 * LINKTYPE_PKTAP captures.)
1301 #ifdef __APPLE__
1302 #define DLT_PKTAP DLT_USER2
1303 #else
1304 #define DLT_PKTAP 258
1305 #endif
1308 * Ethernet packets preceded by a header giving the last 6 octets
1309 * of the preamble specified by 802.3-2012 Clause 65, section
1310 * 65.1.3.2 "Transmit".
1312 #define DLT_EPON 259
1315 * IPMI trace packets, as specified by Table 3-20 "Trace Data Block Format"
1316 * in the PICMG HPM.2 specification.
1318 #define DLT_IPMI_HPM_2 260
1321 * per Joshua Wright <jwright@hasborg.com>, formats for Zwave captures.
1323 #define DLT_ZWAVE_R1_R2 261
1324 #define DLT_ZWAVE_R3 262
1327 * per Steve Karg <skarg@users.sourceforge.net>, formats for Wattstopper
1328 * Digital Lighting Management room bus serial protocol captures.
1330 #define DLT_WATTSTOPPER_DLM 263
1332 #define DLT_MATCHING_MAX 263 /* highest value in the "matching" range */
1335 * DLT and savefile link type values are split into a class and
1336 * a member of that class. A class value of 0 indicates a regular
1337 * DLT_/LINKTYPE_ value.
1339 #define DLT_CLASS(x) ((x) & 0x03ff0000)
1342 * NetBSD-specific generic "raw" link type. The class value indicates
1343 * that this is the generic raw type, and the lower 16 bits are the
1344 * address family we're dealing with. Those values are NetBSD-specific;
1345 * do not assume that they correspond to AF_ values for your operating
1346 * system.
1348 #define DLT_CLASS_NETBSD_RAWAF 0x02240000
1349 #define DLT_NETBSD_RAWAF(af) (DLT_CLASS_NETBSD_RAWAF | (af))
1350 #define DLT_NETBSD_RAWAF_AF(x) ((x) & 0x0000ffff)
1351 #define DLT_IS_NETBSD_RAWAF(x) (DLT_CLASS(x) == DLT_CLASS_NETBSD_RAWAF)
1355 * The instruction encodings.
1357 * Please inform tcpdump-workers@lists.tcpdump.org if you use any
1358 * of the reserved values, so that we can note that they're used
1359 * (and perhaps implement it in the reference BPF implementation
1360 * and encourage its implementation elsewhere).
1364 * The upper 8 bits of the opcode aren't used. BSD/OS used 0x8000.
1367 /* instruction classes */
1368 #define BPF_CLASS(code) ((code) & 0x07)
1369 #define BPF_LD 0x00
1370 #define BPF_LDX 0x01
1371 #define BPF_ST 0x02
1372 #define BPF_STX 0x03
1373 #define BPF_ALU 0x04
1374 #define BPF_JMP 0x05
1375 #define BPF_RET 0x06
1376 #define BPF_MISC 0x07
1378 /* ld/ldx fields */
1379 #define BPF_SIZE(code) ((code) & 0x18)
1380 #define BPF_W 0x00
1381 #define BPF_H 0x08
1382 #define BPF_B 0x10
1383 /* 0x18 reserved; used by BSD/OS */
1384 #define BPF_MODE(code) ((code) & 0xe0)
1385 #define BPF_IMM 0x00
1386 #define BPF_ABS 0x20
1387 #define BPF_IND 0x40
1388 #define BPF_MEM 0x60
1389 #define BPF_LEN 0x80
1390 #define BPF_MSH 0xa0
1391 /* 0xc0 reserved; used by BSD/OS */
1392 /* 0xe0 reserved; used by BSD/OS */
1394 /* alu/jmp fields */
1395 #define BPF_OP(code) ((code) & 0xf0)
1396 #define BPF_ADD 0x00
1397 #define BPF_SUB 0x10
1398 #define BPF_MUL 0x20
1399 #define BPF_DIV 0x30
1400 #define BPF_OR 0x40
1401 #define BPF_AND 0x50
1402 #define BPF_LSH 0x60
1403 #define BPF_RSH 0x70
1404 #define BPF_NEG 0x80
1405 #define BPF_MOD 0x90
1406 #define BPF_XOR 0xa0
1407 /* 0xb0 reserved */
1408 /* 0xc0 reserved */
1409 /* 0xd0 reserved */
1410 /* 0xe0 reserved */
1411 /* 0xf0 reserved */
1413 #define BPF_JA 0x00
1414 #define BPF_JEQ 0x10
1415 #define BPF_JGT 0x20
1416 #define BPF_JGE 0x30
1417 #define BPF_JSET 0x40
1418 /* 0x50 reserved; used on BSD/OS */
1419 /* 0x60 reserved */
1420 /* 0x70 reserved */
1421 /* 0x80 reserved */
1422 /* 0x90 reserved */
1423 /* 0xa0 reserved */
1424 /* 0xb0 reserved */
1425 /* 0xc0 reserved */
1426 /* 0xd0 reserved */
1427 /* 0xe0 reserved */
1428 /* 0xf0 reserved */
1429 #define BPF_SRC(code) ((code) & 0x08)
1430 #define BPF_K 0x00
1431 #define BPF_X 0x08
1433 /* ret - BPF_K and BPF_X also apply */
1434 #define BPF_RVAL(code) ((code) & 0x18)
1435 #define BPF_A 0x10
1436 /* 0x18 reserved */
1438 /* misc */
1439 #define BPF_MISCOP(code) ((code) & 0xf8)
1440 #define BPF_TAX 0x00
1441 /* 0x08 reserved */
1442 /* 0x10 reserved */
1443 /* 0x18 reserved */
1444 /* #define BPF_COP 0x20 NetBSD "coprocessor" extensions */
1445 /* 0x28 reserved */
1446 /* 0x30 reserved */
1447 /* 0x38 reserved */
1448 /* #define BPF_COPX 0x40 NetBSD "coprocessor" extensions */
1449 /* also used on BSD/OS */
1450 /* 0x48 reserved */
1451 /* 0x50 reserved */
1452 /* 0x58 reserved */
1453 /* 0x60 reserved */
1454 /* 0x68 reserved */
1455 /* 0x70 reserved */
1456 /* 0x78 reserved */
1457 #define BPF_TXA 0x80
1458 /* 0x88 reserved */
1459 /* 0x90 reserved */
1460 /* 0x98 reserved */
1461 /* 0xa0 reserved */
1462 /* 0xa8 reserved */
1463 /* 0xb0 reserved */
1464 /* 0xb8 reserved */
1465 /* 0xc0 reserved; used on BSD/OS */
1466 /* 0xc8 reserved */
1467 /* 0xd0 reserved */
1468 /* 0xd8 reserved */
1469 /* 0xe0 reserved */
1470 /* 0xe8 reserved */
1471 /* 0xf0 reserved */
1472 /* 0xf8 reserved */
1475 * The instruction data structure.
1477 struct bpf_insn {
1478 u_short code;
1479 u_char jt;
1480 u_char jf;
1481 bpf_u_int32 k;
1485 * Auxiliary data, for use when interpreting a filter intended for the
1486 * Linux kernel when the kernel rejects the filter (requiring us to
1487 * run it in userland). It contains VLAN tag information.
1489 struct bpf_aux_data {
1490 u_short vlan_tag_present;
1491 u_short vlan_tag;
1495 * Macros for insn array initializers.
1497 #define BPF_STMT(code, k) { (u_short)(code), 0, 0, k }
1498 #define BPF_JUMP(code, k, jt, jf) { (u_short)(code), jt, jf, k }
1500 #if __STDC__ || defined(__cplusplus)
1501 extern int bpf_validate(const struct bpf_insn *, int);
1502 extern u_int bpf_filter(const struct bpf_insn *, const u_char *, u_int, u_int);
1503 extern u_int bpf_filter_with_aux_data(const struct bpf_insn *, const u_char *, u_int, u_int, const struct bpf_aux_data *);
1504 #else
1505 extern int bpf_validate();
1506 extern u_int bpf_filter();
1507 extern u_int bpf_filter();
1508 #endif
1511 * Number of scratch memory words (for BPF_LD|BPF_MEM and BPF_ST).
1513 #define BPF_MEMWORDS 16
1515 #ifdef __cplusplus
1517 #endif
1519 #endif /* !defined(_NET_BPF_H_) && !defined(_BPF_H_) && !defined(_H_BPF) && !defined(lib_pcap_bpf_h) */