1139823Simp/*- 21541Srgrimes * Copyright (c) 1990, 1991, 1993 3229073Slstewart * The Regents of the University of California. All rights reserved. 41541Srgrimes * 51541Srgrimes * This code is derived from the Stanford/CMU enet packet filter, 61541Srgrimes * (net/enet.c) distributed as part of 4.3BSD, and code contributed 71541Srgrimes * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence 81541Srgrimes * Berkeley Laboratory. 91541Srgrimes * 101541Srgrimes * Redistribution and use in source and binary forms, with or without 111541Srgrimes * modification, are permitted provided that the following conditions 121541Srgrimes * are met: 131541Srgrimes * 1. Redistributions of source code must retain the above copyright 141541Srgrimes * notice, this list of conditions and the following disclaimer. 151541Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 161541Srgrimes * notice, this list of conditions and the following disclaimer in the 171541Srgrimes * documentation and/or other materials provided with the distribution. 181541Srgrimes * 4. Neither the name of the University nor the names of its contributors 191541Srgrimes * may be used to endorse or promote products derived from this software 201541Srgrimes * without specific prior written permission. 211541Srgrimes * 221541Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 231541Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 241541Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 251541Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 261541Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 271541Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 281541Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 291541Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 301541Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 311541Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 321541Srgrimes * SUCH DAMAGE. 331541Srgrimes * 341541Srgrimes * @(#)bpf.h 8.1 (Berkeley) 6/10/93 3517679Spst * @(#)bpf.h 1.34 (LBL) 6/16/96 361541Srgrimes * 3750477Speter * $FreeBSD$ 381541Srgrimes */ 391541Srgrimes 402168Spaul#ifndef _NET_BPF_H_ 412168Spaul#define _NET_BPF_H_ 422168Spaul 4317679Spst/* BSD style release date */ 4417679Spst#define BPF_RELEASE 199606 4517679Spst 4617679Spsttypedef int32_t bpf_int32; 4717679Spsttypedef u_int32_t bpf_u_int32; 48209216Sjkimtypedef int64_t bpf_int64; 49209216Sjkimtypedef u_int64_t bpf_u_int64; 5017679Spst 511541Srgrimes/* 528876Srgrimes * Alignment macros. BPF_WORDALIGN rounds up to the next 538876Srgrimes * even multiple of BPF_ALIGNMENT. 541541Srgrimes */ 5539963Salex#define BPF_ALIGNMENT sizeof(long) 561541Srgrimes#define BPF_WORDALIGN(x) (((x)+(BPF_ALIGNMENT-1))&~(BPF_ALIGNMENT-1)) 571541Srgrimes 581541Srgrimes#define BPF_MAXINSNS 512 5956057Sphk#define BPF_MAXBUFSIZE 0x80000 601541Srgrimes#define BPF_MINBUFSIZE 32 611541Srgrimes 621541Srgrimes/* 631541Srgrimes * Structure for BIOCSETF. 641541Srgrimes */ 651541Srgrimesstruct bpf_program { 661541Srgrimes u_int bf_len; 671541Srgrimes struct bpf_insn *bf_insns; 681541Srgrimes}; 698876Srgrimes 701541Srgrimes/* 711541Srgrimes * Struct returned by BIOCGSTATS. 721541Srgrimes */ 731541Srgrimesstruct bpf_stat { 741541Srgrimes u_int bs_recv; /* number of packets received */ 751541Srgrimes u_int bs_drop; /* number of packets dropped */ 761541Srgrimes}; 771541Srgrimes 781541Srgrimes/* 798876Srgrimes * Struct return by BIOCVERSION. This represents the version number of 801541Srgrimes * the filter language described by the instruction encodings below. 811541Srgrimes * bpf understands a program iff kernel_major == filter_major && 821541Srgrimes * kernel_minor >= filter_minor, that is, if the value returned by the 831541Srgrimes * running kernel has the same major number and a minor number equal 841541Srgrimes * equal to or less than the filter being downloaded. Otherwise, the 851541Srgrimes * results are undefined, meaning an error may be returned or packets 861541Srgrimes * may be accepted haphazardly. 871541Srgrimes * It has nothing to do with the source code version. 881541Srgrimes */ 891541Srgrimesstruct bpf_version { 901541Srgrimes u_short bv_major; 911541Srgrimes u_short bv_minor; 921541Srgrimes}; 9317679Spst/* Current version number of filter architecture. */ 941541Srgrimes#define BPF_MAJOR_VERSION 1 951541Srgrimes#define BPF_MINOR_VERSION 1 961541Srgrimes 97177548Scsjp/* 98177548Scsjp * Historically, BPF has supported a single buffering model, first using mbuf 99177548Scsjp * clusters in kernel, and later using malloc(9) buffers in kernel. We now 100177548Scsjp * support multiple buffering modes, which may be queried and set using 101177548Scsjp * BIOCGETBUFMODE and BIOCSETBUFMODE. So as to avoid handling the complexity 102177548Scsjp * of changing modes while sniffing packets, the mode becomes fixed once an 103177548Scsjp * interface has been attached to the BPF descriptor. 104177548Scsjp */ 105177548Scsjp#define BPF_BUFMODE_BUFFER 1 /* Kernel buffers with read(). */ 106177548Scsjp#define BPF_BUFMODE_ZBUF 2 /* Zero-copy buffers. */ 107177548Scsjp 108177548Scsjp/*- 109177548Scsjp * Struct used by BIOCSETZBUF, BIOCROTZBUF: describes up to two zero-copy 110177548Scsjp * buffer as used by BPF. 111177548Scsjp */ 112177548Scsjpstruct bpf_zbuf { 113177548Scsjp void *bz_bufa; /* Location of 'a' zero-copy buffer. */ 114177548Scsjp void *bz_bufb; /* Location of 'b' zero-copy buffer. */ 115177548Scsjp size_t bz_buflen; /* Size of zero-copy buffers. */ 116177548Scsjp}; 117177548Scsjp 118209216Sjkim#define BIOCGBLEN _IOR('B', 102, u_int) 119209216Sjkim#define BIOCSBLEN _IOWR('B', 102, u_int) 120209216Sjkim#define BIOCSETF _IOW('B', 103, struct bpf_program) 121209216Sjkim#define BIOCFLUSH _IO('B', 104) 122209216Sjkim#define BIOCPROMISC _IO('B', 105) 123209216Sjkim#define BIOCGDLT _IOR('B', 106, u_int) 124209216Sjkim#define BIOCGETIF _IOR('B', 107, struct ifreq) 125209216Sjkim#define BIOCSETIF _IOW('B', 108, struct ifreq) 126209216Sjkim#define BIOCSRTIMEOUT _IOW('B', 109, struct timeval) 127209216Sjkim#define BIOCGRTIMEOUT _IOR('B', 110, struct timeval) 128209216Sjkim#define BIOCGSTATS _IOR('B', 111, struct bpf_stat) 129209216Sjkim#define BIOCIMMEDIATE _IOW('B', 112, u_int) 130209216Sjkim#define BIOCVERSION _IOR('B', 113, struct bpf_version) 131209216Sjkim#define BIOCGRSIG _IOR('B', 114, u_int) 132209216Sjkim#define BIOCSRSIG _IOW('B', 115, u_int) 133209216Sjkim#define BIOCGHDRCMPLT _IOR('B', 116, u_int) 134209216Sjkim#define BIOCSHDRCMPLT _IOW('B', 117, u_int) 135209216Sjkim#define BIOCGDIRECTION _IOR('B', 118, u_int) 136209216Sjkim#define BIOCSDIRECTION _IOW('B', 119, u_int) 137209216Sjkim#define BIOCSDLT _IOW('B', 120, u_int) 138209216Sjkim#define BIOCGDLTLIST _IOWR('B', 121, struct bpf_dltlist) 139149376Scsjp#define BIOCLOCK _IO('B', 122) 140209216Sjkim#define BIOCSETWF _IOW('B', 123, struct bpf_program) 141209216Sjkim#define BIOCFEEDBACK _IOW('B', 124, u_int) 142209216Sjkim#define BIOCGETBUFMODE _IOR('B', 125, u_int) 143209216Sjkim#define BIOCSETBUFMODE _IOW('B', 126, u_int) 144209216Sjkim#define BIOCGETZMAX _IOR('B', 127, size_t) 145209216Sjkim#define BIOCROTZBUF _IOR('B', 128, struct bpf_zbuf) 146209216Sjkim#define BIOCSETZBUF _IOW('B', 129, struct bpf_zbuf) 147209216Sjkim#define BIOCSETFNR _IOW('B', 130, struct bpf_program) 148209216Sjkim#define BIOCGTSTAMP _IOR('B', 131, u_int) 149209216Sjkim#define BIOCSTSTAMP _IOW('B', 132, u_int) 1501541Srgrimes 151167035Sjkim/* Obsolete */ 152167035Sjkim#define BIOCGSEESENT BIOCGDIRECTION 153167035Sjkim#define BIOCSSEESENT BIOCSDIRECTION 154167035Sjkim 155167035Sjkim/* Packet directions */ 156167035Sjkimenum bpf_direction { 157167035Sjkim BPF_D_IN, /* See incoming packets */ 158167035Sjkim BPF_D_INOUT, /* See incoming and outgoing packets */ 159167035Sjkim BPF_D_OUT /* See outgoing packets */ 160167035Sjkim}; 161167035Sjkim 162209216Sjkim/* Time stamping functions */ 163209216Sjkim#define BPF_T_MICROTIME 0x0000 164209216Sjkim#define BPF_T_NANOTIME 0x0001 165209216Sjkim#define BPF_T_BINTIME 0x0002 166209216Sjkim#define BPF_T_NONE 0x0003 167209216Sjkim#define BPF_T_FORMAT_MASK 0x0003 168209216Sjkim#define BPF_T_NORMAL 0x0000 169229073Slstewart#define BPF_T_FAST 0x0100 170229073Slstewart#define BPF_T_MONOTONIC 0x0200 171229073Slstewart#define BPF_T_MONOTONIC_FAST (BPF_T_FAST | BPF_T_MONOTONIC) 172229073Slstewart#define BPF_T_FLAG_MASK 0x0300 173209216Sjkim#define BPF_T_FORMAT(t) ((t) & BPF_T_FORMAT_MASK) 174209216Sjkim#define BPF_T_FLAG(t) ((t) & BPF_T_FLAG_MASK) 175209216Sjkim#define BPF_T_VALID(t) \ 176209216Sjkim ((t) == BPF_T_NONE || (BPF_T_FORMAT(t) != BPF_T_NONE && \ 177209216Sjkim ((t) & ~(BPF_T_FORMAT_MASK | BPF_T_FLAG_MASK)) == 0)) 178209216Sjkim 179229073Slstewart#define BPF_T_MICROTIME_FAST (BPF_T_MICROTIME | BPF_T_FAST) 180229073Slstewart#define BPF_T_NANOTIME_FAST (BPF_T_NANOTIME | BPF_T_FAST) 181229073Slstewart#define BPF_T_BINTIME_FAST (BPF_T_BINTIME | BPF_T_FAST) 182209216Sjkim#define BPF_T_MICROTIME_MONOTONIC (BPF_T_MICROTIME | BPF_T_MONOTONIC) 183209216Sjkim#define BPF_T_NANOTIME_MONOTONIC (BPF_T_NANOTIME | BPF_T_MONOTONIC) 184209216Sjkim#define BPF_T_BINTIME_MONOTONIC (BPF_T_BINTIME | BPF_T_MONOTONIC) 185229073Slstewart#define BPF_T_MICROTIME_MONOTONIC_FAST (BPF_T_MICROTIME | BPF_T_MONOTONIC_FAST) 186229073Slstewart#define BPF_T_NANOTIME_MONOTONIC_FAST (BPF_T_NANOTIME | BPF_T_MONOTONIC_FAST) 187229073Slstewart#define BPF_T_BINTIME_MONOTONIC_FAST (BPF_T_BINTIME | BPF_T_MONOTONIC_FAST) 188209216Sjkim 1891541Srgrimes/* 1901541Srgrimes * Structure prepended to each packet. 1911541Srgrimes */ 192209216Sjkimstruct bpf_ts { 193209216Sjkim bpf_int64 bt_sec; /* seconds */ 194209216Sjkim bpf_u_int64 bt_frac; /* fraction */ 195209216Sjkim}; 196209216Sjkimstruct bpf_xhdr { 197209216Sjkim struct bpf_ts bh_tstamp; /* time stamp */ 198209216Sjkim bpf_u_int32 bh_caplen; /* length of captured portion */ 199209216Sjkim bpf_u_int32 bh_datalen; /* original length of packet */ 200209216Sjkim u_short bh_hdrlen; /* length of bpf header (this struct 201209216Sjkim plus alignment padding) */ 202209216Sjkim}; 203209216Sjkim/* Obsolete */ 2041541Srgrimesstruct bpf_hdr { 2051541Srgrimes struct timeval bh_tstamp; /* time stamp */ 20617679Spst bpf_u_int32 bh_caplen; /* length of captured portion */ 20717679Spst bpf_u_int32 bh_datalen; /* original length of packet */ 2081541Srgrimes u_short bh_hdrlen; /* length of bpf header (this struct 2091541Srgrimes plus alignment padding) */ 2101541Srgrimes}; 21155205Speter#ifdef _KERNEL 212209216Sjkim#define MTAG_BPF 0x627066 213209216Sjkim#define MTAG_BPF_TIMESTAMP 0 2141541Srgrimes#endif 2151541Srgrimes 2161541Srgrimes/* 217177548Scsjp * When using zero-copy BPF buffers, a shared memory header is present 218177548Scsjp * allowing the kernel BPF implementation and user process to synchronize 219177548Scsjp * without using system calls. This structure defines that header. When 220177548Scsjp * accessing these fields, appropriate atomic operation and memory barriers 221177548Scsjp * are required in order not to see stale or out-of-order data; see bpf(4) 222177548Scsjp * for reference code to access these fields from userspace. 223177548Scsjp * 224177548Scsjp * The layout of this structure is critical, and must not be changed; if must 225177548Scsjp * fit in a single page on all architectures. 226177548Scsjp */ 227177548Scsjpstruct bpf_zbuf_header { 228177548Scsjp volatile u_int bzh_kernel_gen; /* Kernel generation number. */ 229177548Scsjp volatile u_int bzh_kernel_len; /* Length of data in the buffer. */ 230177548Scsjp volatile u_int bzh_user_gen; /* User generation number. */ 231177548Scsjp u_int _bzh_pad[5]; 232177548Scsjp}; 233177548Scsjp 234177548Scsjp/* 2351541Srgrimes * Data-link level type codes. 2361541Srgrimes */ 237129874Sdwmalone#define DLT_NULL 0 /* BSD loopback encapsulation */ 2381541Srgrimes#define DLT_EN10MB 1 /* Ethernet (10Mb) */ 2391541Srgrimes#define DLT_EN3MB 2 /* Experimental Ethernet (3Mb) */ 2401541Srgrimes#define DLT_AX25 3 /* Amateur Radio AX.25 */ 2411541Srgrimes#define DLT_PRONET 4 /* Proteon ProNET Token Ring */ 2421541Srgrimes#define DLT_CHAOS 5 /* Chaos */ 2431541Srgrimes#define DLT_IEEE802 6 /* IEEE 802 Networks */ 2441541Srgrimes#define DLT_ARCNET 7 /* ARCNET */ 2451541Srgrimes#define DLT_SLIP 8 /* Serial Line IP */ 2461541Srgrimes#define DLT_PPP 9 /* Point-to-point Protocol */ 2471541Srgrimes#define DLT_FDDI 10 /* FDDI */ 24817679Spst#define DLT_ATM_RFC1483 11 /* LLC/SNAP encapsulated atm */ 24938423Sache#define DLT_RAW 12 /* raw IP */ 2501541Srgrimes 2511541Srgrimes/* 25280767Sfenner * These are values from BSD/OS's "bpf.h". 25380767Sfenner * These are not the same as the values from the traditional libpcap 25480767Sfenner * "bpf.h"; however, these values shouldn't be generated by any 25580767Sfenner * OS other than BSD/OS, so the correct values to use here are the 25680767Sfenner * BSD/OS values. 25780767Sfenner * 25880767Sfenner * Platforms that have already assigned these values to other 25980767Sfenner * DLT_ codes, however, should give these codes the values 26080767Sfenner * from that platform, so that programs that use these codes will 26180767Sfenner * continue to compile - even though they won't correctly read 26280767Sfenner * files of these types. 26380767Sfenner */ 26480767Sfenner#define DLT_SLIP_BSDOS 15 /* BSD/OS Serial Line IP */ 26580767Sfenner#define DLT_PPP_BSDOS 16 /* BSD/OS Point-to-point Protocol */ 26680767Sfenner 26780767Sfenner#define DLT_ATM_CLIP 19 /* Linux Classical-IP over ATM */ 26880767Sfenner 26980767Sfenner/* 27098540Sfenner * These values are defined by NetBSD; other platforms should refrain from 27198540Sfenner * using them for other purposes, so that NetBSD savefiles with link 27298540Sfenner * types of 50 or 51 can be read as this type on all platforms. 27380767Sfenner */ 27480767Sfenner#define DLT_PPP_SERIAL 50 /* PPP over serial with HDLC encapsulation */ 27598540Sfenner#define DLT_PPP_ETHER 51 /* PPP over Ethernet */ 27680767Sfenner 27780767Sfenner/* 278127674Sbms * Reserved for the Symantec Enterprise Firewall. 279127674Sbms */ 280127674Sbms#define DLT_SYMANTEC_FIREWALL 99 281127674Sbms 282235425Sdelphij/* 283235425Sdelphij * Values between 100 and 103 are used in capture file headers as 284235425Sdelphij * link-layer header type LINKTYPE_ values corresponding to DLT_ types 285235425Sdelphij * that differ between platforms; don't use those values for new DLT_ 286235425Sdelphij * new types. 287235425Sdelphij */ 288127674Sbms 289127674Sbms/* 290235425Sdelphij * Values starting with 104 are used for newly-assigned link-layer 291235425Sdelphij * header type values; for those link-layer header types, the DLT_ 292235425Sdelphij * value returned by pcap_datalink() and passed to pcap_open_dead(), 293235425Sdelphij * and the LINKTYPE_ value that appears in capture files, are the 294235425Sdelphij * same. 295235425Sdelphij * 296235425Sdelphij * DLT_MATCHING_MIN is the lowest such value; DLT_MATCHING_MAX is 297235425Sdelphij * the highest such value. 298235425Sdelphij */ 299235425Sdelphij#define DLT_MATCHING_MIN 104 300235425Sdelphij 301235425Sdelphij/* 30280767Sfenner * This value was defined by libpcap 0.5; platforms that have defined 30380767Sfenner * it with a different value should define it here with that value - 30480767Sfenner * a link type of 104 in a save file will be mapped to DLT_C_HDLC, 30580767Sfenner * whatever value that happens to be, so programs will correctly 30680767Sfenner * handle files with that link type regardless of the value of 30780767Sfenner * DLT_C_HDLC. 30880767Sfenner * 30980767Sfenner * The name DLT_C_HDLC was used by BSD/OS; we use that name for source 31080767Sfenner * compatibility with programs written for BSD/OS. 31180767Sfenner * 31280767Sfenner * libpcap 0.5 defined it as DLT_CHDLC; we define DLT_CHDLC as well, 31380767Sfenner * for source compatibility with programs written for libpcap 0.5. 31480767Sfenner */ 31580767Sfenner#define DLT_C_HDLC 104 /* Cisco HDLC */ 31680767Sfenner#define DLT_CHDLC DLT_C_HDLC 31780767Sfenner 31880767Sfenner#define DLT_IEEE802_11 105 /* IEEE 802.11 wireless */ 31980767Sfenner 32080767Sfenner/* 32180767Sfenner * Values between 106 and 107 are used in capture file headers as 32280767Sfenner * link-layer types corresponding to DLT_ types that might differ 32380767Sfenner * between platforms; don't use those values for new DLT_ new types. 32480767Sfenner */ 32580767Sfenner 32680767Sfenner/* 327127673Sbms * Frame Relay; BSD/OS has a DLT_FR with a value of 11, but that collides 328127673Sbms * with other values. 329127673Sbms * DLT_FR and DLT_FRELAY packets start with the Q.922 Frame Relay header 330127673Sbms * (DLCI, etc.). 331127673Sbms */ 332127673Sbms#define DLT_FRELAY 107 333127673Sbms 334127673Sbms/* 33580767Sfenner * OpenBSD DLT_LOOP, for loopback devices; it's like DLT_NULL, except 33680767Sfenner * that the AF_ type in the link-layer header is in network byte order. 33780767Sfenner * 33880767Sfenner * OpenBSD defines it as 12, but that collides with DLT_RAW, so we 33980767Sfenner * define it as 108 here. If OpenBSD picks up this file, it should 34080767Sfenner * define DLT_LOOP as 12 in its version, as per the comment above - 34198540Sfenner * and should not use 108 as a DLT_ value. 34280767Sfenner */ 34380767Sfenner#define DLT_LOOP 108 34480767Sfenner 34580767Sfenner/* 34680767Sfenner * Values between 109 and 112 are used in capture file headers as 34780767Sfenner * link-layer types corresponding to DLT_ types that might differ 34880767Sfenner * between platforms; don't use those values for new DLT_ new types. 34980767Sfenner */ 35080767Sfenner 35180767Sfenner/* 352127673Sbms * Encapsulated packets for IPsec; DLT_ENC is 13 in OpenBSD, but that's 353127673Sbms * DLT_SLIP_BSDOS in NetBSD, so we don't use 13 for it in OSes other 354127673Sbms * than OpenBSD. 355127673Sbms */ 356127673Sbms#define DLT_ENC 109 357127673Sbms 358127673Sbms/* 35980767Sfenner * This is for Linux cooked sockets. 36080767Sfenner */ 36180767Sfenner#define DLT_LINUX_SLL 113 36280767Sfenner 36380767Sfenner/* 36498540Sfenner * Apple LocalTalk hardware. 36598540Sfenner */ 36698540Sfenner#define DLT_LTALK 114 36798540Sfenner 36898540Sfenner/* 36998540Sfenner * Acorn Econet. 37098540Sfenner */ 37198540Sfenner#define DLT_ECONET 115 37298540Sfenner 37398540Sfenner/* 37498540Sfenner * Reserved for use with OpenBSD ipfilter. 37598540Sfenner */ 37698540Sfenner#define DLT_IPFILTER 116 37798540Sfenner 37898540Sfenner/* 37998540Sfenner * Reserved for use in capture-file headers as a link-layer type 38098540Sfenner * corresponding to OpenBSD DLT_PFLOG; DLT_PFLOG is 17 in OpenBSD, 38198540Sfenner * but that's DLT_LANE8023 in SuSE 6.3, so we can't use 17 for it 38298540Sfenner * in capture-file headers. 38398540Sfenner */ 38498540Sfenner#define DLT_PFLOG 117 38598540Sfenner 38698540Sfenner/* 38798540Sfenner * Registered for Cisco-internal use. 38898540Sfenner */ 38998540Sfenner#define DLT_CISCO_IOS 118 39098540Sfenner 39198540Sfenner/* 39298540Sfenner * Reserved for 802.11 cards using the Prism II chips, with a link-layer 39398540Sfenner * header including Prism monitor mode information plus an 802.11 39498540Sfenner * header. 39598540Sfenner */ 39698540Sfenner#define DLT_PRISM_HEADER 119 39798540Sfenner 39898540Sfenner/* 39998540Sfenner * Reserved for Aironet 802.11 cards, with an Aironet link-layer header 40098540Sfenner * (see Doug Ambrisko's FreeBSD patches). 40198540Sfenner */ 40298540Sfenner#define DLT_AIRONET_HEADER 120 40398540Sfenner 40498540Sfenner/* 405127673Sbms * Reserved for use by OpenBSD's pfsync device. 406127673Sbms */ 407127673Sbms#define DLT_PFSYNC 121 408127673Sbms 409127673Sbms/* 410127674Sbms * Reserved for Siemens HiPath HDLC. XXX 411127674Sbms */ 412127674Sbms#define DLT_HHDLC 121 413127674Sbms 414127674Sbms/* 415127673Sbms * Reserved for RFC 2625 IP-over-Fibre Channel. 416127673Sbms */ 417127673Sbms#define DLT_IP_OVER_FC 122 418127673Sbms 419127673Sbms/* 420127673Sbms * Reserved for Full Frontal ATM on Solaris. 421127673Sbms */ 422127673Sbms#define DLT_SUNATM 123 423127673Sbms 424127673Sbms/* 425127674Sbms * Reserved as per request from Kent Dahlgren <kent@praesum.com> 426127674Sbms * for private use. 427127674Sbms */ 428127674Sbms#define DLT_RIO 124 /* RapidIO */ 429127674Sbms#define DLT_PCI_EXP 125 /* PCI Express */ 430127674Sbms#define DLT_AURORA 126 /* Xilinx Aurora link layer */ 431127674Sbms 432127674Sbms/* 433127673Sbms * BSD header for 802.11 plus a number of bits of link-layer information 434127673Sbms * including radio information. 435127673Sbms */ 436127673Sbms#ifndef DLT_IEEE802_11_RADIO 437127673Sbms#define DLT_IEEE802_11_RADIO 127 438127673Sbms#endif 439127673Sbms 440127673Sbms/* 441127674Sbms * Reserved for TZSP encapsulation. 442127674Sbms */ 443127674Sbms#define DLT_TZSP 128 /* Tazmen Sniffer Protocol */ 444127674Sbms 445127674Sbms/* 446127673Sbms * Reserved for Linux ARCNET. 447127673Sbms */ 448127673Sbms#define DLT_ARCNET_LINUX 129 449127673Sbms 450127673Sbms/* 451127674Sbms * Juniper-private data link types. 452127674Sbms */ 453127674Sbms#define DLT_JUNIPER_MLPPP 130 454127674Sbms#define DLT_JUNIPER_MLFR 131 455127674Sbms#define DLT_JUNIPER_ES 132 456127674Sbms#define DLT_JUNIPER_GGSN 133 457127674Sbms#define DLT_JUNIPER_MFR 134 458127674Sbms#define DLT_JUNIPER_ATM2 135 459127674Sbms#define DLT_JUNIPER_SERVICES 136 460127674Sbms#define DLT_JUNIPER_ATM1 137 461127674Sbms 462127674Sbms/* 463146729Ssam * Apple IP-over-IEEE 1394, as per a request from Dieter Siegmund 464146729Ssam * <dieter@apple.com>. The header that's presented is an Ethernet-like 465146729Ssam * header: 466146729Ssam * 467146729Ssam * #define FIREWIRE_EUI64_LEN 8 468146729Ssam * struct firewire_header { 469146729Ssam * u_char firewire_dhost[FIREWIRE_EUI64_LEN]; 470146729Ssam * u_char firewire_shost[FIREWIRE_EUI64_LEN]; 471146729Ssam * u_short firewire_type; 472146729Ssam * }; 473146729Ssam * 474146729Ssam * with "firewire_type" being an Ethernet type value, rather than, 475146729Ssam * for example, raw GASP frames being handed up. 476127673Sbms */ 477127673Sbms#define DLT_APPLE_IP_OVER_IEEE1394 138 478127673Sbms 479127673Sbms/* 480147893Ssam * Various SS7 encapsulations, as per a request from Jeff Morriss 481147893Ssam * <jeff.morriss[AT]ulticom.com> and subsequent discussions. 482146729Ssam */ 483147893Ssam#define DLT_MTP2_WITH_PHDR 139 /* pseudo-header with various info, followed by MTP2 */ 484147893Ssam#define DLT_MTP2 140 /* MTP2, without pseudo-header */ 485147893Ssam#define DLT_MTP3 141 /* MTP3, without pseudo-header or MTP2 */ 486147893Ssam#define DLT_SCCP 142 /* SCCP, without pseudo-header or MTP2 or MTP3 */ 487146729Ssam 488146729Ssam/* 489127674Sbms * Reserved for DOCSIS. 490127674Sbms */ 491127674Sbms#define DLT_DOCSIS 143 492127674Sbms 493127674Sbms/* 494127673Sbms * Reserved for Linux IrDA. 495127673Sbms */ 496127673Sbms#define DLT_LINUX_IRDA 144 497127673Sbms 498127673Sbms/* 499127674Sbms * Reserved for IBM SP switch and IBM Next Federation switch. 500127674Sbms */ 501127674Sbms#define DLT_IBM_SP 145 502127674Sbms#define DLT_IBM_SN 146 503127674Sbms 504127674Sbms/* 505146729Ssam * Reserved for private use. If you have some link-layer header type 506146729Ssam * that you want to use within your organization, with the capture files 507146729Ssam * using that link-layer header type not ever be sent outside your 508146729Ssam * organization, you can use these values. 509146729Ssam * 510146729Ssam * No libpcap release will use these for any purpose, nor will any 511146729Ssam * tcpdump release use them, either. 512146729Ssam * 513146729Ssam * Do *NOT* use these in capture files that you expect anybody not using 514146729Ssam * your private versions of capture-file-reading tools to read; in 515146729Ssam * particular, do *NOT* use them in products, otherwise you may find that 516146729Ssam * people won't be able to use tcpdump, or snort, or Ethereal, or... to 517146729Ssam * read capture files from your firewall/intrusion detection/traffic 518146729Ssam * monitoring/etc. appliance, or whatever product uses that DLT_ value, 519146729Ssam * and you may also find that the developers of those applications will 520146729Ssam * not accept patches to let them read those files. 521146729Ssam * 522146729Ssam * Also, do not use them if somebody might send you a capture using them 523146729Ssam * for *their* private type and tools using them for *your* private type 524146729Ssam * would have to read them. 525146729Ssam * 526146729Ssam * Instead, ask "tcpdump-workers@tcpdump.org" for a new DLT_ value, 527146729Ssam * as per the comment above, and use the type you're given. 528127673Sbms */ 529146729Ssam#define DLT_USER0 147 530146729Ssam#define DLT_USER1 148 531146729Ssam#define DLT_USER2 149 532146729Ssam#define DLT_USER3 150 533146729Ssam#define DLT_USER4 151 534146729Ssam#define DLT_USER5 152 535146729Ssam#define DLT_USER6 153 536146729Ssam#define DLT_USER7 154 537146729Ssam#define DLT_USER8 155 538146729Ssam#define DLT_USER9 156 539146729Ssam#define DLT_USER10 157 540146729Ssam#define DLT_USER11 158 541146729Ssam#define DLT_USER12 159 542146729Ssam#define DLT_USER13 160 543146729Ssam#define DLT_USER14 161 544146729Ssam#define DLT_USER15 162 545127673Sbms 546127673Sbms/* 547146729Ssam * For future use with 802.11 captures - defined by AbsoluteValue 548146729Ssam * Systems to store a number of bits of link-layer information 549146729Ssam * including radio information: 550146729Ssam * 551146729Ssam * http://www.shaftnet.org/~pizza/software/capturefrm.txt 552146729Ssam * 553146729Ssam * but it might be used by some non-AVS drivers now or in the 554146729Ssam * future. 555127674Sbms */ 556146729Ssam#define DLT_IEEE802_11_RADIO_AVS 163 /* 802.11 plus AVS radio header */ 557127674Sbms 558127674Sbms/* 559146729Ssam * Juniper-private data link type, as per request from 560146729Ssam * Hannes Gredler <hannes@juniper.net>. The DLT_s are used 561146729Ssam * for passing on chassis-internal metainformation such as 562146729Ssam * QOS profiles, etc.. 563146729Ssam */ 564146729Ssam#define DLT_JUNIPER_MONITOR 164 565146729Ssam 566146729Ssam/* 567146729Ssam * Reserved for BACnet MS/TP. 568146729Ssam */ 569146729Ssam#define DLT_BACNET_MS_TP 165 570146729Ssam 571146729Ssam/* 572146729Ssam * Another PPP variant as per request from Karsten Keil <kkeil@suse.de>. 573146729Ssam * 574146729Ssam * This is used in some OSes to allow a kernel socket filter to distinguish 575146729Ssam * between incoming and outgoing packets, on a socket intended to 576146729Ssam * supply pppd with outgoing packets so it can do dial-on-demand and 577146729Ssam * hangup-on-lack-of-demand; incoming packets are filtered out so they 578146729Ssam * don't cause pppd to hold the connection up (you don't want random 579146729Ssam * input packets such as port scans, packets from old lost connections, 580146729Ssam * etc. to force the connection to stay up). 581146729Ssam * 582146729Ssam * The first byte of the PPP header (0xff03) is modified to accomodate 583146729Ssam * the direction - 0x00 = IN, 0x01 = OUT. 584146729Ssam */ 585146729Ssam#define DLT_PPP_PPPD 166 586146729Ssam 587146729Ssam/* 588146729Ssam * Names for backwards compatibility with older versions of some PPP 589146729Ssam * software; new software should use DLT_PPP_PPPD. 590146729Ssam */ 591146729Ssam#define DLT_PPP_WITH_DIRECTION DLT_PPP_PPPD 592146729Ssam#define DLT_LINUX_PPP_WITHDIRECTION DLT_PPP_PPPD 593146729Ssam 594146729Ssam/* 595146729Ssam * Juniper-private data link type, as per request from 596146729Ssam * Hannes Gredler <hannes@juniper.net>. The DLT_s are used 597146729Ssam * for passing on chassis-internal metainformation such as 598146729Ssam * QOS profiles, cookies, etc.. 599146729Ssam */ 600146729Ssam#define DLT_JUNIPER_PPPOE 167 601146729Ssam#define DLT_JUNIPER_PPPOE_ATM 168 602146729Ssam 603146729Ssam#define DLT_GPRS_LLC 169 /* GPRS LLC */ 604146729Ssam#define DLT_GPF_T 170 /* GPF-T (ITU-T G.7041/Y.1303) */ 605146729Ssam#define DLT_GPF_F 171 /* GPF-F (ITU-T G.7041/Y.1303) */ 606146729Ssam 607146729Ssam/* 608146729Ssam * Requested by Oolan Zimmer <oz@gcom.com> for use in Gcom's T1/E1 line 609146729Ssam * monitoring equipment. 610146729Ssam */ 611146729Ssam#define DLT_GCOM_T1E1 172 612146729Ssam#define DLT_GCOM_SERIAL 173 613146729Ssam 614146729Ssam/* 615146729Ssam * Juniper-private data link type, as per request from 616146729Ssam * Hannes Gredler <hannes@juniper.net>. The DLT_ is used 617146729Ssam * for internal communication to Physical Interface Cards (PIC) 618146729Ssam */ 619146729Ssam#define DLT_JUNIPER_PIC_PEER 174 620146729Ssam 621146729Ssam/* 622146729Ssam * Link types requested by Gregor Maier <gregor@endace.com> of Endace 623146729Ssam * Measurement Systems. They add an ERF header (see 624146729Ssam * http://www.endace.com/support/EndaceRecordFormat.pdf) in front of 625146729Ssam * the link-layer header. 626146729Ssam */ 627146729Ssam#define DLT_ERF_ETH 175 /* Ethernet */ 628146729Ssam#define DLT_ERF_POS 176 /* Packet-over-SONET */ 629146729Ssam 630146729Ssam/* 631147893Ssam * Requested by Daniele Orlandi <daniele@orlandi.com> for raw LAPD 632147893Ssam * for vISDN (http://www.orlandi.com/visdn/). Its link-layer header 633147893Ssam * includes additional information before the LAPD header, so it's 634147893Ssam * not necessarily a generic LAPD header. 635147893Ssam */ 636147893Ssam#define DLT_LINUX_LAPD 177 637147893Ssam 638147893Ssam/* 639162010Ssam * Juniper-private data link type, as per request from 640174876Srwatson * Hannes Gredler <hannes@juniper.net>. 641162010Ssam * The DLT_ are used for prepending meta-information 642162010Ssam * like interface index, interface name 643162010Ssam * before standard Ethernet, PPP, Frelay & C-HDLC Frames 644162010Ssam */ 645162010Ssam#define DLT_JUNIPER_ETHER 178 646162010Ssam#define DLT_JUNIPER_PPP 179 647162010Ssam#define DLT_JUNIPER_FRELAY 180 648162010Ssam#define DLT_JUNIPER_CHDLC 181 649162010Ssam 650162010Ssam/* 651172851Smlaier * Multi Link Frame Relay (FRF.16) 652172851Smlaier */ 653172851Smlaier#define DLT_MFR 182 654172851Smlaier 655172851Smlaier/* 656172851Smlaier * Juniper-private data link type, as per request from 657174876Srwatson * Hannes Gredler <hannes@juniper.net>. 658172851Smlaier * The DLT_ is used for internal communication with a 659172851Smlaier * voice Adapter Card (PIC) 660172851Smlaier */ 661172851Smlaier#define DLT_JUNIPER_VP 183 662172851Smlaier 663172851Smlaier/* 664172851Smlaier * Arinc 429 frames. 665172851Smlaier * DLT_ requested by Gianluca Varenni <gianluca.varenni@cacetech.com>. 666172851Smlaier * Every frame contains a 32bit A429 label. 667172851Smlaier * More documentation on Arinc 429 can be found at 668172851Smlaier * http://www.condoreng.com/support/downloads/tutorials/ARINCTutorial.pdf 669172851Smlaier */ 670172851Smlaier#define DLT_A429 184 671172851Smlaier 672172851Smlaier/* 673172851Smlaier * Arinc 653 Interpartition Communication messages. 674172851Smlaier * DLT_ requested by Gianluca Varenni <gianluca.varenni@cacetech.com>. 675172851Smlaier * Please refer to the A653-1 standard for more information. 676172851Smlaier */ 677172851Smlaier#define DLT_A653_ICM 185 678172851Smlaier 679172851Smlaier/* 680172851Smlaier * USB packets, beginning with a USB setup header; requested by 681172851Smlaier * Paolo Abeni <paolo.abeni@email.it>. 682172851Smlaier */ 683172851Smlaier#define DLT_USB 186 684172851Smlaier 685172851Smlaier/* 686172851Smlaier * Bluetooth HCI UART transport layer (part H:4); requested by 687172851Smlaier * Paolo Abeni. 688172851Smlaier */ 689172851Smlaier#define DLT_BLUETOOTH_HCI_H4 187 690172851Smlaier 691172851Smlaier/* 692172851Smlaier * IEEE 802.16 MAC Common Part Sublayer; requested by Maria Cruz 693172851Smlaier * <cruz_petagay@bah.com>. 694172851Smlaier */ 695172851Smlaier#define DLT_IEEE802_16_MAC_CPS 188 696172851Smlaier 697172851Smlaier/* 698172851Smlaier * USB packets, beginning with a Linux USB header; requested by 699172851Smlaier * Paolo Abeni <paolo.abeni@email.it>. 700172851Smlaier */ 701172851Smlaier#define DLT_USB_LINUX 189 702172851Smlaier 703172851Smlaier/* 704172851Smlaier * Controller Area Network (CAN) v. 2.0B packets. 705172851Smlaier * DLT_ requested by Gianluca Varenni <gianluca.varenni@cacetech.com>. 706172851Smlaier * Used to dump CAN packets coming from a CAN Vector board. 707172851Smlaier * More documentation on the CAN v2.0B frames can be found at 708172851Smlaier * http://www.can-cia.org/downloads/?269 709172851Smlaier */ 710172851Smlaier#define DLT_CAN20B 190 711172851Smlaier 712172851Smlaier/* 713172851Smlaier * IEEE 802.15.4, with address fields padded, as is done by Linux 714172851Smlaier * drivers; requested by Juergen Schimmer. 715172851Smlaier */ 716172851Smlaier#define DLT_IEEE802_15_4_LINUX 191 717172851Smlaier 718172851Smlaier/* 719172851Smlaier * Per Packet Information encapsulated packets. 720172851Smlaier * DLT_ requested by Gianluca Varenni <gianluca.varenni@cacetech.com>. 721172851Smlaier */ 722172851Smlaier#define DLT_PPI 192 723172851Smlaier 724172851Smlaier/* 725172851Smlaier * Header for 802.16 MAC Common Part Sublayer plus a radiotap radio header; 726172851Smlaier * requested by Charles Clancy. 727172851Smlaier */ 728172851Smlaier#define DLT_IEEE802_16_MAC_CPS_RADIO 193 729172851Smlaier 730172851Smlaier/* 731172851Smlaier * Juniper-private data link type, as per request from 732174876Srwatson * Hannes Gredler <hannes@juniper.net>. 733172851Smlaier * The DLT_ is used for internal communication with a 734172851Smlaier * integrated service module (ISM). 735172851Smlaier */ 736172851Smlaier#define DLT_JUNIPER_ISM 194 737172851Smlaier 738172851Smlaier/* 739172851Smlaier * IEEE 802.15.4, exactly as it appears in the spec (no padding, no 740172851Smlaier * nothing); requested by Mikko Saarnivala <mikko.saarnivala@sensinode.com>. 741172851Smlaier */ 742172851Smlaier#define DLT_IEEE802_15_4 195 743172851Smlaier 744172851Smlaier/* 745172851Smlaier * Various link-layer types, with a pseudo-header, for SITA 746172851Smlaier * (http://www.sita.aero/); requested by Fulko Hew (fulko.hew@gmail.com). 747172851Smlaier */ 748172851Smlaier#define DLT_SITA 196 749172851Smlaier 750172851Smlaier/* 751172851Smlaier * Various link-layer types, with a pseudo-header, for Endace DAG cards; 752172851Smlaier * encapsulates Endace ERF records. Requested by Stephen Donnelly 753172851Smlaier * <stephen@endace.com>. 754172851Smlaier */ 755172851Smlaier#define DLT_ERF 197 756172851Smlaier 757172851Smlaier/* 758172851Smlaier * Special header prepended to Ethernet packets when capturing from a 759172851Smlaier * u10 Networks board. Requested by Phil Mulholland 760172851Smlaier * <phil@u10networks.com>. 761172851Smlaier */ 762172851Smlaier#define DLT_RAIF1 198 763172851Smlaier 764172851Smlaier/* 765172851Smlaier * IPMB packet for IPMI, beginning with the I2C slave address, followed 766172851Smlaier * by the netFn and LUN, etc.. Requested by Chanthy Toeung 767172851Smlaier * <chanthy.toeung@ca.kontron.com>. 768172851Smlaier */ 769172851Smlaier#define DLT_IPMB 199 770172851Smlaier 771172851Smlaier/* 772172851Smlaier * Juniper-private data link type, as per request from 773174876Srwatson * Hannes Gredler <hannes@juniper.net>. 774172851Smlaier * The DLT_ is used for capturing data on a secure tunnel interface. 775172851Smlaier */ 776172851Smlaier#define DLT_JUNIPER_ST 200 777172851Smlaier 778172851Smlaier/* 779172851Smlaier * Bluetooth HCI UART transport layer (part H:4), with pseudo-header 780172851Smlaier * that includes direction information; requested by Paolo Abeni. 781172851Smlaier */ 782172851Smlaier#define DLT_BLUETOOTH_HCI_H4_WITH_PHDR 201 783172851Smlaier 784172851Smlaier/* 785190639Srpaulo * AX.25 packet with a 1-byte KISS header; see 786190639Srpaulo * 787190639Srpaulo * http://www.ax25.net/kiss.htm 788190639Srpaulo * 789190639Srpaulo * as per Richard Stearn <richard@rns-stearn.demon.co.uk>. 790190639Srpaulo */ 791190639Srpaulo#define DLT_AX25_KISS 202 792190639Srpaulo 793190639Srpaulo/* 794190639Srpaulo * LAPD packets from an ISDN channel, starting with the address field, 795190639Srpaulo * with no pseudo-header. 796190639Srpaulo * Requested by Varuna De Silva <varunax@gmail.com>. 797190639Srpaulo */ 798190639Srpaulo#define DLT_LAPD 203 799190639Srpaulo 800190639Srpaulo/* 801190639Srpaulo * Variants of various link-layer headers, with a one-byte direction 802190639Srpaulo * pseudo-header prepended - zero means "received by this host", 803190639Srpaulo * non-zero (any non-zero value) means "sent by this host" - as per 804190639Srpaulo * Will Barker <w.barker@zen.co.uk>. 805190639Srpaulo */ 806190639Srpaulo#define DLT_PPP_WITH_DIR 204 /* PPP - don't confuse with DLT_PPP_WITH_DIRECTION */ 807190639Srpaulo#define DLT_C_HDLC_WITH_DIR 205 /* Cisco HDLC */ 808190639Srpaulo#define DLT_FRELAY_WITH_DIR 206 /* Frame Relay */ 809190639Srpaulo#define DLT_LAPB_WITH_DIR 207 /* LAPB */ 810190639Srpaulo 811190639Srpaulo/* 812190639Srpaulo * 208 is reserved for an as-yet-unspecified proprietary link-layer 813190639Srpaulo * type, as requested by Will Barker. 814190639Srpaulo */ 815190639Srpaulo 816190639Srpaulo/* 817190639Srpaulo * IPMB with a Linux-specific pseudo-header; as requested by Alexey Neyman 818190639Srpaulo * <avn@pigeonpoint.com>. 819190639Srpaulo */ 820190639Srpaulo#define DLT_IPMB_LINUX 209 821190639Srpaulo 822190639Srpaulo/* 823190639Srpaulo * FlexRay automotive bus - http://www.flexray.com/ - as requested 824190639Srpaulo * by Hannes Kaelber <hannes.kaelber@x2e.de>. 825190639Srpaulo */ 826190639Srpaulo#define DLT_FLEXRAY 210 827190639Srpaulo 828190639Srpaulo/* 829190639Srpaulo * Media Oriented Systems Transport (MOST) bus for multimedia 830190639Srpaulo * transport - http://www.mostcooperation.com/ - as requested 831190639Srpaulo * by Hannes Kaelber <hannes.kaelber@x2e.de>. 832190639Srpaulo */ 833190639Srpaulo#define DLT_MOST 211 834190639Srpaulo 835190639Srpaulo/* 836190639Srpaulo * Local Interconnect Network (LIN) bus for vehicle networks - 837190639Srpaulo * http://www.lin-subbus.org/ - as requested by Hannes Kaelber 838190639Srpaulo * <hannes.kaelber@x2e.de>. 839190639Srpaulo */ 840190639Srpaulo#define DLT_LIN 212 841190639Srpaulo 842190639Srpaulo/* 843190639Srpaulo * X2E-private data link type used for serial line capture, 844190639Srpaulo * as requested by Hannes Kaelber <hannes.kaelber@x2e.de>. 845190639Srpaulo */ 846190639Srpaulo#define DLT_X2E_SERIAL 213 847190639Srpaulo 848190639Srpaulo/* 849190639Srpaulo * X2E-private data link type used for the Xoraya data logger 850190639Srpaulo * family, as requested by Hannes Kaelber <hannes.kaelber@x2e.de>. 851190639Srpaulo */ 852190639Srpaulo#define DLT_X2E_XORAYA 214 853190639Srpaulo 854190639Srpaulo/* 855190639Srpaulo * IEEE 802.15.4, exactly as it appears in the spec (no padding, no 856190639Srpaulo * nothing), but with the PHY-level data for non-ASK PHYs (4 octets 857190639Srpaulo * of 0 as preamble, one octet of SFD, one octet of frame length+ 858190639Srpaulo * reserved bit, and then the MAC-layer data, starting with the 859190639Srpaulo * frame control field). 860190639Srpaulo * 861190639Srpaulo * Requested by Max Filippov <jcmvbkbc@gmail.com>. 862190639Srpaulo */ 863190639Srpaulo#define DLT_IEEE802_15_4_NONASK_PHY 215 864190639Srpaulo 865214517Srpaulo/* 866214517Srpaulo * David Gibson <david@gibson.dropbear.id.au> requested this for 867214517Srpaulo * captures from the Linux kernel /dev/input/eventN devices. This 868214517Srpaulo * is used to communicate keystrokes and mouse movements from the 869214517Srpaulo * Linux kernel to display systems, such as Xorg. 870214517Srpaulo */ 871214517Srpaulo#define DLT_LINUX_EVDEV 216 872214517Srpaulo 873190639Srpaulo/* 874214517Srpaulo * GSM Um and Abis interfaces, preceded by a "gsmtap" header. 875214517Srpaulo * 876214517Srpaulo * Requested by Harald Welte <laforge@gnumonks.org>. 877214517Srpaulo */ 878214517Srpaulo#define DLT_GSMTAP_UM 217 879214517Srpaulo#define DLT_GSMTAP_ABIS 218 880214517Srpaulo 881214517Srpaulo/* 882214517Srpaulo * MPLS, with an MPLS label as the link-layer header. 883214517Srpaulo * Requested by Michele Marchetto <michele@openbsd.org> on behalf 884214517Srpaulo * of OpenBSD. 885214517Srpaulo */ 886214517Srpaulo#define DLT_MPLS 219 887214517Srpaulo 888214517Srpaulo/* 889214517Srpaulo * USB packets, beginning with a Linux USB header, with the USB header 890214517Srpaulo * padded to 64 bytes; required for memory-mapped access. 891214517Srpaulo */ 892214517Srpaulo#define DLT_USB_LINUX_MMAPPED 220 893214517Srpaulo 894214517Srpaulo/* 895214517Srpaulo * DECT packets, with a pseudo-header; requested by 896214517Srpaulo * Matthias Wenzel <tcpdump@mazzoo.de>. 897214517Srpaulo */ 898214517Srpaulo#define DLT_DECT 221 899214517Srpaulo/* 900214517Srpaulo * From: "Lidwa, Eric (GSFC-582.0)[SGT INC]" <eric.lidwa-1@nasa.gov> 901214517Srpaulo * Date: Mon, 11 May 2009 11:18:30 -0500 902214517Srpaulo * 903214517Srpaulo * DLT_AOS. We need it for AOS Space Data Link Protocol. 904214517Srpaulo * I have already written dissectors for but need an OK from 905214517Srpaulo * legal before I can submit a patch. 906214517Srpaulo * 907214517Srpaulo */ 908214517Srpaulo#define DLT_AOS 222 909214517Srpaulo 910214517Srpaulo/* 911214517Srpaulo * Wireless HART (Highway Addressable Remote Transducer) 912214517Srpaulo * From the HART Communication Foundation 913214517Srpaulo * IES/PAS 62591 914214517Srpaulo * 915214517Srpaulo * Requested by Sam Roberts <vieuxtech@gmail.com>. 916214517Srpaulo */ 917214517Srpaulo#define DLT_WIHART 223 918214517Srpaulo 919214517Srpaulo/* 920214517Srpaulo * Fibre Channel FC-2 frames, beginning with a Frame_Header. 921214517Srpaulo * Requested by Kahou Lei <kahou82@gmail.com>. 922214517Srpaulo */ 923214517Srpaulo#define DLT_FC_2 224 924214517Srpaulo 925214517Srpaulo/* 926214517Srpaulo * Fibre Channel FC-2 frames, beginning with an encoding of the 927214517Srpaulo * SOF, and ending with an encoding of the EOF. 928214517Srpaulo * 929214517Srpaulo * The encodings represent the frame delimiters as 4-byte sequences 930214517Srpaulo * representing the corresponding ordered sets, with K28.5 931214517Srpaulo * represented as 0xBC, and the D symbols as the corresponding 932214517Srpaulo * byte values; for example, SOFi2, which is K28.5 - D21.5 - D1.2 - D21.2, 933214517Srpaulo * is represented as 0xBC 0xB5 0x55 0x55. 934214517Srpaulo * 935214517Srpaulo * Requested by Kahou Lei <kahou82@gmail.com>. 936214517Srpaulo */ 937214517Srpaulo#define DLT_FC_2_WITH_FRAME_DELIMS 225 938214517Srpaulo/* 939214517Srpaulo * Solaris ipnet pseudo-header; requested by Darren Reed <Darren.Reed@Sun.COM>. 940214517Srpaulo * 941214517Srpaulo * The pseudo-header starts with a one-byte version number; for version 2, 942214517Srpaulo * the pseudo-header is: 943214517Srpaulo * 944214517Srpaulo * struct dl_ipnetinfo { 945214517Srpaulo * u_int8_t dli_version; 946214517Srpaulo * u_int8_t dli_family; 947214517Srpaulo * u_int16_t dli_htype; 948214517Srpaulo * u_int32_t dli_pktlen; 949214517Srpaulo * u_int32_t dli_ifindex; 950214517Srpaulo * u_int32_t dli_grifindex; 951214517Srpaulo * u_int32_t dli_zsrc; 952214517Srpaulo * u_int32_t dli_zdst; 953214517Srpaulo * }; 954214517Srpaulo * 955214517Srpaulo * dli_version is 2 for the current version of the pseudo-header. 956214517Srpaulo * 957214517Srpaulo * dli_family is a Solaris address family value, so it's 2 for IPv4 958214517Srpaulo * and 26 for IPv6. 959214517Srpaulo * 960214517Srpaulo * dli_htype is a "hook type" - 0 for incoming packets, 1 for outgoing 961214517Srpaulo * packets, and 2 for packets arriving from another zone on the same 962214517Srpaulo * machine. 963214517Srpaulo * 964214517Srpaulo * dli_pktlen is the length of the packet data following the pseudo-header 965214517Srpaulo * (so the captured length minus dli_pktlen is the length of the 966214517Srpaulo * pseudo-header, assuming the entire pseudo-header was captured). 967214517Srpaulo * 968214517Srpaulo * dli_ifindex is the interface index of the interface on which the 969214517Srpaulo * packet arrived. 970214517Srpaulo * 971214517Srpaulo * dli_grifindex is the group interface index number (for IPMP interfaces). 972214517Srpaulo * 973214517Srpaulo * dli_zsrc is the zone identifier for the source of the packet. 974214517Srpaulo * 975214517Srpaulo * dli_zdst is the zone identifier for the destination of the packet. 976214517Srpaulo * 977214517Srpaulo * A zone number of 0 is the global zone; a zone number of 0xffffffff 978214517Srpaulo * means that the packet arrived from another host on the network, not 979214517Srpaulo * from another zone on the same machine. 980214517Srpaulo * 981214517Srpaulo * An IPv4 or IPv6 datagram follows the pseudo-header; dli_family indicates 982214517Srpaulo * which of those it is. 983214517Srpaulo */ 984214517Srpaulo#define DLT_IPNET 226 985214517Srpaulo 986214517Srpaulo/* 987214517Srpaulo * CAN (Controller Area Network) frames, with a pseudo-header as supplied 988214517Srpaulo * by Linux SocketCAN. See Documentation/networking/can.txt in the Linux 989214517Srpaulo * source. 990214517Srpaulo * 991214517Srpaulo * Requested by Felix Obenhuber <felix@obenhuber.de>. 992214517Srpaulo */ 993214517Srpaulo#define DLT_CAN_SOCKETCAN 227 994214517Srpaulo 995214517Srpaulo/* 996214517Srpaulo * Raw IPv4/IPv6; different from DLT_RAW in that the DLT_ value specifies 997214517Srpaulo * whether it's v4 or v6. Requested by Darren Reed <Darren.Reed@Sun.COM>. 998214517Srpaulo */ 999235425Sdelphij#define DLT_IPV4 228 1000235425Sdelphij#define DLT_IPV6 229 1001214517Srpaulo 1002214517Srpaulo/* 1003235425Sdelphij * IEEE 802.15.4, exactly as it appears in the spec (no padding, no 1004235425Sdelphij * nothing), and with no FCS at the end of the frame; requested by 1005235425Sdelphij * Jon Smirl <jonsmirl@gmail.com>. 1006235425Sdelphij */ 1007235425Sdelphij#define DLT_IEEE802_15_4_NOFCS 230 1008235425Sdelphij 1009235425Sdelphij/* 1010235425Sdelphij * Raw D-Bus: 1011235425Sdelphij * 1012235425Sdelphij * http://www.freedesktop.org/wiki/Software/dbus 1013235425Sdelphij * 1014235425Sdelphij * messages: 1015235425Sdelphij * 1016235425Sdelphij * http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-messages 1017235425Sdelphij * 1018235425Sdelphij * starting with the endianness flag, followed by the message type, etc., 1019235425Sdelphij * but without the authentication handshake before the message sequence: 1020235425Sdelphij * 1021235425Sdelphij * http://dbus.freedesktop.org/doc/dbus-specification.html#auth-protocol 1022235425Sdelphij * 1023235425Sdelphij * Requested by Martin Vidner <martin@vidner.net>. 1024235425Sdelphij */ 1025235425Sdelphij#define DLT_DBUS 231 1026235425Sdelphij 1027235425Sdelphij/* 1028235425Sdelphij * Juniper-private data link type, as per request from 1029235425Sdelphij * Hannes Gredler <hannes@juniper.net>. 1030235425Sdelphij */ 1031235425Sdelphij#define DLT_JUNIPER_VS 232 1032235425Sdelphij#define DLT_JUNIPER_SRX_E2E 233 1033235425Sdelphij#define DLT_JUNIPER_FIBRECHANNEL 234 1034235425Sdelphij 1035235425Sdelphij/* 1036235425Sdelphij * DVB-CI (DVB Common Interface for communication between a PC Card 1037235425Sdelphij * module and a DVB receiver). See 1038235425Sdelphij * 1039235425Sdelphij * http://www.kaiser.cx/pcap-dvbci.html 1040235425Sdelphij * 1041235425Sdelphij * for the specification. 1042235425Sdelphij * 1043235425Sdelphij * Requested by Martin Kaiser <martin@kaiser.cx>. 1044235425Sdelphij */ 1045235425Sdelphij#define DLT_DVB_CI 235 1046235425Sdelphij 1047235425Sdelphij/* 1048235425Sdelphij * Variant of 3GPP TS 27.010 multiplexing protocol (similar to, but 1049235425Sdelphij * *not* the same as, 27.010). Requested by Hans-Christoph Schemmel 1050235425Sdelphij * <hans-christoph.schemmel@cinterion.com>. 1051235425Sdelphij */ 1052235425Sdelphij#define DLT_MUX27010 236 1053235425Sdelphij 1054235425Sdelphij/* 1055235425Sdelphij * STANAG 5066 D_PDUs. Requested by M. Baris Demiray 1056235425Sdelphij * <barisdemiray@gmail.com>. 1057235425Sdelphij */ 1058235425Sdelphij#define DLT_STANAG_5066_D_PDU 237 1059235425Sdelphij 1060235425Sdelphij/* 1061235425Sdelphij * Juniper-private data link type, as per request from 1062235425Sdelphij * Hannes Gredler <hannes@juniper.net>. 1063235425Sdelphij */ 1064235425Sdelphij#define DLT_JUNIPER_ATM_CEMIC 238 1065235425Sdelphij 1066235425Sdelphij/* 1067235425Sdelphij * NetFilter LOG messages 1068235425Sdelphij * (payload of netlink NFNL_SUBSYS_ULOG/NFULNL_MSG_PACKET packets) 1069235425Sdelphij * 1070235425Sdelphij * Requested by Jakub Zawadzki <darkjames-ws@darkjames.pl> 1071235425Sdelphij */ 1072235425Sdelphij#define DLT_NFLOG 239 1073235425Sdelphij 1074235425Sdelphij/* 1075235425Sdelphij * Hilscher Gesellschaft fuer Systemautomation mbH link-layer type 1076235425Sdelphij * for Ethernet packets with a 4-byte pseudo-header and always 1077235425Sdelphij * with the payload including the FCS, as supplied by their 1078235425Sdelphij * netANALYZER hardware and software. 1079235425Sdelphij * 1080235425Sdelphij * Requested by Holger P. Frommer <HPfrommer@hilscher.com> 1081235425Sdelphij */ 1082235425Sdelphij#define DLT_NETANALYZER 240 1083235425Sdelphij 1084235425Sdelphij/* 1085235425Sdelphij * Hilscher Gesellschaft fuer Systemautomation mbH link-layer type 1086235425Sdelphij * for Ethernet packets with a 4-byte pseudo-header and FCS and 1087235425Sdelphij * with the Ethernet header preceded by 7 bytes of preamble and 1088235425Sdelphij * 1 byte of SFD, as supplied by their netANALYZER hardware and 1089235425Sdelphij * software. 1090235425Sdelphij * 1091235425Sdelphij * Requested by Holger P. Frommer <HPfrommer@hilscher.com> 1092235425Sdelphij */ 1093235425Sdelphij#define DLT_NETANALYZER_TRANSPARENT 241 1094235425Sdelphij 1095235425Sdelphij/* 1096235425Sdelphij * IP-over-Infiniband, as specified by RFC 4391. 1097235425Sdelphij * 1098235425Sdelphij * Requested by Petr Sumbera <petr.sumbera@oracle.com>. 1099235425Sdelphij */ 1100235425Sdelphij#define DLT_IPOIB 242 1101235425Sdelphij 1102241231Sdelphij/* 1103241231Sdelphij * MPEG-2 transport stream (ISO 13818-1/ITU-T H.222.0). 1104241231Sdelphij * 1105241231Sdelphij * Requested by Guy Martin <gmsoft@tuxicoman.be>. 1106241231Sdelphij */ 1107241231Sdelphij#define DLT_MPEG_2_TS 243 1108235425Sdelphij 1109235425Sdelphij/* 1110241231Sdelphij * ng4T GmbH's UMTS Iub/Iur-over-ATM and Iub/Iur-over-IP format as 1111241231Sdelphij * used by their ng40 protocol tester. 1112241231Sdelphij * 1113241231Sdelphij * Requested by Jens Grimmer <jens.grimmer@ng4t.com>. 1114241231Sdelphij */ 1115241231Sdelphij#define DLT_NG40 244 1116241231Sdelphij 1117241231Sdelphij/* 1118241231Sdelphij * Pseudo-header giving adapter number and flags, followed by an NFC 1119241231Sdelphij * (Near-Field Communications) Logical Link Control Protocol (LLCP) PDU, 1120241231Sdelphij * as specified by NFC Forum Logical Link Control Protocol Technical 1121241231Sdelphij * Specification LLCP 1.1. 1122241231Sdelphij * 1123241231Sdelphij * Requested by Mike Wakerly <mikey@google.com>. 1124241231Sdelphij */ 1125241231Sdelphij#define DLT_NFC_LLCP 245 1126241231Sdelphij 1127241231Sdelphij/* 1128241231Sdelphij * 245 is used as LINKTYPE_PFSYNC; do not use it for any other purpose. 1129241231Sdelphij * 1130241231Sdelphij * DLT_PFSYNC has different values on different platforms, and all of 1131241231Sdelphij * them collide with something used elsewhere. On platforms that 1132241231Sdelphij * don't already define it, define it as 245. 1133241231Sdelphij */ 1134241231Sdelphij#if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__DragonFly__) && !defined(__APPLE__) 1135241231Sdelphij#define DLT_PFSYNC 246 1136241231Sdelphij#endif 1137241231Sdelphij 1138241231Sdelphij#define DLT_MATCHING_MAX 246 /* highest value in the "matching" range */ 1139241231Sdelphij 1140241231Sdelphij/* 1141190639Srpaulo * DLT and savefile link type values are split into a class and 1142190639Srpaulo * a member of that class. A class value of 0 indicates a regular 1143190639Srpaulo * DLT_/LINKTYPE_ value. 1144190639Srpaulo */ 1145190639Srpaulo#define DLT_CLASS(x) ((x) & 0x03ff0000) 1146190639Srpaulo 1147190639Srpaulo/* 114813765Smpp * The instruction encodings. 11491541Srgrimes */ 11501541Srgrimes/* instruction classes */ 11511541Srgrimes#define BPF_CLASS(code) ((code) & 0x07) 11521541Srgrimes#define BPF_LD 0x00 11531541Srgrimes#define BPF_LDX 0x01 11541541Srgrimes#define BPF_ST 0x02 11551541Srgrimes#define BPF_STX 0x03 11561541Srgrimes#define BPF_ALU 0x04 11571541Srgrimes#define BPF_JMP 0x05 11581541Srgrimes#define BPF_RET 0x06 11591541Srgrimes#define BPF_MISC 0x07 11601541Srgrimes 11611541Srgrimes/* ld/ldx fields */ 11621541Srgrimes#define BPF_SIZE(code) ((code) & 0x18) 11631541Srgrimes#define BPF_W 0x00 11641541Srgrimes#define BPF_H 0x08 11651541Srgrimes#define BPF_B 0x10 11661541Srgrimes#define BPF_MODE(code) ((code) & 0xe0) 11671541Srgrimes#define BPF_IMM 0x00 11681541Srgrimes#define BPF_ABS 0x20 11691541Srgrimes#define BPF_IND 0x40 11701541Srgrimes#define BPF_MEM 0x60 11711541Srgrimes#define BPF_LEN 0x80 11721541Srgrimes#define BPF_MSH 0xa0 11731541Srgrimes 11741541Srgrimes/* alu/jmp fields */ 11751541Srgrimes#define BPF_OP(code) ((code) & 0xf0) 11761541Srgrimes#define BPF_ADD 0x00 11771541Srgrimes#define BPF_SUB 0x10 11781541Srgrimes#define BPF_MUL 0x20 11791541Srgrimes#define BPF_DIV 0x30 11801541Srgrimes#define BPF_OR 0x40 11811541Srgrimes#define BPF_AND 0x50 11821541Srgrimes#define BPF_LSH 0x60 11831541Srgrimes#define BPF_RSH 0x70 11841541Srgrimes#define BPF_NEG 0x80 11851541Srgrimes#define BPF_JA 0x00 11861541Srgrimes#define BPF_JEQ 0x10 11871541Srgrimes#define BPF_JGT 0x20 11881541Srgrimes#define BPF_JGE 0x30 11891541Srgrimes#define BPF_JSET 0x40 11901541Srgrimes#define BPF_SRC(code) ((code) & 0x08) 11911541Srgrimes#define BPF_K 0x00 11921541Srgrimes#define BPF_X 0x08 11931541Srgrimes 11941541Srgrimes/* ret - BPF_K and BPF_X also apply */ 11951541Srgrimes#define BPF_RVAL(code) ((code) & 0x18) 11961541Srgrimes#define BPF_A 0x10 11971541Srgrimes 11981541Srgrimes/* misc */ 11991541Srgrimes#define BPF_MISCOP(code) ((code) & 0xf8) 12001541Srgrimes#define BPF_TAX 0x00 12011541Srgrimes#define BPF_TXA 0x80 12021541Srgrimes 12031541Srgrimes/* 12041541Srgrimes * The instruction data structure. 12051541Srgrimes */ 12061541Srgrimesstruct bpf_insn { 120717679Spst u_short code; 120817679Spst u_char jt; 120917679Spst u_char jf; 121017679Spst bpf_u_int32 k; 12111541Srgrimes}; 12121541Srgrimes 12131541Srgrimes/* 12141541Srgrimes * Macros for insn array initializers. 12151541Srgrimes */ 12161541Srgrimes#define BPF_STMT(code, k) { (u_short)(code), 0, 0, k } 12171541Srgrimes#define BPF_JUMP(code, k, jt, jf) { (u_short)(code), jt, jf, k } 12181541Srgrimes 1219109580Ssam/* 1220109580Ssam * Structure to retrieve available DLTs for the interface. 1221109580Ssam */ 1222109580Ssamstruct bpf_dltlist { 1223109580Ssam u_int bfl_len; /* number of bfd_list array */ 1224109580Ssam u_int *bfl_list; /* array of DLTs */ 1225109580Ssam}; 1226109580Ssam 122755205Speter#ifdef _KERNEL 1228177548Scsjp#ifdef MALLOC_DECLARE 1229177548ScsjpMALLOC_DECLARE(M_BPF); 1230177548Scsjp#endif 1231177548Scsjp#ifdef SYSCTL_DECL 1232177548ScsjpSYSCTL_DECL(_net_bpf); 1233177548Scsjp#endif 1234177548Scsjp 1235159180Scsjp/* 1236177548Scsjp * Rotate the packet buffers in descriptor d. Move the store buffer into the 1237177548Scsjp * hold slot, and the free buffer ino the store slot. Zero the length of the 1238244090Sghelmer * new store buffer. Descriptor lock should be held. Hold buffer must 1239244090Sghelmer * not be marked "in use". 1240177548Scsjp */ 1241177548Scsjp#define ROTATE_BUFFERS(d) do { \ 1242177548Scsjp (d)->bd_hbuf = (d)->bd_sbuf; \ 1243177548Scsjp (d)->bd_hlen = (d)->bd_slen; \ 1244177548Scsjp (d)->bd_sbuf = (d)->bd_fbuf; \ 1245177548Scsjp (d)->bd_slen = 0; \ 1246177548Scsjp (d)->bd_fbuf = NULL; \ 1247177548Scsjp bpf_bufheld(d); \ 1248177548Scsjp} while (0) 1249177548Scsjp 1250177548Scsjp/* 1251159180Scsjp * Descriptor associated with each attached hardware interface. 1252233937Smelifaro * FIXME: this structure is exposed to external callers to speed up 1253233937Smelifaro * bpf_peers_present() call. However we cover all fields not needed by 1254233937Smelifaro * this function via BPF_INTERNAL define 1255159180Scsjp */ 1256159180Scsjpstruct bpf_if { 1257159180Scsjp LIST_ENTRY(bpf_if) bif_next; /* list of all interfaces */ 1258159180Scsjp LIST_HEAD(, bpf_d) bif_dlist; /* descriptor list */ 1259233937Smelifaro#ifdef BPF_INTERNAL 1260159180Scsjp u_int bif_dlt; /* link layer type */ 1261209216Sjkim u_int bif_hdrlen; /* length of link header */ 1262159180Scsjp struct ifnet *bif_ifp; /* corresponding interface */ 1263233937Smelifaro struct rwlock bif_lock; /* interface lock */ 1264233938Smelifaro LIST_HEAD(, bpf_d) bif_wlist; /* writer-only list */ 1265235745Smelifaro int flags; /* Interface flags */ 1266233937Smelifaro#endif 1267159180Scsjp}; 1268159180Scsjp 1269177548Scsjpvoid bpf_bufheld(struct bpf_d *d); 127092725Salfredint bpf_validate(const struct bpf_insn *, int); 1271106927Ssamvoid bpf_tap(struct bpf_if *, u_char *, u_int); 1272106927Ssamvoid bpf_mtap(struct bpf_if *, struct mbuf *); 1273123922Ssamvoid bpf_mtap2(struct bpf_if *, void *, u_int, struct mbuf *); 127492725Salfredvoid bpfattach(struct ifnet *, u_int, u_int); 1275106927Ssamvoid bpfattach2(struct ifnet *, u_int, u_int, struct bpf_if **); 127692725Salfredvoid bpfdetach(struct ifnet *); 127758273Srwatson 127892725Salfredvoid bpfilterattach(int); 1279182197Sjkimu_int bpf_filter(const struct bpf_insn *, u_char *, u_int, u_int); 1280106927Ssam 1281159180Scsjpstatic __inline int 1282159180Scsjpbpf_peers_present(struct bpf_if *bpf) 1283159180Scsjp{ 1284159180Scsjp 1285159595Scsjp if (!LIST_EMPTY(&bpf->bif_dlist)) 1286159193Scsjp return (1); 1287159186Scsjp return (0); 1288159180Scsjp} 1289159180Scsjp 1290106927Ssam#define BPF_TAP(_ifp,_pkt,_pktlen) do { \ 1291159180Scsjp if (bpf_peers_present((_ifp)->if_bpf)) \ 1292106927Ssam bpf_tap((_ifp)->if_bpf, (_pkt), (_pktlen)); \ 1293106927Ssam} while (0) 1294106927Ssam#define BPF_MTAP(_ifp,_m) do { \ 1295159180Scsjp if (bpf_peers_present((_ifp)->if_bpf)) { \ 1296123922Ssam M_ASSERTVALID(_m); \ 1297106927Ssam bpf_mtap((_ifp)->if_bpf, (_m)); \ 1298123922Ssam } \ 1299106927Ssam} while (0) 1300123922Ssam#define BPF_MTAP2(_ifp,_data,_dlen,_m) do { \ 1301159180Scsjp if (bpf_peers_present((_ifp)->if_bpf)) { \ 1302123922Ssam M_ASSERTVALID(_m); \ 1303123922Ssam bpf_mtap2((_ifp)->if_bpf,(_data),(_dlen),(_m)); \ 1304123922Ssam } \ 1305123922Ssam} while (0) 13061541Srgrimes#endif 13071541Srgrimes 13081541Srgrimes/* 13091541Srgrimes * Number of scratch memory words (for BPF_LD|BPF_MEM and BPF_ST). 13101541Srgrimes */ 13111541Srgrimes#define BPF_MEMWORDS 16 13121541Srgrimes 1313106927Ssam#endif /* _NET_BPF_H_ */ 1314