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