154359Sroberto/* $FreeBSD: releng/10.2/contrib/ipfilter/pcap-bpf.h 146277 2005-05-16 16:22:55Z darrenr $ */ 2182007Sroberto 354359Sroberto/*- 4182007Sroberto * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 554359Sroberto * The Regents of the University of California. All rights reserved. 6285612Sdelphij * 7285612Sdelphij * This code is derived from the Stanford/CMU enet packet filter, 854359Sroberto * (net/enet.c) distributed as part of 4.3BSD, and code contributed 9182007Sroberto * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence 10182007Sroberto * Berkeley Laboratory. 11182007Sroberto * 12182007Sroberto * Redistribution and use in source and binary forms, with or without 13182007Sroberto * modification, are permitted provided that the following conditions 14182007Sroberto * are met: 15182007Sroberto * 1. Redistributions of source code must retain the above copyright 16182007Sroberto * notice, this list of conditions and the following disclaimer. 17182007Sroberto * 2. Redistributions in binary form must reproduce the above copyright 18182007Sroberto * notice, this list of conditions and the following disclaimer in the 19182007Sroberto * documentation and/or other materials provided with the distribution. 20182007Sroberto * 3. All advertising materials mentioning features or use of this software 21182007Sroberto * must display the following acknowledgement: 22182007Sroberto * This product includes software developed by the University of 23182007Sroberto * California, Berkeley and its contributors. 24182007Sroberto * 4. Neither the name of the University nor the names of its contributors 25182007Sroberto * may be used to endorse or promote products derived from this software 26182007Sroberto * without specific prior written permission. 27182007Sroberto * 28182007Sroberto * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 29182007Sroberto * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 30182007Sroberto * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 31182007Sroberto * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 32182007Sroberto * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 3354359Sroberto * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 3454359Sroberto * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 3554359Sroberto * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 3654359Sroberto * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3754359Sroberto * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 38182007Sroberto * SUCH DAMAGE. 3954359Sroberto * 4054359Sroberto * @(#)bpf.h 7.1 (Berkeley) 5/7/91 4154359Sroberto * 4254359Sroberto * @(#) $Header: /tcpdump/master/libpcap/pcap-bpf.h,v 1.37 2005/05/01 19:46:27 guy Exp $ (LBL) 4354359Sroberto */ 4454359Sroberto 4554359Sroberto/* 4654359Sroberto * This is libpcap's cut-down version of bpf.h; it includes only 4754359Sroberto * the stuff needed for the code generator and the userland BPF 4854359Sroberto * interpreter, and the libpcap APIs for setting filters, etc.. 4954359Sroberto * 5054359Sroberto * "pcap-bpf.c" will include the native OS version, as it deals with 5154359Sroberto * the OS's BPF implementation. 5254359Sroberto * 5354359Sroberto * XXX - should this all just be moved to "pcap.h"? 5454359Sroberto */ 5554359Sroberto 5654359Sroberto#ifndef BPF_MAJOR_VERSION 5754359Sroberto 5854359Sroberto#ifdef __cplusplus 5954359Srobertoextern "C" { 6054359Sroberto#endif 61285612Sdelphij 62285612Sdelphij/* BSD style release date */ 63285612Sdelphij#define BPF_RELEASE 199606 64285612Sdelphij 65285612Sdelphij#ifdef MSDOS /* must be 32-bit */ 6654359Srobertotypedef long bpf_int32; 6754359Srobertotypedef unsigned long bpf_u_int32; 6854359Sroberto#else 6954359Srobertotypedef int bpf_int32; 7054359Srobertotypedef u_int bpf_u_int32; 7154359Sroberto#endif 7254359Sroberto 7354359Sroberto/* 7454359Sroberto * Alignment macros. BPF_WORDALIGN rounds up to the next 7554359Sroberto * even multiple of BPF_ALIGNMENT. 7654359Sroberto */ 7754359Sroberto#ifndef __NetBSD__ 7854359Sroberto#define BPF_ALIGNMENT sizeof(bpf_int32) 7954359Sroberto#else 8054359Sroberto#define BPF_ALIGNMENT sizeof(long) 8154359Sroberto#endif 8254359Sroberto#define BPF_WORDALIGN(x) (((x)+(BPF_ALIGNMENT-1))&~(BPF_ALIGNMENT-1)) 8354359Sroberto 8454359Sroberto#define BPF_MAXINSNS 512 8554359Sroberto#define BPF_MAXBUFSIZE 0x8000 8654359Sroberto#define BPF_MINBUFSIZE 32 8754359Sroberto 8854359Sroberto/* 8954359Sroberto * Structure for "pcap_compile()", "pcap_setfilter()", etc.. 9054359Sroberto */ 9154359Srobertostruct bpf_program { 9254359Sroberto u_int bf_len; 9354359Sroberto struct bpf_insn *bf_insns; 9454359Sroberto}; 9554359Sroberto 9654359Sroberto/* 9754359Sroberto * Struct return by BIOCVERSION. This represents the version number of 9854359Sroberto * the filter language described by the instruction encodings below. 9954359Sroberto * bpf understands a program iff kernel_major == filter_major && 10054359Sroberto * kernel_minor >= filter_minor, that is, if the value returned by the 10154359Sroberto * running kernel has the same major number and a minor number equal 10254359Sroberto * equal to or less than the filter being downloaded. Otherwise, the 10354359Sroberto * results are undefined, meaning an error may be returned or packets 10454359Sroberto * may be accepted haphazardly. 10554359Sroberto * It has nothing to do with the source code version. 10654359Sroberto */ 10754359Srobertostruct bpf_version { 108285612Sdelphij u_short bv_major; 109285612Sdelphij u_short bv_minor; 110285612Sdelphij}; 111285612Sdelphij/* Current version number of filter architecture. */ 112285612Sdelphij#define BPF_MAJOR_VERSION 1 113285612Sdelphij#define BPF_MINOR_VERSION 1 114285612Sdelphij 11554359Sroberto/* 11654359Sroberto * Data-link level type codes. 11754359Sroberto * 11854359Sroberto * Do *NOT* add new values to this list without asking 11954359Sroberto * "tcpdump-workers@tcpdump.org" for a value. Otherwise, you run the 12054359Sroberto * risk of using a value that's already being used for some other purpose, 12154359Sroberto * and of having tools that read libpcap-format captures not being able 12254359Sroberto * to handle captures with your new DLT_ value, with no hope that they 12354359Sroberto * will ever be changed to do so (as that would destroy their ability 12454359Sroberto * to read captures using that value for that other purpose). 12554359Sroberto */ 12654359Sroberto 12754359Sroberto/* 12854359Sroberto * These are the types that are the same on all platforms, and that 12954359Sroberto * have been defined by <net/bpf.h> for ages. 13054359Sroberto */ 13154359Sroberto#define DLT_NULL 0 /* BSD loopback encapsulation */ 13254359Sroberto#define DLT_EN10MB 1 /* Ethernet (10Mb) */ 13354359Sroberto#define DLT_EN3MB 2 /* Experimental Ethernet (3Mb) */ 13454359Sroberto#define DLT_AX25 3 /* Amateur Radio AX.25 */ 13554359Sroberto#define DLT_PRONET 4 /* Proteon ProNET Token Ring */ 13654359Sroberto#define DLT_CHAOS 5 /* Chaos */ 137285612Sdelphij#define DLT_IEEE802 6 /* IEEE 802 Networks */ 13854359Sroberto#define DLT_ARCNET 7 /* ARCNET, with BSD-style header */ 13954359Sroberto#define DLT_SLIP 8 /* Serial Line IP */ 14054359Sroberto#define DLT_PPP 9 /* Point-to-point Protocol */ 14154359Sroberto#define DLT_FDDI 10 /* FDDI */ 14254359Sroberto 14354359Sroberto/* 144285612Sdelphij * These are types that are different on some platforms, and that 14554359Sroberto * have been defined by <net/bpf.h> for ages. We use #ifdefs to 14654359Sroberto * detect the BSDs that define them differently from the traditional 14754359Sroberto * libpcap <net/bpf.h> 14854359Sroberto * 14954359Sroberto * XXX - DLT_ATM_RFC1483 is 13 in BSD/OS, and DLT_RAW is 14 in BSD/OS, 15054359Sroberto * but I don't know what the right #define is for BSD/OS. 15154359Sroberto */ 15254359Sroberto#define DLT_ATM_RFC1483 11 /* LLC/SNAP encapsulated atm */ 15354359Sroberto 15454359Sroberto#ifdef __OpenBSD__ 155285612Sdelphij#define DLT_RAW 14 /* raw IP */ 15654359Sroberto#else 15754359Sroberto#define DLT_RAW 12 /* raw IP */ 15854359Sroberto#endif 15954359Sroberto 16054359Sroberto/* 16154359Sroberto * Given that the only OS that currently generates BSD/OS SLIP or PPP 16254359Sroberto * is, well, BSD/OS, arguably everybody should have chosen its values 16354359Sroberto * for DLT_SLIP_BSDOS and DLT_PPP_BSDOS, which are 15 and 16, but they 16454359Sroberto * didn't. So it goes. 16554359Sroberto */ 166285612Sdelphij#if defined(__NetBSD__) || defined(__FreeBSD__) 16754359Sroberto#ifndef DLT_SLIP_BSDOS 16854359Sroberto#define DLT_SLIP_BSDOS 13 /* BSD/OS Serial Line IP */ 16954359Sroberto#define DLT_PPP_BSDOS 14 /* BSD/OS Point-to-point Protocol */ 170285612Sdelphij#endif 17154359Sroberto#else 17254359Sroberto#define DLT_SLIP_BSDOS 15 /* BSD/OS Serial Line IP */ 17354359Sroberto#define DLT_PPP_BSDOS 16 /* BSD/OS Point-to-point Protocol */ 17454359Sroberto#endif 17554359Sroberto 17654359Sroberto/* 17754359Sroberto * 17 is used for DLT_OLD_PFLOG in OpenBSD; 17854359Sroberto * OBSOLETE: DLT_PFLOG is 117 in OpenBSD now as well. See below. 17954359Sroberto * 18 is used for DLT_PFSYNC in OpenBSD; don't use it for anything else. 18054359Sroberto */ 18154359Sroberto 182182007Sroberto#define DLT_ATM_CLIP 19 /* Linux Classical-IP over ATM */ 183182007Sroberto 184182007Sroberto/* 185182007Sroberto * Apparently Redback uses this for its SmartEdge 400/800. I hope 186182007Sroberto * nobody else decided to use it, too. 18754359Sroberto */ 18854359Sroberto#define DLT_REDBACK_SMARTEDGE 32 18954359Sroberto 19054359Sroberto/* 19154359Sroberto * These values are defined by NetBSD; other platforms should refrain from 19254359Sroberto * using them for other purposes, so that NetBSD savefiles with link 19354359Sroberto * types of 50 or 51 can be read as this type on all platforms. 19454359Sroberto */ 195182007Sroberto#define DLT_PPP_SERIAL 50 /* PPP over serial with HDLC encapsulation */ 19654359Sroberto#define DLT_PPP_ETHER 51 /* PPP over Ethernet */ 19754359Sroberto 19854359Sroberto/* 19954359Sroberto * The Axent Raptor firewall - now the Symantec Enterprise Firewall - uses 20054359Sroberto * a link-layer type of 99 for the tcpdump it supplies. The link-layer 20154359Sroberto * header has 6 bytes of unknown data, something that appears to be an 20254359Sroberto * Ethernet type, and 36 bytes that appear to be 0 in at least one capture 20354359Sroberto * I've seen. 20454359Sroberto */ 20554359Sroberto#define DLT_SYMANTEC_FIREWALL 99 20654359Sroberto 20754359Sroberto/* 20854359Sroberto * Values between 100 and 103 are used in capture file headers as 20954359Sroberto * link-layer types corresponding to DLT_ types that differ 21054359Sroberto * between platforms; don't use those values for new DLT_ new types. 21154359Sroberto */ 21254359Sroberto 21354359Sroberto/* 21454359Sroberto * This value was defined by libpcap 0.5; platforms that have defined 21554359Sroberto * it with a different value should define it here with that value - 21654359Sroberto * a link type of 104 in a save file will be mapped to DLT_C_HDLC, 21754359Sroberto * whatever value that happens to be, so programs will correctly 21854359Sroberto * handle files with that link type regardless of the value of 21954359Sroberto * DLT_C_HDLC. 22054359Sroberto * 22154359Sroberto * The name DLT_C_HDLC was used by BSD/OS; we use that name for source 22254359Sroberto * compatibility with programs written for BSD/OS. 22354359Sroberto * 22454359Sroberto * libpcap 0.5 defined it as DLT_CHDLC; we define DLT_CHDLC as well, 22554359Sroberto * for source compatibility with programs written for libpcap 0.5. 22654359Sroberto */ 22754359Sroberto#define DLT_C_HDLC 104 /* Cisco HDLC */ 22854359Sroberto#define DLT_CHDLC DLT_C_HDLC 22954359Sroberto 23054359Sroberto#define DLT_IEEE802_11 105 /* IEEE 802.11 wireless */ 23154359Sroberto 23254359Sroberto/* 23354359Sroberto * 106 is reserved for Linux Classical IP over ATM; it's like DLT_RAW, 23454359Sroberto * except when it isn't. (I.e., sometimes it's just raw IP, and 23554359Sroberto * sometimes it isn't.) We currently handle it as DLT_LINUX_SLL, 23654359Sroberto * so that we don't have to worry about the link-layer header.) 23754359Sroberto */ 23854359Sroberto 239285612Sdelphij/* 240285612Sdelphij * Frame Relay; BSD/OS has a DLT_FR with a value of 11, but that collides 24154359Sroberto * with other values. 24254359Sroberto * DLT_FR and DLT_FRELAY packets start with the Q.922 Frame Relay header 24354359Sroberto * (DLCI, etc.). 24454359Sroberto */ 245285612Sdelphij#define DLT_FRELAY 107 24654359Sroberto 24754359Sroberto/* 24854359Sroberto * OpenBSD DLT_LOOP, for loopback devices; it's like DLT_NULL, except 24954359Sroberto * that the AF_ type in the link-layer header is in network byte order. 25054359Sroberto * 25154359Sroberto * OpenBSD defines it as 12, but that collides with DLT_RAW, so we 25254359Sroberto * define it as 108 here. If OpenBSD picks up this file, it should 25354359Sroberto * define DLT_LOOP as 12 in its version, as per the comment above - 25454359Sroberto * and should not use 108 as a DLT_ value. 25554359Sroberto */ 25654359Sroberto#define DLT_LOOP 108 25754359Sroberto 25854359Sroberto/* 25954359Sroberto * Encapsulated packets for IPsec; DLT_ENC is 13 in OpenBSD, but that's 26054359Sroberto * DLT_SLIP_BSDOS in NetBSD, so we don't use 13 for it in OSes other 26154359Sroberto * than OpenBSD. 26254359Sroberto */ 26354359Sroberto#ifdef __OpenBSD__ 26454359Sroberto#define DLT_ENC 13 26554359Sroberto#else 26654359Sroberto#define DLT_ENC 109 26754359Sroberto#endif 268285612Sdelphij 26954359Sroberto/* 27054359Sroberto * Values between 110 and 112 are reserved for use in capture file headers 27154359Sroberto * as link-layer types corresponding to DLT_ types that might differ 27254359Sroberto * between platforms; don't use those values for new DLT_ types 27354359Sroberto * other than the corresponding DLT_ types. 27454359Sroberto */ 27554359Sroberto 276285612Sdelphij/* 27754359Sroberto * This is for Linux cooked sockets. 27854359Sroberto */ 27954359Sroberto#define DLT_LINUX_SLL 113 28054359Sroberto 28154359Sroberto/* 28254359Sroberto * Apple LocalTalk hardware. 28354359Sroberto */ 28454359Sroberto#define DLT_LTALK 114 28554359Sroberto 28654359Sroberto/* 28754359Sroberto * Acorn Econet. 28854359Sroberto */ 28954359Sroberto#define DLT_ECONET 115 29054359Sroberto 29154359Sroberto/* 29254359Sroberto * Reserved for use with OpenBSD ipfilter. 29354359Sroberto */ 29454359Sroberto#define DLT_IPFILTER 116 29554359Sroberto 296285612Sdelphij/* 29754359Sroberto * OpenBSD DLT_PFLOG; DLT_PFLOG is 17 in OpenBSD, but that's DLT_LANE8023 29854359Sroberto * in SuSE 6.3, so we can't use 17 for it in capture-file headers. 29954359Sroberto * 30054359Sroberto * XXX: is there a conflict with DLT_PFSYNC 18 as well? 30154359Sroberto */ 30254359Sroberto#ifdef __OpenBSD__ 30354359Sroberto#define DLT_OLD_PFLOG 17 30454359Sroberto#define DLT_PFSYNC 18 30554359Sroberto#endif 30654359Sroberto#define DLT_PFLOG 117 30754359Sroberto 30854359Sroberto/* 30954359Sroberto * Registered for Cisco-internal use. 31054359Sroberto */ 31154359Sroberto#define DLT_CISCO_IOS 118 31254359Sroberto 31354359Sroberto/* 31454359Sroberto * For 802.11 cards using the Prism II chips, with a link-layer 31554359Sroberto * header including Prism monitor mode information plus an 802.11 31654359Sroberto * header. 31754359Sroberto */ 31854359Sroberto#define DLT_PRISM_HEADER 119 31954359Sroberto 32054359Sroberto/* 32154359Sroberto * Reserved for Aironet 802.11 cards, with an Aironet link-layer header 32254359Sroberto * (see Doug Ambrisko's FreeBSD patches). 32354359Sroberto */ 32454359Sroberto#define DLT_AIRONET_HEADER 120 32554359Sroberto 32654359Sroberto/* 32754359Sroberto * Reserved for Siemens HiPath HDLC. 32854359Sroberto */ 32954359Sroberto#define DLT_HHDLC 121 33054359Sroberto 33154359Sroberto/* 33254359Sroberto * This is for RFC 2625 IP-over-Fibre Channel. 33354359Sroberto * 33454359Sroberto * This is not for use with raw Fibre Channel, where the link-layer 33554359Sroberto * header starts with a Fibre Channel frame header; it's for IP-over-FC, 33654359Sroberto * where the link-layer header starts with an RFC 2625 Network_Header 33754359Sroberto * field. 33854359Sroberto */ 33954359Sroberto#define DLT_IP_OVER_FC 122 34054359Sroberto 34154359Sroberto/* 34254359Sroberto * This is for Full Frontal ATM on Solaris with SunATM, with a 34354359Sroberto * pseudo-header followed by an AALn PDU. 34454359Sroberto * 34554359Sroberto * There may be other forms of Full Frontal ATM on other OSes, 34654359Sroberto * with different pseudo-headers. 347285612Sdelphij * 348285612Sdelphij * If ATM software returns a pseudo-header with VPI/VCI information 349285612Sdelphij * (and, ideally, packet type information, e.g. signalling, ILMI, 350285612Sdelphij * LANE, LLC-multiplexed traffic, etc.), it should not use 35154359Sroberto * DLT_ATM_RFC1483, but should get a new DLT_ value, so tcpdump 35254359Sroberto * and the like don't have to infer the presence or absence of a 35354359Sroberto * pseudo-header and the form of the pseudo-header. 354285612Sdelphij */ 35554359Sroberto#define DLT_SUNATM 123 /* Solaris+SunATM */ 356285612Sdelphij 35754359Sroberto/* 35854359Sroberto * Reserved as per request from Kent Dahlgren <kent@praesum.com> 359285612Sdelphij * for private use. 36054359Sroberto */ 36154359Sroberto#define DLT_RIO 124 /* RapidIO */ 36254359Sroberto#define DLT_PCI_EXP 125 /* PCI Express */ 36354359Sroberto#define DLT_AURORA 126 /* Xilinx Aurora link layer */ 36454359Sroberto 36554359Sroberto/* 36654359Sroberto * Header for 802.11 plus a number of bits of link-layer information 36754359Sroberto * including radio information, used by some recent BSD drivers as 36854359Sroberto * well as the madwifi Atheros driver for Linux. 36954359Sroberto */ 37054359Sroberto#define DLT_IEEE802_11_RADIO 127 /* 802.11 plus radiotap radio header */ 37154359Sroberto 37254359Sroberto/* 373285612Sdelphij * Reserved for the TZSP encapsulation, as per request from 374285612Sdelphij * Chris Waters <chris.waters@networkchemistry.com> 375285612Sdelphij * TZSP is a generic encapsulation for any other link type, 376285612Sdelphij * which includes a means to include meta-information 377285612Sdelphij * with the packet, e.g. signal strength and channel 378285612Sdelphij * for 802.11 packets. 379285612Sdelphij */ 380285612Sdelphij#define DLT_TZSP 128 /* Tazmen Sniffer Protocol */ 381285612Sdelphij 38254359Sroberto/* 383285612Sdelphij * BSD's ARCNET headers have the source host, destination host, 384285612Sdelphij * and type at the beginning of the packet; that's what's handed 385285612Sdelphij * up to userland via BPF. 38654359Sroberto * 387285612Sdelphij * Linux's ARCNET headers, however, have a 2-byte offset field 388285612Sdelphij * between the host IDs and the type; that's what's handed up 38954359Sroberto * to userland via PF_PACKET sockets. 390285612Sdelphij * 391285612Sdelphij * We therefore have to have separate DLT_ values for them. 392285612Sdelphij */ 393285612Sdelphij#define DLT_ARCNET_LINUX 129 /* ARCNET */ 394285612Sdelphij 395285612Sdelphij/* 396285612Sdelphij * Juniper-private data link types, as per request from 39754359Sroberto * Hannes Gredler <hannes@juniper.net>. The DLT_s are used 39854359Sroberto * for passing on chassis-internal metainformation such as 39954359Sroberto * QOS profiles, etc.. 40054359Sroberto */ 40154359Sroberto#define DLT_JUNIPER_MLPPP 130 40254359Sroberto#define DLT_JUNIPER_MLFR 131 40354359Sroberto#define DLT_JUNIPER_ES 132 404182007Sroberto#define DLT_JUNIPER_GGSN 133 405182007Sroberto#define DLT_JUNIPER_MFR 134 406182007Sroberto#define DLT_JUNIPER_ATM2 135 407182007Sroberto#define DLT_JUNIPER_SERVICES 136 408182007Sroberto#define DLT_JUNIPER_ATM1 137 409182007Sroberto 410182007Sroberto/* 41154359Sroberto * Apple IP-over-IEEE 1394, as per a request from Dieter Siegmund 41254359Sroberto * <dieter@apple.com>. The header that's presented is an Ethernet-like 41354359Sroberto * header: 41454359Sroberto * 41554359Sroberto * #define FIREWIRE_EUI64_LEN 8 41654359Sroberto * struct firewire_header { 41754359Sroberto * u_char firewire_dhost[FIREWIRE_EUI64_LEN]; 41854359Sroberto * u_char firewire_shost[FIREWIRE_EUI64_LEN]; 41954359Sroberto * u_short firewire_type; 42054359Sroberto * }; 42154359Sroberto * 42254359Sroberto * with "firewire_type" being an Ethernet type value, rather than, 42354359Sroberto * for example, raw GASP frames being handed up. 42454359Sroberto */ 42554359Sroberto#define DLT_APPLE_IP_OVER_IEEE1394 138 42654359Sroberto 42754359Sroberto/* 42854359Sroberto * Various SS7 encapsulations, as per a request from Jeff Morriss 42954359Sroberto * <jeff.morriss[AT]ulticom.com> and subsequent discussions. 43054359Sroberto */ 43154359Sroberto#define DLT_MTP2_WITH_PHDR 139 /* pseudo-header with various info, followed by MTP2 */ 43254359Sroberto#define DLT_MTP2 140 /* MTP2, without pseudo-header */ 433#define DLT_MTP3 141 /* MTP3, without pseudo-header or MTP2 */ 434#define DLT_SCCP 142 /* SCCP, without pseudo-header or MTP2 or MTP3 */ 435 436/* 437 * DOCSIS MAC frames. 438 */ 439#define DLT_DOCSIS 143 440 441/* 442 * Linux-IrDA packets. Protocol defined at http://www.irda.org. 443 * Those packets include IrLAP headers and above (IrLMP...), but 444 * don't include Phy framing (SOF/EOF/CRC & byte stuffing), because Phy 445 * framing can be handled by the hardware and depend on the bitrate. 446 * This is exactly the format you would get capturing on a Linux-IrDA 447 * interface (irdaX), but not on a raw serial port. 448 * Note the capture is done in "Linux-cooked" mode, so each packet include 449 * a fake packet header (struct sll_header). This is because IrDA packet 450 * decoding is dependant on the direction of the packet (incomming or 451 * outgoing). 452 * When/if other platform implement IrDA capture, we may revisit the 453 * issue and define a real DLT_IRDA... 454 * Jean II 455 */ 456#define DLT_LINUX_IRDA 144 457 458/* 459 * Reserved for IBM SP switch and IBM Next Federation switch. 460 */ 461#define DLT_IBM_SP 145 462#define DLT_IBM_SN 146 463 464/* 465 * Reserved for private use. If you have some link-layer header type 466 * that you want to use within your organization, with the capture files 467 * using that link-layer header type not ever be sent outside your 468 * organization, you can use these values. 469 * 470 * No libpcap release will use these for any purpose, nor will any 471 * tcpdump release use them, either. 472 * 473 * Do *NOT* use these in capture files that you expect anybody not using 474 * your private versions of capture-file-reading tools to read; in 475 * particular, do *NOT* use them in products, otherwise you may find that 476 * people won't be able to use tcpdump, or snort, or Ethereal, or... to 477 * read capture files from your firewall/intrusion detection/traffic 478 * monitoring/etc. appliance, or whatever product uses that DLT_ value, 479 * and you may also find that the developers of those applications will 480 * not accept patches to let them read those files. 481 * 482 * Also, do not use them if somebody might send you a capture using them 483 * for *their* private type and tools using them for *your* private type 484 * would have to read them. 485 * 486 * Instead, ask "tcpdump-workers@tcpdump.org" for a new DLT_ value, 487 * as per the comment above, and use the type you're given. 488 */ 489#define DLT_USER0 147 490#define DLT_USER1 148 491#define DLT_USER2 149 492#define DLT_USER3 150 493#define DLT_USER4 151 494#define DLT_USER5 152 495#define DLT_USER6 153 496#define DLT_USER7 154 497#define DLT_USER8 155 498#define DLT_USER9 156 499#define DLT_USER10 157 500#define DLT_USER11 158 501#define DLT_USER12 159 502#define DLT_USER13 160 503#define DLT_USER14 161 504#define DLT_USER15 162 505 506/* 507 * For future use with 802.11 captures - defined by AbsoluteValue 508 * Systems to store a number of bits of link-layer information 509 * including radio information: 510 * 511 * http://www.shaftnet.org/~pizza/software/capturefrm.txt 512 * 513 * but it might be used by some non-AVS drivers now or in the 514 * future. 515 */ 516#define DLT_IEEE802_11_RADIO_AVS 163 /* 802.11 plus AVS radio header */ 517 518/* 519 * Juniper-private data link type, as per request from 520 * Hannes Gredler <hannes@juniper.net>. The DLT_s are used 521 * for passing on chassis-internal metainformation such as 522 * QOS profiles, etc.. 523 */ 524#define DLT_JUNIPER_MONITOR 164 525 526/* 527 * Reserved for BACnet MS/TP. 528 */ 529#define DLT_BACNET_MS_TP 165 530 531/* 532 * Another PPP variant as per request from Karsten Keil <kkeil@suse.de>. 533 * 534 * This is used in some OSes to allow a kernel socket filter to distinguish 535 * between incoming and outgoing packets, on a socket intended to 536 * supply pppd with outgoing packets so it can do dial-on-demand and 537 * hangup-on-lack-of-demand; incoming packets are filtered out so they 538 * don't cause pppd to hold the connection up (you don't want random 539 * input packets such as port scans, packets from old lost connections, 540 * etc. to force the connection to stay up). 541 * 542 * The first byte of the PPP header (0xff03) is modified to accomodate 543 * the direction - 0x00 = IN, 0x01 = OUT. 544 */ 545#define DLT_PPP_PPPD 166 546 547/* 548 * Names for backwards compatibility with older versions of some PPP 549 * software; new software should use DLT_PPP_PPPD. 550 */ 551#define DLT_PPP_WITH_DIRECTION DLT_PPP_PPPD 552#define DLT_LINUX_PPP_WITHDIRECTION DLT_PPP_PPPD 553 554/* 555 * Juniper-private data link type, as per request from 556 * Hannes Gredler <hannes@juniper.net>. The DLT_s are used 557 * for passing on chassis-internal metainformation such as 558 * QOS profiles, cookies, etc.. 559 */ 560#define DLT_JUNIPER_PPPOE 167 561#define DLT_JUNIPER_PPPOE_ATM 168 562 563#define DLT_GPRS_LLC 169 /* GPRS LLC */ 564#define DLT_GPF_T 170 /* GPF-T (ITU-T G.7041/Y.1303) */ 565#define DLT_GPF_F 171 /* GPF-F (ITU-T G.7041/Y.1303) */ 566 567/* 568 * Requested by Oolan Zimmer <oz@gcom.com> for use in Gcom's T1/E1 line 569 * monitoring equipment. 570 */ 571#define DLT_GCOM_T1E1 172 572#define DLT_GCOM_SERIAL 173 573 574/* 575 * Juniper-private data link type, as per request from 576 * Hannes Gredler <hannes@juniper.net>. The DLT_ is used 577 * for internal communication to Physical Interface Cards (PIC) 578 */ 579#define DLT_JUNIPER_PIC_PEER 174 580 581/* 582 * Link types requested by Gregor Maier <gregor@endace.com> of Endace 583 * Measurement Systems. They add an ERF header (see 584 * http://www.endace.com/support/EndaceRecordFormat.pdf) in front of 585 * the link-layer header. 586 */ 587#define DLT_ERF_ETH 175 /* Ethernet */ 588#define DLT_ERF_POS 176 /* Packet-over-SONET */ 589 590/* 591 * Requested by Daniele Orlandi <daniele@orlandi.com> for raw LAPD 592 * for vISDN (http://www.orlandi.com/visdn/). Its link-layer header 593 * includes additional information before the LAPD header, so it's 594 * not necessarily a generic LAPD header. 595 */ 596#define DLT_LINUX_LAPD 177 597 598/* 599 * The instruction encodings. 600 */ 601/* instruction classes */ 602#define BPF_CLASS(code) ((code) & 0x07) 603#define BPF_LD 0x00 604#define BPF_LDX 0x01 605#define BPF_ST 0x02 606#define BPF_STX 0x03 607#define BPF_ALU 0x04 608#define BPF_JMP 0x05 609#define BPF_RET 0x06 610#define BPF_MISC 0x07 611 612/* ld/ldx fields */ 613#define BPF_SIZE(code) ((code) & 0x18) 614#define BPF_W 0x00 615#define BPF_H 0x08 616#define BPF_B 0x10 617#define BPF_MODE(code) ((code) & 0xe0) 618#define BPF_IMM 0x00 619#define BPF_ABS 0x20 620#define BPF_IND 0x40 621#define BPF_MEM 0x60 622#define BPF_LEN 0x80 623#define BPF_MSH 0xa0 624 625/* alu/jmp fields */ 626#define BPF_OP(code) ((code) & 0xf0) 627#define BPF_ADD 0x00 628#define BPF_SUB 0x10 629#define BPF_MUL 0x20 630#define BPF_DIV 0x30 631#define BPF_OR 0x40 632#define BPF_AND 0x50 633#define BPF_LSH 0x60 634#define BPF_RSH 0x70 635#define BPF_NEG 0x80 636#define BPF_JA 0x00 637#define BPF_JEQ 0x10 638#define BPF_JGT 0x20 639#define BPF_JGE 0x30 640#define BPF_JSET 0x40 641#define BPF_SRC(code) ((code) & 0x08) 642#define BPF_K 0x00 643#define BPF_X 0x08 644 645/* ret - BPF_K and BPF_X also apply */ 646#define BPF_RVAL(code) ((code) & 0x18) 647#define BPF_A 0x10 648 649/* misc */ 650#define BPF_MISCOP(code) ((code) & 0xf8) 651#define BPF_TAX 0x00 652#define BPF_TXA 0x80 653 654/* 655 * The instruction data structure. 656 */ 657struct bpf_insn { 658 u_short code; 659 u_char jt; 660 u_char jf; 661 bpf_int32 k; 662}; 663 664/* 665 * Macros for insn array initializers. 666 */ 667#define BPF_STMT(code, k) { (u_short)(code), 0, 0, k } 668#define BPF_JUMP(code, k, jt, jf) { (u_short)(code), jt, jf, k } 669 670#if __STDC__ || defined(__cplusplus) 671extern int bpf_validate(struct bpf_insn *, int); 672extern u_int bpf_filter(struct bpf_insn *, u_char *, u_int, u_int); 673#else 674extern int bpf_validate(); 675extern u_int bpf_filter(); 676#endif 677 678/* 679 * Number of scratch memory words (for BPF_LD|BPF_MEM and BPF_ST). 680 */ 681#define BPF_MEMWORDS 16 682 683#ifdef __cplusplus 684} 685#endif 686 687#endif 688