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