📄 bpf.h
字号:
* No libpcap release will use these for any purpose, nor will any * tcpdump release use them, either. * * Do *NOT* use these in capture files that you expect anybody not using * your private versions of capture-file-reading tools to read; in * particular, do *NOT* use them in products, otherwise you may find that * people won't be able to use tcpdump, or snort, or Ethereal, or... to * read capture files from your firewall/intrusion detection/traffic * monitoring/etc. appliance, or whatever product uses that DLT_ value, * and you may also find that the developers of those applications will * not accept patches to let them read those files. * * Also, do not use them if somebody might send you a capture using them * for *their* private type and tools using them for *your* private type * would have to read them. * * Instead, ask "tcpdump-workers@lists.tcpdump.org" for a new DLT_ value, * as per the comment above, and use the type you're given. */#define DLT_USER0 147#define DLT_USER1 148#define DLT_USER2 149#define DLT_USER3 150#define DLT_USER4 151#define DLT_USER5 152#define DLT_USER6 153#define DLT_USER7 154#define DLT_USER8 155#define DLT_USER9 156#define DLT_USER10 157#define DLT_USER11 158#define DLT_USER12 159#define DLT_USER13 160#define DLT_USER14 161#define DLT_USER15 162/* * For future use with 802.11 captures - defined by AbsoluteValue * Systems to store a number of bits of link-layer information * including radio information: * * http://www.shaftnet.org/~pizza/software/capturefrm.txt * * but it might be used by some non-AVS drivers now or in the * future. */#define DLT_IEEE802_11_RADIO_AVS 163 /* 802.11 plus AVS radio header *//* * Juniper-private data link type, as per request from * Hannes Gredler <hannes@juniper.net>. The DLT_s are used * for passing on chassis-internal metainformation such as * QOS profiles, etc.. */#define DLT_JUNIPER_MONITOR 164/* * Reserved for BACnet MS/TP. */#define DLT_BACNET_MS_TP 165/* * Another PPP variant as per request from Karsten Keil <kkeil@suse.de>. * * This is used in some OSes to allow a kernel socket filter to distinguish * between incoming and outgoing packets, on a socket intended to * supply pppd with outgoing packets so it can do dial-on-demand and * hangup-on-lack-of-demand; incoming packets are filtered out so they * don't cause pppd to hold the connection up (you don't want random * input packets such as port scans, packets from old lost connections, * etc. to force the connection to stay up). * * The first byte of the PPP header (0xff03) is modified to accomodate * the direction - 0x00 = IN, 0x01 = OUT. */#define DLT_PPP_PPPD 166/* * Names for backwards compatibility with older versions of some PPP * software; new software should use DLT_PPP_PPPD. */#define DLT_PPP_WITH_DIRECTION DLT_PPP_PPPD#define DLT_LINUX_PPP_WITHDIRECTION DLT_PPP_PPPD/* * Juniper-private data link type, as per request from * Hannes Gredler <hannes@juniper.net>. The DLT_s are used * for passing on chassis-internal metainformation such as * QOS profiles, cookies, etc.. */#define DLT_JUNIPER_PPPOE 167#define DLT_JUNIPER_PPPOE_ATM 168#define DLT_GPRS_LLC 169 /* GPRS LLC */#define DLT_GPF_T 170 /* GPF-T (ITU-T G.7041/Y.1303) */#define DLT_GPF_F 171 /* GPF-F (ITU-T G.7041/Y.1303) *//* * Requested by Oolan Zimmer <oz@gcom.com> for use in Gcom's T1/E1 line * monitoring equipment. */#define DLT_GCOM_T1E1 172#define DLT_GCOM_SERIAL 173/* * Juniper-private data link type, as per request from * Hannes Gredler <hannes@juniper.net>. The DLT_ is used * for internal communication to Physical Interface Cards (PIC) */#define DLT_JUNIPER_PIC_PEER 174/* * Link types requested by Gregor Maier <gregor@endace.com> of Endace * Measurement Systems. They add an ERF header (see * http://www.endace.com/support/EndaceRecordFormat.pdf) in front of * the link-layer header. */#define DLT_ERF_ETH 175 /* Ethernet */#define DLT_ERF_POS 176 /* Packet-over-SONET *//* * Requested by Daniele Orlandi <daniele@orlandi.com> for raw LAPD * for vISDN (http://www.orlandi.com/visdn/). Its link-layer header * includes additional information before the LAPD header, so it's * not necessarily a generic LAPD header. */#define DLT_LINUX_LAPD 177/* * Juniper-private data link type, as per request from * Hannes Gredler <hannes@juniper.net>. * The DLT_ are used for prepending meta-information * like interface index, interface name * before standard Ethernet, PPP, Frelay & C-HDLC Frames */#define DLT_JUNIPER_ETHER 178#define DLT_JUNIPER_PPP 179#define DLT_JUNIPER_FRELAY 180#define DLT_JUNIPER_CHDLC 181/* * Multi Link Frame Relay (FRF.16) */#define DLT_MFR 182/* * Juniper-private data link type, as per request from * Hannes Gredler <hannes@juniper.net>. * The DLT_ is used for internal communication with a * voice Adapter Card (PIC) */#define DLT_JUNIPER_VP 183/* * Arinc 429 frames. * DLT_ requested by Gianluca Varenni <gianluca.varenni@cacetech.com>. * Every frame contains a 32bit A429 label. * More documentation on Arinc 429 can be found at * http://www.condoreng.com/support/downloads/tutorials/ARINCTutorial.pdf */#define DLT_A429 184/* * Arinc 653 Interpartition Communication messages. * DLT_ requested by Gianluca Varenni <gianluca.varenni@cacetech.com>. * Please refer to the A653-1 standard for more information. */#define DLT_A653_ICM 185/* * USB packets, beginning with a USB setup header; requested by * Paolo Abeni <paolo.abeni@email.it>. */#define DLT_USB 186/* * Bluetooth HCI UART transport layer (part H:4); requested by * Paolo Abeni. */#define DLT_BLUETOOTH_HCI_H4 187/* * IEEE 802.16 MAC Common Part Sublayer; requested by Maria Cruz * <cruz_petagay@bah.com>. */#define DLT_IEEE802_16_MAC_CPS 188/* * USB packets, beginning with a Linux USB header; requested by * Paolo Abeni <paolo.abeni@email.it>. */#define DLT_USB_LINUX 189/* * Controller Area Network (CAN) v. 2.0B packets. * DLT_ requested by Gianluca Varenni <gianluca.varenni@cacetech.com>. * Used to dump CAN packets coming from a CAN Vector board. * More documentation on the CAN v2.0B frames can be found at * http://www.can-cia.org/downloads/?269 */#define DLT_CAN20B 190/* * IEEE 802.15.4, with address fields padded, as is done by Linux * drivers; requested by Juergen Schimmer. */#define DLT_IEEE802_15_4_LINUX 191/* * Per Packet Information encapsulated packets. * DLT_ requested by Gianluca Varenni <gianluca.varenni@cacetech.com>. */#define DLT_PPI 192/* * Header for 802.16 MAC Common Part Sublayer plus a radiotap radio header; * requested by Charles Clancy. */#define DLT_IEEE802_16_MAC_CPS_RADIO 193/* * Juniper-private data link type, as per request from * Hannes Gredler <hannes@juniper.net>. * The DLT_ is used for internal communication with a * integrated service module (ISM). */#define DLT_JUNIPER_ISM 194/* * IEEE 802.15.4, exactly as it appears in the spec (no padding, no * nothing); requested by Mikko Saarnivala <mikko.saarnivala@sensinode.com>. */#define DLT_IEEE802_15_4 195/* * Various link-layer types, with a pseudo-header, for SITA * (http://www.sita.aero/); requested by Fulko Hew (fulko.hew@gmail.com). */#define DLT_SITA 196/* * Various link-layer types, with a pseudo-header, for Endace DAG cards; * encapsulates Endace ERF records. Requested by Stephen Donnelly * <stephen@endace.com>. */#define DLT_ERF 197/* * Special header prepended to Ethernet packets when capturing from a * u10 Networks board. Requested by Phil Mulholland * <phil@u10networks.com>. */#define DLT_RAIF1 198/* * IPMB packet for IPMI, beginning with the I2C slave address, followed * by the netFn and LUN, etc.. Requested by Chanthy Toeung * <chanthy.toeung@ca.kontron.com>. */#define DLT_IPMB 199/* * Juniper-private data link type, as per request from * Hannes Gredler <hannes@juniper.net>. * The DLT_ is used for capturing data on a secure tunnel interface. */#define DLT_JUNIPER_ST 200/* * Bluetooth HCI UART transport layer (part H:4), with pseudo-header * that includes direction information; requested by Paolo Abeni. */#define DLT_BLUETOOTH_HCI_H4_WITH_PHDR 201/* * AX.25 packet with a 1-byte KISS header; see * * http://www.ax25.net/kiss.htm * * as per Richard Stearn <richard@rns-stearn.demon.co.uk>. */#define DLT_AX25_KISS 202/* * LAPD packets from an ISDN channel, starting with the address field, * with no pseudo-header. * Requested by Varuna De Silva <varunax@gmail.com>. */#define DLT_LAPD 203/* * Variants of various link-layer headers, with a one-byte direction * pseudo-header prepended - zero means "received by this host", * non-zero (any non-zero value) means "sent by this host" - as per * Will Barker <w.barker@zen.co.uk>. */#define DLT_PPP_WITH_DIR 204 /* PPP - don't confuse with DLT_PPP_WITH_DIRECTION */#define DLT_C_HDLC_WITH_DIR 205 /* Cisco HDLC */#define DLT_FRELAY_WITH_DIR 206 /* Frame Relay */#define DLT_LAPB_WITH_DIR 207 /* LAPB *//* * 208 is reserved for an as-yet-unspecified proprietary link-layer * type, as requested by Will Barker. *//* * IPMB with a Linux-specific pseudo-header; as requested by Alexey Neyman * <avn@pigeonpoint.com>. */#define DLT_IPMB_LINUX 209/* * FlexRay automotive bus - http://www.flexray.com/ - as requested * by Hannes Kaelber <hannes.kaelber@x2e.de>. */#define DLT_FLEXRAY 210/* * Media Oriented Systems Transport (MOST) bus for multimedia * transport - http://www.mostcooperation.com/ - as requested * by Hannes Kaelber <hannes.kaelber@x2e.de>. */#define DLT_MOST 211/* * Local Interconnect Network (LIN) bus for vehicle networks - * http://www.lin-subbus.org/ - as requested by Hannes Kaelber * <hannes.kaelber@x2e.de>. */#define DLT_LIN 212/* * X2E-private data link type used for serial line capture, * as requested by Hannes Kaelber <hannes.kaelber@x2e.de>. */#define DLT_X2E_SERIAL 213/* * X2E-private data link type used for the Xoraya data logger * family, as requested by Hannes Kaelber <hannes.kaelber@x2e.de>. */#define DLT_X2E_XORAYA 214/* * IEEE 802.15.4, exactly as it appears in the spec (no padding, no * nothing), but with the PHY-level data for non-ASK PHYs (4 octets * of 0 as preamble, one octet of SFD, one octet of frame length+ * reserved bit, and then the MAC-layer data, starting with the * frame control field). * * Requested by Max Filippov <jcmvbkbc@gmail.com>. */#define DLT_IEEE802_15_4_NONASK_PHY 215/* * DLT and savefile link type values are split into a class and * a member of that class. A class value of 0 indicates a regular * DLT_/LINKTYPE_ value. */#define DLT_CLASS(x) ((x) & 0x03ff0000)/* * NetBSD-specific generic "raw" link type. The class value indicates * that this is the generic raw type, and the lower 16 bits are the * address family we're dealing with. Those values are NetBSD-specific; * do not assume that they correspond to AF_ values for your operating * system. */#define DLT_CLASS_NETBSD_RAWAF 0x02240000#define DLT_NETBSD_RAWAF(af) (DLT_CLASS_NETBSD_RAWAF | (af))#define DLT_NETBSD_RAWAF_AF(x) ((x) & 0x0000ffff)#define DLT_IS_NETBSD_RAWAF(x) (DLT_CLASS(x) == DLT_CLASS_NETBSD_RAWAF)/* * The instruction encodings. *//* instruction classes */#define BPF_CLASS(code) ((code) & 0x07)#define BPF_LD 0x00#define BPF_LDX 0x01#define BPF_ST 0x02#define BPF_STX 0x03#define BPF_ALU 0x04#define BPF_JMP 0x05#define BPF_RET 0x06#define BPF_MISC 0x07/* ld/ldx fields */#define BPF_SIZE(code) ((code) & 0x18)#define BPF_W 0x00#define BPF_H 0x08#define BPF_B 0x10#define BPF_MODE(code) ((code) & 0xe0)#define BPF_IMM 0x00#define BPF_ABS 0x20#define BPF_IND 0x40#define BPF_MEM 0x60#define BPF_LEN 0x80#define BPF_MSH 0xa0/* alu/jmp fields */#define BPF_OP(code) ((code) & 0xf0)#define BPF_ADD 0x00#define BPF_SUB 0x10#define BPF_MUL 0x20#define BPF_DIV 0x30#define BPF_OR 0x40#define BPF_AND 0x50#define BPF_LSH 0x60#define BPF_RSH 0x70#define BPF_NEG 0x80#define BPF_JA 0x00#define BPF_JEQ 0x10#define BPF_JGT 0x20#define BPF_JGE 0x30#define BPF_JSET 0x40#define BPF_SRC(code) ((code) & 0x08)#define BPF_K 0x00#define BPF_X 0x08/* ret - BPF_K and BPF_X also apply */#define BPF_RVAL(code) ((code) & 0x18)#define BPF_A 0x10/* misc */#define BPF_MISCOP(code) ((code) & 0xf8)#define BPF_TAX 0x00#define BPF_TXA 0x80/* * The instruction data structure. */struct bpf_insn { u_short code; u_char jt; u_char jf; bpf_u_int32 k;};/* * Macros for insn array initializers. */#define BPF_STMT(code, k) { (u_short)(code), 0, 0, k }#define BPF_JUMP(code, k, jt, jf) { (u_short)(code), jt, jf, k }#if __STDC__ || defined(__cplusplus)extern int bpf_validate(const struct bpf_insn *, int);extern u_int bpf_filter(const struct bpf_insn *, const u_char *, u_int, u_int);#elseextern int bpf_validate();extern u_int bpf_filter();#endif/* * Number of scratch memory words (for BPF_LD|BPF_MEM and BPF_ST). */#define BPF_MEMWORDS 16#ifdef __cplusplus}#endif#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -