bpf.h revision 190944
181477Smarkm/*- 281477Smarkm * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 381477Smarkm * The Regents of the University of California. All rights reserved. 481477Smarkm * 581477Smarkm * This code is derived from the Stanford/CMU enet packet filter, 681477Smarkm * (net/enet.c) distributed as part of 4.3BSD, and code contributed 781477Smarkm * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence 881477Smarkm * Berkeley Laboratory. 981477Smarkm * 1081477Smarkm * Redistribution and use in source and binary forms, with or without 1181477Smarkm * modification, are permitted provided that the following conditions 1281477Smarkm * are met: 1381477Smarkm * 1. Redistributions of source code must retain the above copyright 1481477Smarkm * notice, this list of conditions and the following disclaimer. 1581477Smarkm * 2. Redistributions in binary form must reproduce the above copyright 1681477Smarkm * notice, this list of conditions and the following disclaimer in the 1781477Smarkm * documentation and/or other materials provided with the distribution. 1881477Smarkm * 3. All advertising materials mentioning features or use of this software 1981477Smarkm * must display the following acknowledgement: 2081477Smarkm * This product includes software developed by the University of 2181477Smarkm * California, Berkeley and its contributors. 2281477Smarkm * 4. Neither the name of the University nor the names of its contributors 2381477Smarkm * may be used to endorse or promote products derived from this software 2481477Smarkm * without specific prior written permission. 2581477Smarkm * 2681477Smarkm * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2781477Smarkm * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2881477Smarkm * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2981477Smarkm * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 3081477Smarkm * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 3181477Smarkm * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 3281477Smarkm * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 3381477Smarkm * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 3481477Smarkm * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3581477Smarkm * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3681477Smarkm * SUCH DAMAGE. 3781477Smarkm * 3881477Smarkm * @(#)bpf.h 7.1 (Berkeley) 5/7/91 3981477Smarkm * 4081477Smarkm * @(#) $Header: /tcpdump/master/libpcap/pcap/bpf.h,v 1.19.2.8 2008-09-22 20:16:01 guy Exp $ (LBL) 4181477Smarkm */ 4281477Smarkm 4381477Smarkm/* 4481477Smarkm * This is libpcap's cut-down version of bpf.h; it includes only 4581477Smarkm * the stuff needed for the code generator and the userland BPF 4681477Smarkm * interpreter, and the libpcap APIs for setting filters, etc.. 4781477Smarkm * 4881477Smarkm * "pcap-bpf.c" will include the native OS version, as it deals with 4981477Smarkm * the OS's BPF implementation. 5081477Smarkm * 5181477Smarkm * XXX - should this all just be moved to "pcap.h"? 5281477Smarkm */ 5381477Smarkm 5481477Smarkm#ifndef BPF_MAJOR_VERSION 5581477Smarkm 5681477Smarkm#ifdef __cplusplus 5781477Smarkmextern "C" { 5881477Smarkm#endif 5981477Smarkm 6081477Smarkm/* BSD style release date */ 6181477Smarkm#define BPF_RELEASE 199606 6281477Smarkm 6381477Smarkm#ifdef MSDOS /* must be 32-bit */ 6481477Smarkmtypedef long bpf_int32; 6581477Smarkmtypedef unsigned long bpf_u_int32; 6681477Smarkm#else 6781477Smarkmtypedef int bpf_int32; 6881477Smarkmtypedef u_int bpf_u_int32; 6981477Smarkm#endif 7081477Smarkm 7181477Smarkm/* 7281477Smarkm * Alignment macros. BPF_WORDALIGN rounds up to the next 7381477Smarkm * even multiple of BPF_ALIGNMENT. 7481477Smarkm */ 7581477Smarkm#ifndef __NetBSD__ 7681477Smarkm#define BPF_ALIGNMENT sizeof(bpf_int32) 7781477Smarkm#else 7881477Smarkm#define BPF_ALIGNMENT sizeof(long) 7981477Smarkm#endif 8081477Smarkm#define BPF_WORDALIGN(x) (((x)+(BPF_ALIGNMENT-1))&~(BPF_ALIGNMENT-1)) 8181477Smarkm 8281477Smarkm#define BPF_MAXBUFSIZE 0x8000 8381477Smarkm#define BPF_MINBUFSIZE 32 8481477Smarkm 8581477Smarkm/* 8681477Smarkm * Structure for "pcap_compile()", "pcap_setfilter()", etc.. 8781477Smarkm */ 8881477Smarkmstruct bpf_program { 8981477Smarkm u_int bf_len; 9081477Smarkm struct bpf_insn *bf_insns; 9181477Smarkm}; 9281477Smarkm 9381477Smarkm/* 9481477Smarkm * Struct return by BIOCVERSION. This represents the version number of 9581477Smarkm * the filter language described by the instruction encodings below. 9681477Smarkm * bpf understands a program iff kernel_major == filter_major && 9781477Smarkm * kernel_minor >= filter_minor, that is, if the value returned by the 9881477Smarkm * running kernel has the same major number and a minor number equal 9981477Smarkm * equal to or less than the filter being downloaded. Otherwise, the 10081477Smarkm * results are undefined, meaning an error may be returned or packets 10181477Smarkm * may be accepted haphazardly. 10281477Smarkm * It has nothing to do with the source code version. 10381477Smarkm */ 10481477Smarkmstruct bpf_version { 10581477Smarkm u_short bv_major; 10681477Smarkm u_short bv_minor; 10781477Smarkm}; 10881477Smarkm/* Current version number of filter architecture. */ 10981477Smarkm#define BPF_MAJOR_VERSION 1 11081477Smarkm#define BPF_MINOR_VERSION 1 11181477Smarkm 11281477Smarkm/* 11381477Smarkm * Data-link level type codes. 11481477Smarkm * 11581477Smarkm * Do *NOT* add new values to this list without asking 11681477Smarkm * "tcpdump-workers@lists.tcpdump.org" for a value. Otherwise, you run 11781477Smarkm * the risk of using a value that's already being used for some other 11881477Smarkm * purpose, and of having tools that read libpcap-format captures not 11981477Smarkm * being able to handle captures with your new DLT_ value, with no hope 12081477Smarkm * that they will ever be changed to do so (as that would destroy their 12181477Smarkm * ability to read captures using that value for that other purpose). 12281477Smarkm */ 12381477Smarkm 12481477Smarkm/* 12581477Smarkm * These are the types that are the same on all platforms, and that 12681477Smarkm * have been defined by <net/bpf.h> for ages. 12781477Smarkm */ 12881477Smarkm#define DLT_NULL 0 /* BSD loopback encapsulation */ 12981477Smarkm#define DLT_EN10MB 1 /* Ethernet (10Mb) */ 13081477Smarkm#define DLT_EN3MB 2 /* Experimental Ethernet (3Mb) */ 13181477Smarkm#define DLT_AX25 3 /* Amateur Radio AX.25 */ 13281477Smarkm#define DLT_PRONET 4 /* Proteon ProNET Token Ring */ 13381477Smarkm#define DLT_CHAOS 5 /* Chaos */ 13481477Smarkm#define DLT_IEEE802 6 /* 802.5 Token Ring */ 13581477Smarkm#define DLT_ARCNET 7 /* ARCNET, with BSD-style header */ 13681477Smarkm#define DLT_SLIP 8 /* Serial Line IP */ 13781477Smarkm#define DLT_PPP 9 /* Point-to-point Protocol */ 13881477Smarkm#define DLT_FDDI 10 /* FDDI */ 13981477Smarkm 14081477Smarkm/* 14181477Smarkm * These are types that are different on some platforms, and that 14281477Smarkm * have been defined by <net/bpf.h> for ages. We use #ifdefs to 14381477Smarkm * detect the BSDs that define them differently from the traditional 14481477Smarkm * libpcap <net/bpf.h> 14581477Smarkm * 14681477Smarkm * XXX - DLT_ATM_RFC1483 is 13 in BSD/OS, and DLT_RAW is 14 in BSD/OS, 14781477Smarkm * but I don't know what the right #define is for BSD/OS. 14881477Smarkm */ 14981477Smarkm#define DLT_ATM_RFC1483 11 /* LLC-encapsulated ATM */ 15081477Smarkm 15181477Smarkm#ifdef __OpenBSD__ 15281477Smarkm#define DLT_RAW 14 /* raw IP */ 15381477Smarkm#else 15481477Smarkm#define DLT_RAW 12 /* raw IP */ 15581477Smarkm#endif 15681477Smarkm 15781477Smarkm/* 15881477Smarkm * Given that the only OS that currently generates BSD/OS SLIP or PPP 15981477Smarkm * is, well, BSD/OS, arguably everybody should have chosen its values 16081477Smarkm * for DLT_SLIP_BSDOS and DLT_PPP_BSDOS, which are 15 and 16, but they 16181477Smarkm * didn't. So it goes. 16281477Smarkm */ 16381477Smarkm#if defined(__NetBSD__) || defined(__FreeBSD__) 16481477Smarkm#ifndef DLT_SLIP_BSDOS 16581477Smarkm#define DLT_SLIP_BSDOS 13 /* BSD/OS Serial Line IP */ 16681477Smarkm#define DLT_PPP_BSDOS 14 /* BSD/OS Point-to-point Protocol */ 16781477Smarkm#endif 16881477Smarkm#else 16981477Smarkm#define DLT_SLIP_BSDOS 15 /* BSD/OS Serial Line IP */ 17081477Smarkm#define DLT_PPP_BSDOS 16 /* BSD/OS Point-to-point Protocol */ 17181477Smarkm#endif 17281477Smarkm 17381477Smarkm/* 17481477Smarkm * 17 is used for DLT_OLD_PFLOG in OpenBSD; 17581477Smarkm * OBSOLETE: DLT_PFLOG is 117 in OpenBSD now as well. See below. 17681477Smarkm * 18 is used for DLT_PFSYNC in OpenBSD; don't use it for anything else. 17781477Smarkm */ 17881477Smarkm 17981477Smarkm#define DLT_ATM_CLIP 19 /* Linux Classical-IP over ATM */ 18081477Smarkm 18181477Smarkm/* 18281477Smarkm * Apparently Redback uses this for its SmartEdge 400/800. I hope 18381477Smarkm * nobody else decided to use it, too. 18481477Smarkm */ 18581477Smarkm#define DLT_REDBACK_SMARTEDGE 32 18681477Smarkm 18781477Smarkm/* 18881477Smarkm * These values are defined by NetBSD; other platforms should refrain from 18981477Smarkm * using them for other purposes, so that NetBSD savefiles with link 19081477Smarkm * types of 50 or 51 can be read as this type on all platforms. 19181477Smarkm */ 19281477Smarkm#define DLT_PPP_SERIAL 50 /* PPP over serial with HDLC encapsulation */ 19384218Sdillon#define DLT_PPP_ETHER 51 /* PPP over Ethernet */ 19484218Sdillon 19584218Sdillon/* 19681477Smarkm * The Axent Raptor firewall - now the Symantec Enterprise Firewall - uses 19781477Smarkm * a link-layer type of 99 for the tcpdump it supplies. The link-layer 19881477Smarkm * header has 6 bytes of unknown data, something that appears to be an 19981477Smarkm * Ethernet type, and 36 bytes that appear to be 0 in at least one capture 20081477Smarkm * I've seen. 20181477Smarkm */ 20281477Smarkm#define DLT_SYMANTEC_FIREWALL 99 20381477Smarkm 20481477Smarkm/* 20581477Smarkm * Values between 100 and 103 are used in capture file headers as 20681477Smarkm * link-layer types corresponding to DLT_ types that differ 20781477Smarkm * between platforms; don't use those values for new DLT_ new types. 20881477Smarkm */ 20981477Smarkm 21081477Smarkm/* 21181477Smarkm * This value was defined by libpcap 0.5; platforms that have defined 21281477Smarkm * it with a different value should define it here with that value - 21381477Smarkm * a link type of 104 in a save file will be mapped to DLT_C_HDLC, 21481477Smarkm * whatever value that happens to be, so programs will correctly 21581477Smarkm * handle files with that link type regardless of the value of 21681477Smarkm * DLT_C_HDLC. 21781477Smarkm * 21881477Smarkm * The name DLT_C_HDLC was used by BSD/OS; we use that name for source 21981477Smarkm * compatibility with programs written for BSD/OS. 22081477Smarkm * 22181477Smarkm * libpcap 0.5 defined it as DLT_CHDLC; we define DLT_CHDLC as well, 22281477Smarkm * for source compatibility with programs written for libpcap 0.5. 22381477Smarkm */ 22481477Smarkm#define DLT_C_HDLC 104 /* Cisco HDLC */ 22581477Smarkm#define DLT_CHDLC DLT_C_HDLC 22681477Smarkm 22781477Smarkm#define DLT_IEEE802_11 105 /* IEEE 802.11 wireless */ 22881477Smarkm 22981477Smarkm/* 23081477Smarkm * 106 is reserved for Linux Classical IP over ATM; it's like DLT_RAW, 23181477Smarkm * except when it isn't. (I.e., sometimes it's just raw IP, and 23281477Smarkm * sometimes it isn't.) We currently handle it as DLT_LINUX_SLL, 23381477Smarkm * so that we don't have to worry about the link-layer header.) 23481477Smarkm */ 23581477Smarkm 23681477Smarkm/* 23781477Smarkm * Frame Relay; BSD/OS has a DLT_FR with a value of 11, but that collides 23881477Smarkm * with other values. 23981477Smarkm * DLT_FR and DLT_FRELAY packets start with the Q.922 Frame Relay header 24081477Smarkm * (DLCI, etc.). 24181477Smarkm */ 24281477Smarkm#define DLT_FRELAY 107 24381477Smarkm 24481477Smarkm/* 24581477Smarkm * OpenBSD DLT_LOOP, for loopback devices; it's like DLT_NULL, except 24681477Smarkm * that the AF_ type in the link-layer header is in network byte order. 24781477Smarkm * 24881477Smarkm * DLT_LOOP is 12 in OpenBSD, but that's DLT_RAW in other OSes, so 24981477Smarkm * we don't use 12 for it in OSes other than OpenBSD. 25081477Smarkm */ 25181477Smarkm#ifdef __OpenBSD__ 25281477Smarkm#define DLT_LOOP 12 25381477Smarkm#else 25481477Smarkm#define DLT_LOOP 108 25581477Smarkm#endif 25681477Smarkm 25781477Smarkm/* 25881477Smarkm * Encapsulated packets for IPsec; DLT_ENC is 13 in OpenBSD, but that's 25981477Smarkm * DLT_SLIP_BSDOS in NetBSD, so we don't use 13 for it in OSes other 26081477Smarkm * than OpenBSD. 26181477Smarkm */ 26281477Smarkm#ifdef __OpenBSD__ 26381477Smarkm#define DLT_ENC 13 26481477Smarkm#else 26581477Smarkm#define DLT_ENC 109 26681477Smarkm#endif 26781477Smarkm 26881477Smarkm/* 26981477Smarkm * Values between 110 and 112 are reserved for use in capture file headers 27081477Smarkm * as link-layer types corresponding to DLT_ types that might differ 27181477Smarkm * between platforms; don't use those values for new DLT_ types 27281477Smarkm * other than the corresponding DLT_ types. 27381477Smarkm */ 27481477Smarkm 27581477Smarkm/* 27681477Smarkm * This is for Linux cooked sockets. 27781477Smarkm */ 27881477Smarkm#define DLT_LINUX_SLL 113 27981477Smarkm 28081477Smarkm/* 28181477Smarkm * Apple LocalTalk hardware. 28281477Smarkm */ 28381477Smarkm#define DLT_LTALK 114 28481477Smarkm 28581477Smarkm/* 28681477Smarkm * Acorn Econet. 28781477Smarkm */ 28881477Smarkm#define DLT_ECONET 115 28981477Smarkm 29081477Smarkm/* 29181477Smarkm * Reserved for use with OpenBSD ipfilter. 29281477Smarkm */ 29381477Smarkm#define DLT_IPFILTER 116 29481477Smarkm 29581477Smarkm/* 29681477Smarkm * OpenBSD DLT_PFLOG; DLT_PFLOG is 17 in OpenBSD, but that's DLT_LANE8023 29781477Smarkm * in SuSE 6.3, so we can't use 17 for it in capture-file headers. 29881477Smarkm * 29981477Smarkm * XXX: is there a conflict with DLT_PFSYNC 18 as well? 30081477Smarkm */ 30181477Smarkm#ifdef __OpenBSD__ 30281477Smarkm#define DLT_OLD_PFLOG 17 30381477Smarkm#define DLT_PFSYNC 18 30481477Smarkm#endif 30581477Smarkm#define DLT_PFLOG 117 30681477Smarkm 30781477Smarkm/* 30881477Smarkm * Registered for Cisco-internal use. 30981477Smarkm */ 31081477Smarkm#define DLT_CISCO_IOS 118 31181477Smarkm 31281477Smarkm/* 31381477Smarkm * For 802.11 cards using the Prism II chips, with a link-layer 31481477Smarkm * header including Prism monitor mode information plus an 802.11 31581477Smarkm * header. 31681477Smarkm */ 31781477Smarkm#define DLT_PRISM_HEADER 119 31881477Smarkm 31981477Smarkm/* 32081477Smarkm * Reserved for Aironet 802.11 cards, with an Aironet link-layer header 32181477Smarkm * (see Doug Ambrisko's FreeBSD patches). 32281477Smarkm */ 32381477Smarkm#define DLT_AIRONET_HEADER 120 32481477Smarkm 32581477Smarkm/* 32681477Smarkm * Reserved for Siemens HiPath HDLC. 32781477Smarkm */ 32881477Smarkm#define DLT_HHDLC 121 32981477Smarkm 33081477Smarkm/* 33181477Smarkm * This is for RFC 2625 IP-over-Fibre Channel. 33281477Smarkm * 33381477Smarkm * This is not for use with raw Fibre Channel, where the link-layer 33481477Smarkm * header starts with a Fibre Channel frame header; it's for IP-over-FC, 33581477Smarkm * where the link-layer header starts with an RFC 2625 Network_Header 33681477Smarkm * field. 33781477Smarkm */ 33881477Smarkm#define DLT_IP_OVER_FC 122 33981477Smarkm 34081477Smarkm/* 34181477Smarkm * This is for Full Frontal ATM on Solaris with SunATM, with a 34281477Smarkm * pseudo-header followed by an AALn PDU. 34381477Smarkm * 34481477Smarkm * There may be other forms of Full Frontal ATM on other OSes, 34581477Smarkm * with different pseudo-headers. 34681477Smarkm * 34781477Smarkm * If ATM software returns a pseudo-header with VPI/VCI information 34881477Smarkm * (and, ideally, packet type information, e.g. signalling, ILMI, 34981477Smarkm * LANE, LLC-multiplexed traffic, etc.), it should not use 35081477Smarkm * DLT_ATM_RFC1483, but should get a new DLT_ value, so tcpdump 35181477Smarkm * and the like don't have to infer the presence or absence of a 35281477Smarkm * pseudo-header and the form of the pseudo-header. 35381477Smarkm */ 35481477Smarkm#define DLT_SUNATM 123 /* Solaris+SunATM */ 35581477Smarkm 35681477Smarkm/* 35781477Smarkm * Reserved as per request from Kent Dahlgren <kent@praesum.com> 35881477Smarkm * for private use. 35981477Smarkm */ 36081477Smarkm#define DLT_RIO 124 /* RapidIO */ 36181477Smarkm#define DLT_PCI_EXP 125 /* PCI Express */ 36281477Smarkm#define DLT_AURORA 126 /* Xilinx Aurora link layer */ 36381477Smarkm 36481477Smarkm/* 36581477Smarkm * Header for 802.11 plus a number of bits of link-layer information 36681477Smarkm * including radio information, used by some recent BSD drivers as 36781477Smarkm * well as the madwifi Atheros driver for Linux. 36881477Smarkm */ 36981477Smarkm#define DLT_IEEE802_11_RADIO 127 /* 802.11 plus radiotap radio header */ 37081477Smarkm 37181477Smarkm/* 37281477Smarkm * Reserved for the TZSP encapsulation, as per request from 37381477Smarkm * Chris Waters <chris.waters@networkchemistry.com> 37481477Smarkm * TZSP is a generic encapsulation for any other link type, 37581477Smarkm * which includes a means to include meta-information 37681477Smarkm * with the packet, e.g. signal strength and channel 37781477Smarkm * for 802.11 packets. 37881477Smarkm */ 37981477Smarkm#define DLT_TZSP 128 /* Tazmen Sniffer Protocol */ 38081477Smarkm 38181477Smarkm/* 38281477Smarkm * BSD's ARCNET headers have the source host, destination host, 38381477Smarkm * and type at the beginning of the packet; that's what's handed 38481477Smarkm * up to userland via BPF. 38581477Smarkm * 38681477Smarkm * Linux's ARCNET headers, however, have a 2-byte offset field 38781477Smarkm * between the host IDs and the type; that's what's handed up 38881477Smarkm * to userland via PF_PACKET sockets. 38981477Smarkm * 39081477Smarkm * We therefore have to have separate DLT_ values for them. 39181477Smarkm */ 39281477Smarkm#define DLT_ARCNET_LINUX 129 /* ARCNET */ 39381477Smarkm 39481477Smarkm/* 39581477Smarkm * Juniper-private data link types, as per request from 39681477Smarkm * Hannes Gredler <hannes@juniper.net>. The DLT_s are used 39781477Smarkm * for passing on chassis-internal metainformation such as 39881477Smarkm * QOS profiles, etc.. 39981477Smarkm */ 40081477Smarkm#define DLT_JUNIPER_MLPPP 130 40181477Smarkm#define DLT_JUNIPER_MLFR 131 40281477Smarkm#define DLT_JUNIPER_ES 132 40381477Smarkm#define DLT_JUNIPER_GGSN 133 40481477Smarkm#define DLT_JUNIPER_MFR 134 40581477Smarkm#define DLT_JUNIPER_ATM2 135 40681477Smarkm#define DLT_JUNIPER_SERVICES 136 40781477Smarkm#define DLT_JUNIPER_ATM1 137 40881477Smarkm 40981477Smarkm/* 41081477Smarkm * Apple IP-over-IEEE 1394, as per a request from Dieter Siegmund 41181477Smarkm * <dieter@apple.com>. The header that's presented is an Ethernet-like 41281477Smarkm * header: 41381477Smarkm * 41481477Smarkm * #define FIREWIRE_EUI64_LEN 8 41581477Smarkm * struct firewire_header { 41681477Smarkm * u_char firewire_dhost[FIREWIRE_EUI64_LEN]; 41781477Smarkm * u_char firewire_shost[FIREWIRE_EUI64_LEN]; 41881477Smarkm * u_short firewire_type; 41981477Smarkm * }; 42081477Smarkm * 42181477Smarkm * with "firewire_type" being an Ethernet type value, rather than, 42281477Smarkm * for example, raw GASP frames being handed up. 42381477Smarkm */ 42481477Smarkm#define DLT_APPLE_IP_OVER_IEEE1394 138 42581477Smarkm 42681477Smarkm/* 42781477Smarkm * Various SS7 encapsulations, as per a request from Jeff Morriss 42881477Smarkm * <jeff.morriss[AT]ulticom.com> and subsequent discussions. 42981477Smarkm */ 43081477Smarkm#define DLT_MTP2_WITH_PHDR 139 /* pseudo-header with various info, followed by MTP2 */ 43181477Smarkm#define DLT_MTP2 140 /* MTP2, without pseudo-header */ 43281477Smarkm#define DLT_MTP3 141 /* MTP3, without pseudo-header or MTP2 */ 43381477Smarkm#define DLT_SCCP 142 /* SCCP, without pseudo-header or MTP2 or MTP3 */ 43481477Smarkm 43581477Smarkm/* 43681477Smarkm * DOCSIS MAC frames. 43781477Smarkm */ 43881477Smarkm#define DLT_DOCSIS 143 43981477Smarkm 44081477Smarkm/* 44181477Smarkm * Linux-IrDA packets. Protocol defined at http://www.irda.org. 44281477Smarkm * Those packets include IrLAP headers and above (IrLMP...), but 44381477Smarkm * don't include Phy framing (SOF/EOF/CRC & byte stuffing), because Phy 44481477Smarkm * framing can be handled by the hardware and depend on the bitrate. 44581477Smarkm * This is exactly the format you would get capturing on a Linux-IrDA 44681477Smarkm * interface (irdaX), but not on a raw serial port. 44781477Smarkm * Note the capture is done in "Linux-cooked" mode, so each packet include 44881477Smarkm * a fake packet header (struct sll_header). This is because IrDA packet 44981477Smarkm * decoding is dependant on the direction of the packet (incomming or 45081477Smarkm * outgoing). 45181477Smarkm * When/if other platform implement IrDA capture, we may revisit the 45281477Smarkm * issue and define a real DLT_IRDA... 45381477Smarkm * Jean II 45481477Smarkm */ 45581477Smarkm#define DLT_LINUX_IRDA 144 45681477Smarkm 45781477Smarkm/* 45881477Smarkm * Reserved for IBM SP switch and IBM Next Federation switch. 45981477Smarkm */ 46081477Smarkm#define DLT_IBM_SP 145 46181477Smarkm#define DLT_IBM_SN 146 46281477Smarkm 46381477Smarkm/* 46481477Smarkm * Reserved for private use. If you have some link-layer header type 46581477Smarkm * that you want to use within your organization, with the capture files 46681477Smarkm * using that link-layer header type not ever be sent outside your 46781477Smarkm * organization, you can use these values. 46881477Smarkm * 46981477Smarkm * No libpcap release will use these for any purpose, nor will any 47081477Smarkm * tcpdump release use them, either. 47181477Smarkm * 47281477Smarkm * Do *NOT* use these in capture files that you expect anybody not using 47381477Smarkm * your private versions of capture-file-reading tools to read; in 47481477Smarkm * particular, do *NOT* use them in products, otherwise you may find that 47581477Smarkm * people won't be able to use tcpdump, or snort, or Ethereal, or... to 47681477Smarkm * read capture files from your firewall/intrusion detection/traffic 47781477Smarkm * monitoring/etc. appliance, or whatever product uses that DLT_ value, 47881477Smarkm * and you may also find that the developers of those applications will 47981477Smarkm * not accept patches to let them read those files. 48081477Smarkm * 48181477Smarkm * Also, do not use them if somebody might send you a capture using them 48281477Smarkm * for *their* private type and tools using them for *your* private type 48381477Smarkm * would have to read them. 48481477Smarkm * 48581477Smarkm * Instead, ask "tcpdump-workers@lists.tcpdump.org" for a new DLT_ value, 48681477Smarkm * as per the comment above, and use the type you're given. 48781477Smarkm */ 48881477Smarkm#define DLT_USER0 147 48981477Smarkm#define DLT_USER1 148 49081477Smarkm#define DLT_USER2 149 49181477Smarkm#define DLT_USER3 150 49281477Smarkm#define DLT_USER4 151 49381477Smarkm#define DLT_USER5 152 49481477Smarkm#define DLT_USER6 153 49581477Smarkm#define DLT_USER7 154 49681477Smarkm#define DLT_USER8 155 49781477Smarkm#define DLT_USER9 156 49881477Smarkm#define DLT_USER10 157 49981477Smarkm#define DLT_USER11 158 50081477Smarkm#define DLT_USER12 159 50181477Smarkm#define DLT_USER13 160 50281477Smarkm#define DLT_USER14 161 50381477Smarkm#define DLT_USER15 162 50481477Smarkm 50581477Smarkm/* 50681477Smarkm * For future use with 802.11 captures - defined by AbsoluteValue 50781477Smarkm * Systems to store a number of bits of link-layer information 50881477Smarkm * including radio information: 50981477Smarkm * 51081477Smarkm * http://www.shaftnet.org/~pizza/software/capturefrm.txt 51181477Smarkm * 51281477Smarkm * but it might be used by some non-AVS drivers now or in the 51381477Smarkm * future. 51481477Smarkm */ 51581477Smarkm#define DLT_IEEE802_11_RADIO_AVS 163 /* 802.11 plus AVS radio header */ 51681477Smarkm 51781477Smarkm/* 51881477Smarkm * Juniper-private data link type, as per request from 51981477Smarkm * Hannes Gredler <hannes@juniper.net>. The DLT_s are used 52081477Smarkm * for passing on chassis-internal metainformation such as 52181477Smarkm * QOS profiles, etc.. 52281477Smarkm */ 52381477Smarkm#define DLT_JUNIPER_MONITOR 164 52481477Smarkm 52581477Smarkm/* 52681477Smarkm * Reserved for BACnet MS/TP. 52781477Smarkm */ 52881477Smarkm#define DLT_BACNET_MS_TP 165 52981477Smarkm 53081477Smarkm/* 53181477Smarkm * Another PPP variant as per request from Karsten Keil <kkeil@suse.de>. 53281477Smarkm * 53381477Smarkm * This is used in some OSes to allow a kernel socket filter to distinguish 53481477Smarkm * between incoming and outgoing packets, on a socket intended to 53581477Smarkm * supply pppd with outgoing packets so it can do dial-on-demand and 53681477Smarkm * hangup-on-lack-of-demand; incoming packets are filtered out so they 53781477Smarkm * don't cause pppd to hold the connection up (you don't want random 53881477Smarkm * input packets such as port scans, packets from old lost connections, 53981477Smarkm * etc. to force the connection to stay up). 54081477Smarkm * 54181477Smarkm * The first byte of the PPP header (0xff03) is modified to accomodate 54281477Smarkm * the direction - 0x00 = IN, 0x01 = OUT. 54381477Smarkm */ 54481477Smarkm#define DLT_PPP_PPPD 166 54581477Smarkm 54681477Smarkm/* 54781477Smarkm * Names for backwards compatibility with older versions of some PPP 54881477Smarkm * software; new software should use DLT_PPP_PPPD. 54981477Smarkm */ 55081477Smarkm#define DLT_PPP_WITH_DIRECTION DLT_PPP_PPPD 55181477Smarkm#define DLT_LINUX_PPP_WITHDIRECTION DLT_PPP_PPPD 55281477Smarkm 55381477Smarkm/* 55481477Smarkm * Juniper-private data link type, as per request from 55581477Smarkm * Hannes Gredler <hannes@juniper.net>. The DLT_s are used 55681477Smarkm * for passing on chassis-internal metainformation such as 55781477Smarkm * QOS profiles, cookies, etc.. 55881477Smarkm */ 55981477Smarkm#define DLT_JUNIPER_PPPOE 167 56081477Smarkm#define DLT_JUNIPER_PPPOE_ATM 168 56181477Smarkm 56281477Smarkm#define DLT_GPRS_LLC 169 /* GPRS LLC */ 56381477Smarkm#define DLT_GPF_T 170 /* GPF-T (ITU-T G.7041/Y.1303) */ 56481477Smarkm#define DLT_GPF_F 171 /* GPF-F (ITU-T G.7041/Y.1303) */ 56581477Smarkm 56681477Smarkm/* 56781477Smarkm * Requested by Oolan Zimmer <oz@gcom.com> for use in Gcom's T1/E1 line 56881477Smarkm * monitoring equipment. 56981477Smarkm */ 57081477Smarkm#define DLT_GCOM_T1E1 172 57181477Smarkm#define DLT_GCOM_SERIAL 173 57281477Smarkm 57381477Smarkm/* 57481477Smarkm * Juniper-private data link type, as per request from 57581477Smarkm * Hannes Gredler <hannes@juniper.net>. The DLT_ is used 57681477Smarkm * for internal communication to Physical Interface Cards (PIC) 57781477Smarkm */ 57881477Smarkm#define DLT_JUNIPER_PIC_PEER 174 57981477Smarkm 58081477Smarkm/* 58181477Smarkm * Link types requested by Gregor Maier <gregor@endace.com> of Endace 58281477Smarkm * Measurement Systems. They add an ERF header (see 58381477Smarkm * http://www.endace.com/support/EndaceRecordFormat.pdf) in front of 58481477Smarkm * the link-layer header. 58581477Smarkm */ 58681477Smarkm#define DLT_ERF_ETH 175 /* Ethernet */ 58781477Smarkm#define DLT_ERF_POS 176 /* Packet-over-SONET */ 58881477Smarkm 58981477Smarkm/* 59081477Smarkm * Requested by Daniele Orlandi <daniele@orlandi.com> for raw LAPD 59181477Smarkm * for vISDN (http://www.orlandi.com/visdn/). Its link-layer header 59281477Smarkm * includes additional information before the LAPD header, so it's 59381477Smarkm * not necessarily a generic LAPD header. 59481477Smarkm */ 59581477Smarkm#define DLT_LINUX_LAPD 177 59681477Smarkm 59781477Smarkm/* 59881477Smarkm * Juniper-private data link type, as per request from 59981477Smarkm * Hannes Gredler <hannes@juniper.net>. 60081477Smarkm * The DLT_ are used for prepending meta-information 60181477Smarkm * like interface index, interface name 60281477Smarkm * before standard Ethernet, PPP, Frelay & C-HDLC Frames 60381477Smarkm */ 60481477Smarkm#define DLT_JUNIPER_ETHER 178 60581477Smarkm#define DLT_JUNIPER_PPP 179 60681477Smarkm#define DLT_JUNIPER_FRELAY 180 60781477Smarkm#define DLT_JUNIPER_CHDLC 181 60881477Smarkm 60981477Smarkm/* 61081477Smarkm * Multi Link Frame Relay (FRF.16) 61181477Smarkm */ 61281477Smarkm#define DLT_MFR 182 61381477Smarkm 61481477Smarkm/* 61581477Smarkm * Juniper-private data link type, as per request from 61681477Smarkm * Hannes Gredler <hannes@juniper.net>. 61781477Smarkm * The DLT_ is used for internal communication with a 61881477Smarkm * voice Adapter Card (PIC) 61981477Smarkm */ 62081477Smarkm#define DLT_JUNIPER_VP 183 62181477Smarkm 62281477Smarkm/* 62381477Smarkm * Arinc 429 frames. 62481477Smarkm * DLT_ requested by Gianluca Varenni <gianluca.varenni@cacetech.com>. 62581477Smarkm * Every frame contains a 32bit A429 label. 62681477Smarkm * More documentation on Arinc 429 can be found at 62781477Smarkm * http://www.condoreng.com/support/downloads/tutorials/ARINCTutorial.pdf 62881477Smarkm */ 62981477Smarkm#define DLT_A429 184 63081477Smarkm 63181477Smarkm/* 63281477Smarkm * Arinc 653 Interpartition Communication messages. 63381477Smarkm * DLT_ requested by Gianluca Varenni <gianluca.varenni@cacetech.com>. 63481477Smarkm * Please refer to the A653-1 standard for more information. 63581477Smarkm */ 63681477Smarkm#define DLT_A653_ICM 185 63781477Smarkm 63881477Smarkm/* 63981477Smarkm * USB packets, beginning with a USB setup header; requested by 64081477Smarkm * Paolo Abeni <paolo.abeni@email.it>. 64181477Smarkm */ 64281477Smarkm#define DLT_USB 186 64381477Smarkm 64481477Smarkm/* 64581477Smarkm * Bluetooth HCI UART transport layer (part H:4); requested by 64681477Smarkm * Paolo Abeni. 64781477Smarkm */ 64881477Smarkm#define DLT_BLUETOOTH_HCI_H4 187 64981477Smarkm 65081477Smarkm/* 65181477Smarkm * IEEE 802.16 MAC Common Part Sublayer; requested by Maria Cruz 65281477Smarkm * <cruz_petagay@bah.com>. 65381477Smarkm */ 65481477Smarkm#define DLT_IEEE802_16_MAC_CPS 188 65581477Smarkm 65681477Smarkm/* 65781477Smarkm * USB packets, beginning with a Linux USB header; requested by 65881477Smarkm * Paolo Abeni <paolo.abeni@email.it>. 65981477Smarkm */ 66081477Smarkm#define DLT_USB_LINUX 189 66181477Smarkm 66281477Smarkm/* 66381477Smarkm * Controller Area Network (CAN) v. 2.0B packets. 66481477Smarkm * DLT_ requested by Gianluca Varenni <gianluca.varenni@cacetech.com>. 66581477Smarkm * Used to dump CAN packets coming from a CAN Vector board. 66681477Smarkm * More documentation on the CAN v2.0B frames can be found at 66781477Smarkm * http://www.can-cia.org/downloads/?269 66881477Smarkm */ 66981477Smarkm#define DLT_CAN20B 190 67081477Smarkm 67181477Smarkm/* 67281477Smarkm * IEEE 802.15.4, with address fields padded, as is done by Linux 67381477Smarkm * drivers; requested by Juergen Schimmer. 67481477Smarkm */ 67581477Smarkm#define DLT_IEEE802_15_4_LINUX 191 67681477Smarkm 67781477Smarkm/* 67881477Smarkm * Per Packet Information encapsulated packets. 67981477Smarkm * DLT_ requested by Gianluca Varenni <gianluca.varenni@cacetech.com>. 68081477Smarkm */ 68181477Smarkm#define DLT_PPI 192 68281477Smarkm 68381477Smarkm/* 68481477Smarkm * Header for 802.16 MAC Common Part Sublayer plus a radiotap radio header; 68581477Smarkm * requested by Charles Clancy. 68681477Smarkm */ 68781477Smarkm#define DLT_IEEE802_16_MAC_CPS_RADIO 193 68881477Smarkm 68981477Smarkm/* 69081477Smarkm * Juniper-private data link type, as per request from 69181477Smarkm * Hannes Gredler <hannes@juniper.net>. 69281477Smarkm * The DLT_ is used for internal communication with a 69381477Smarkm * integrated service module (ISM). 69481477Smarkm */ 69581477Smarkm#define DLT_JUNIPER_ISM 194 69681477Smarkm 69781477Smarkm/* 69881477Smarkm * IEEE 802.15.4, exactly as it appears in the spec (no padding, no 69981477Smarkm * nothing); requested by Mikko Saarnivala <mikko.saarnivala@sensinode.com>. 70081477Smarkm */ 70181477Smarkm#define DLT_IEEE802_15_4 195 70281477Smarkm 70381477Smarkm/* 70481477Smarkm * Various link-layer types, with a pseudo-header, for SITA 70581477Smarkm * (http://www.sita.aero/); requested by Fulko Hew (fulko.hew@gmail.com). 70681477Smarkm */ 70781477Smarkm#define DLT_SITA 196 70881477Smarkm 70981477Smarkm/* 71081477Smarkm * Various link-layer types, with a pseudo-header, for Endace DAG cards; 71181477Smarkm * encapsulates Endace ERF records. Requested by Stephen Donnelly 71281477Smarkm * <stephen@endace.com>. 71381477Smarkm */ 71481477Smarkm#define DLT_ERF 197 71581477Smarkm 71681477Smarkm/* 71781477Smarkm * Special header prepended to Ethernet packets when capturing from a 71881477Smarkm * u10 Networks board. Requested by Phil Mulholland 71981477Smarkm * <phil@u10networks.com>. 72081477Smarkm */ 72181477Smarkm#define DLT_RAIF1 198 72281477Smarkm 72381477Smarkm/* 72481477Smarkm * IPMB packet for IPMI, beginning with the I2C slave address, followed 72581477Smarkm * by the netFn and LUN, etc.. Requested by Chanthy Toeung 72681477Smarkm * <chanthy.toeung@ca.kontron.com>. 72781477Smarkm */ 72881477Smarkm#define DLT_IPMB 199 72981477Smarkm 73081477Smarkm/* 73181477Smarkm * Juniper-private data link type, as per request from 73281477Smarkm * Hannes Gredler <hannes@juniper.net>. 73381477Smarkm * The DLT_ is used for capturing data on a secure tunnel interface. 73481477Smarkm */ 73581477Smarkm#define DLT_JUNIPER_ST 200 73681477Smarkm 73781477Smarkm/* 73881477Smarkm * Bluetooth HCI UART transport layer (part H:4), with pseudo-header 73981477Smarkm * that includes direction information; requested by Paolo Abeni. 74081477Smarkm */ 74181477Smarkm#define DLT_BLUETOOTH_HCI_H4_WITH_PHDR 201 74281477Smarkm 74381477Smarkm/* 74481477Smarkm * AX.25 packet with a 1-byte KISS header; see 74581477Smarkm * 74681477Smarkm * http://www.ax25.net/kiss.htm 74781477Smarkm * 74881477Smarkm * as per Richard Stearn <richard@rns-stearn.demon.co.uk>. 74981477Smarkm */ 75081477Smarkm#define DLT_AX25_KISS 202 75181477Smarkm 75281477Smarkm/* 75381477Smarkm * LAPD packets from an ISDN channel, starting with the address field, 75481477Smarkm * with no pseudo-header. 75581477Smarkm * Requested by Varuna De Silva <varunax@gmail.com>. 75681477Smarkm */ 75781477Smarkm#define DLT_LAPD 203 75881477Smarkm 75981477Smarkm/* 76081477Smarkm * Variants of various link-layer headers, with a one-byte direction 76181477Smarkm * pseudo-header prepended - zero means "received by this host", 76281477Smarkm * non-zero (any non-zero value) means "sent by this host" - as per 76381477Smarkm * Will Barker <w.barker@zen.co.uk>. 76481477Smarkm */ 76581477Smarkm#define DLT_PPP_WITH_DIR 204 /* PPP - don't confuse with DLT_PPP_WITH_DIRECTION */ 76681477Smarkm#define DLT_C_HDLC_WITH_DIR 205 /* Cisco HDLC */ 76781477Smarkm#define DLT_FRELAY_WITH_DIR 206 /* Frame Relay */ 76881477Smarkm#define DLT_LAPB_WITH_DIR 207 /* LAPB */ 76981477Smarkm 77081477Smarkm/* 77181477Smarkm * 208 is reserved for an as-yet-unspecified proprietary link-layer 77281477Smarkm * type, as requested by Will Barker. 77381477Smarkm */ 77481477Smarkm 77581477Smarkm/* 77681477Smarkm * IPMB with a Linux-specific pseudo-header; as requested by Alexey Neyman 77781477Smarkm * <avn@pigeonpoint.com>. 77881477Smarkm */ 77981477Smarkm#define DLT_IPMB_LINUX 209 78081477Smarkm 78181477Smarkm/* 78281477Smarkm * FlexRay automotive bus - http://www.flexray.com/ - as requested 78381477Smarkm * by Hannes Kaelber <hannes.kaelber@x2e.de>. 78481477Smarkm */ 78581477Smarkm#define DLT_FLEXRAY 210 78681477Smarkm 78781477Smarkm/* 78881477Smarkm * Media Oriented Systems Transport (MOST) bus for multimedia 78981477Smarkm * transport - http://www.mostcooperation.com/ - as requested 79081477Smarkm * by Hannes Kaelber <hannes.kaelber@x2e.de>. 79181477Smarkm */ 79281477Smarkm#define DLT_MOST 211 79381477Smarkm 79481477Smarkm/* 79581477Smarkm * Local Interconnect Network (LIN) bus for vehicle networks - 79681477Smarkm * http://www.lin-subbus.org/ - as requested by Hannes Kaelber 79781477Smarkm * <hannes.kaelber@x2e.de>. 79881477Smarkm */ 79981477Smarkm#define DLT_LIN 212 80081477Smarkm 80181477Smarkm/* 80281477Smarkm * X2E-private data link type used for serial line capture, 80381477Smarkm * as requested by Hannes Kaelber <hannes.kaelber@x2e.de>. 80481477Smarkm */ 80581477Smarkm#define DLT_X2E_SERIAL 213 80681477Smarkm 80781477Smarkm/* 80881477Smarkm * X2E-private data link type used for the Xoraya data logger 80981477Smarkm * family, as requested by Hannes Kaelber <hannes.kaelber@x2e.de>. 81081477Smarkm */ 81181477Smarkm#define DLT_X2E_XORAYA 214 81281477Smarkm 81381477Smarkm/* 81481477Smarkm * IEEE 802.15.4, exactly as it appears in the spec (no padding, no 81581477Smarkm * nothing), but with the PHY-level data for non-ASK PHYs (4 octets 81681477Smarkm * of 0 as preamble, one octet of SFD, one octet of frame length+ 81781477Smarkm * reserved bit, and then the MAC-layer data, starting with the 81881477Smarkm * frame control field). 81981477Smarkm * 82081477Smarkm * Requested by Max Filippov <jcmvbkbc@gmail.com>. 82181477Smarkm */ 82281477Smarkm#define DLT_IEEE802_15_4_NONASK_PHY 215 82381477Smarkm 82481477Smarkm 82581477Smarkm/* 82681477Smarkm * DLT and savefile link type values are split into a class and 82781477Smarkm * a member of that class. A class value of 0 indicates a regular 82881477Smarkm * DLT_/LINKTYPE_ value. 82981477Smarkm */ 83081477Smarkm#define DLT_CLASS(x) ((x) & 0x03ff0000) 83181477Smarkm 83281477Smarkm/* 83381477Smarkm * NetBSD-specific generic "raw" link type. The class value indicates 83481477Smarkm * that this is the generic raw type, and the lower 16 bits are the 83581477Smarkm * address family we're dealing with. Those values are NetBSD-specific; 83681477Smarkm * do not assume that they correspond to AF_ values for your operating 83781477Smarkm * system. 83881477Smarkm */ 83981477Smarkm#define DLT_CLASS_NETBSD_RAWAF 0x02240000 84081477Smarkm#define DLT_NETBSD_RAWAF(af) (DLT_CLASS_NETBSD_RAWAF | (af)) 84181477Smarkm#define DLT_NETBSD_RAWAF_AF(x) ((x) & 0x0000ffff) 84281477Smarkm#define DLT_IS_NETBSD_RAWAF(x) (DLT_CLASS(x) == DLT_CLASS_NETBSD_RAWAF) 84381477Smarkm 84481477Smarkm 84581477Smarkm/* 84681477Smarkm * The instruction encodings. 84781477Smarkm */ 84881477Smarkm/* instruction classes */ 84981477Smarkm#define BPF_CLASS(code) ((code) & 0x07) 85081477Smarkm#define BPF_LD 0x00 85181477Smarkm#define BPF_LDX 0x01 85281477Smarkm#define BPF_ST 0x02 85381477Smarkm#define BPF_STX 0x03 85481477Smarkm#define BPF_ALU 0x04 85581477Smarkm#define BPF_JMP 0x05 85681477Smarkm#define BPF_RET 0x06 85781477Smarkm#define BPF_MISC 0x07 85881477Smarkm 85981477Smarkm/* ld/ldx fields */ 86081477Smarkm#define BPF_SIZE(code) ((code) & 0x18) 86181477Smarkm#define BPF_W 0x00 86281477Smarkm#define BPF_H 0x08 86381477Smarkm#define BPF_B 0x10 86481477Smarkm#define BPF_MODE(code) ((code) & 0xe0) 86581477Smarkm#define BPF_IMM 0x00 86681477Smarkm#define BPF_ABS 0x20 86781477Smarkm#define BPF_IND 0x40 86881477Smarkm#define BPF_MEM 0x60 86981477Smarkm#define BPF_LEN 0x80 87081477Smarkm#define BPF_MSH 0xa0 87181477Smarkm 87281477Smarkm/* alu/jmp fields */ 87381477Smarkm#define BPF_OP(code) ((code) & 0xf0) 87481477Smarkm#define BPF_ADD 0x00 87581477Smarkm#define BPF_SUB 0x10 87681477Smarkm#define BPF_MUL 0x20 87781477Smarkm#define BPF_DIV 0x30 87881477Smarkm#define BPF_OR 0x40 87981477Smarkm#define BPF_AND 0x50 88081477Smarkm#define BPF_LSH 0x60 88181477Smarkm#define BPF_RSH 0x70 88281477Smarkm#define BPF_NEG 0x80 88381477Smarkm#define BPF_JA 0x00 88481477Smarkm#define BPF_JEQ 0x10 88581477Smarkm#define BPF_JGT 0x20 88681477Smarkm#define BPF_JGE 0x30 88781477Smarkm#define BPF_JSET 0x40 88881477Smarkm#define BPF_SRC(code) ((code) & 0x08) 88981477Smarkm#define BPF_K 0x00 89081477Smarkm#define BPF_X 0x08 89181477Smarkm 89281477Smarkm/* ret - BPF_K and BPF_X also apply */ 89381477Smarkm#define BPF_RVAL(code) ((code) & 0x18) 89481477Smarkm#define BPF_A 0x10 89581477Smarkm 89681477Smarkm/* misc */ 89781477Smarkm#define BPF_MISCOP(code) ((code) & 0xf8) 89881477Smarkm#define BPF_TAX 0x00 89981477Smarkm#define BPF_TXA 0x80 90081477Smarkm 90181477Smarkm/* 90281477Smarkm * The instruction data structure. 90381477Smarkm */ 90481477Smarkmstruct bpf_insn { 90581477Smarkm u_short code; 90681477Smarkm u_char jt; 90781477Smarkm u_char jf; 90881477Smarkm bpf_u_int32 k; 90981477Smarkm}; 91081477Smarkm 91181477Smarkm/* 91281477Smarkm * Macros for insn array initializers. 91381477Smarkm */ 91481477Smarkm#define BPF_STMT(code, k) { (u_short)(code), 0, 0, k } 91581477Smarkm#define BPF_JUMP(code, k, jt, jf) { (u_short)(code), jt, jf, k } 91681477Smarkm 91781477Smarkm#if __STDC__ || defined(__cplusplus) 91881477Smarkmextern int bpf_validate(const struct bpf_insn *, int); 91981477Smarkmextern u_int bpf_filter(struct bpf_insn *, u_char *, u_int, u_int); 92081477Smarkm#else 92181477Smarkmextern int bpf_validate(); 92281477Smarkmextern u_int bpf_filter(); 92381477Smarkm#endif 92481477Smarkm 92581477Smarkm/* 92681477Smarkm * Number of scratch memory words (for BPF_LD|BPF_MEM and BPF_ST). 92781477Smarkm */ 92881477Smarkm#define BPF_MEMWORDS 16 92981477Smarkm 93081477Smarkm#ifdef __cplusplus 93181477Smarkm} 93281477Smarkm#endif 93381477Smarkm 93481477Smarkm#endif 93581477Smarkm