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