libpcap  1.10.1
About: libpcap is a packet filter library used by tools like tcpdump.
  Fossies Dox: libpcap-1.10.1.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

bpf.h File Reference
#include <pcap/funcattrs.h>
#include <pcap/dlt.h>
Include dependency graph for bpf.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  bpf_program
 
struct  bpf_insn
 

Macros

#define BPF_RELEASE   199606
 
#define BPF_ALIGNMENT   sizeof(bpf_int32)
 
#define BPF_WORDALIGN(x)   (((x)+(BPF_ALIGNMENT-1))&~(BPF_ALIGNMENT-1))
 
#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
 
#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
 
#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_MOD   0x90
 
#define BPF_XOR   0xa0
 
#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
 
#define BPF_RVAL(code)   ((code) & 0x18)
 
#define BPF_A   0x10
 
#define BPF_MISCOP(code)   ((code) & 0xf8)
 
#define BPF_TAX   0x00
 
#define BPF_TXA   0x80
 
#define BPF_STMT(code, k)   { (u_short)(code), 0, 0, k }
 
#define BPF_JUMP(code, k, jt, jf)   { (u_short)(code), jt, jf, k }
 
#define BPF_MEMWORDS   16
 

Typedefs

typedef int bpf_int32
 
typedef u_int bpf_u_int32
 

Functions

u_int bpf_filter (const struct bpf_insn *, const u_char *, u_int, u_int)
 
int bpf_validate (const struct bpf_insn *f, int len)
 
char * bpf_image (const struct bpf_insn *, int)
 
void bpf_dump (const struct bpf_program *, int)
 

Macro Definition Documentation

◆ BPF_A

#define BPF_A   0x10

Definition at line 203 of file bpf.h.

◆ BPF_ABS

#define BPF_ABS   0x20

Definition at line 154 of file bpf.h.

◆ BPF_ADD

#define BPF_ADD   0x00

Definition at line 164 of file bpf.h.

◆ BPF_ALIGNMENT

#define BPF_ALIGNMENT   sizeof(bpf_int32)

Definition at line 108 of file bpf.h.

◆ BPF_ALU

#define BPF_ALU   0x04

Definition at line 141 of file bpf.h.

◆ BPF_AND

#define BPF_AND   0x50

Definition at line 169 of file bpf.h.

◆ BPF_B

#define BPF_B   0x10

Definition at line 150 of file bpf.h.

◆ BPF_CLASS

#define BPF_CLASS (   code)    ((code) & 0x07)

Definition at line 136 of file bpf.h.

◆ BPF_DIV

#define BPF_DIV   0x30

Definition at line 167 of file bpf.h.

◆ BPF_H

#define BPF_H   0x08

Definition at line 149 of file bpf.h.

◆ BPF_IMM

#define BPF_IMM   0x00

Definition at line 153 of file bpf.h.

◆ BPF_IND

#define BPF_IND   0x40

Definition at line 155 of file bpf.h.

◆ BPF_JA

#define BPF_JA   0x00

Definition at line 181 of file bpf.h.

◆ BPF_JEQ

#define BPF_JEQ   0x10

Definition at line 182 of file bpf.h.

◆ BPF_JGE

#define BPF_JGE   0x30

Definition at line 184 of file bpf.h.

◆ BPF_JGT

#define BPF_JGT   0x20

Definition at line 183 of file bpf.h.

◆ BPF_JMP

#define BPF_JMP   0x05

Definition at line 142 of file bpf.h.

◆ BPF_JSET

#define BPF_JSET   0x40

Definition at line 185 of file bpf.h.

◆ BPF_JUMP

#define BPF_JUMP (   code,
  k,
  jt,
  jf 
)    { (u_short)(code), jt, jf, k }

Definition at line 269 of file bpf.h.

◆ BPF_K

#define BPF_K   0x00

Definition at line 198 of file bpf.h.

◆ BPF_LD

#define BPF_LD   0x00

Definition at line 137 of file bpf.h.

◆ BPF_LDX

#define BPF_LDX   0x01

Definition at line 138 of file bpf.h.

◆ BPF_LEN

#define BPF_LEN   0x80

Definition at line 157 of file bpf.h.

◆ BPF_LSH

#define BPF_LSH   0x60

Definition at line 170 of file bpf.h.

◆ BPF_MEM

#define BPF_MEM   0x60

Definition at line 156 of file bpf.h.

◆ BPF_MEMWORDS

#define BPF_MEMWORDS   16

Definition at line 286 of file bpf.h.

◆ BPF_MISC

#define BPF_MISC   0x07

Definition at line 144 of file bpf.h.

◆ BPF_MISCOP

#define BPF_MISCOP (   code)    ((code) & 0xf8)

Definition at line 207 of file bpf.h.

◆ BPF_MOD

#define BPF_MOD   0x90

Definition at line 173 of file bpf.h.

◆ BPF_MODE

#define BPF_MODE (   code)    ((code) & 0xe0)

Definition at line 152 of file bpf.h.

◆ BPF_MSH

#define BPF_MSH   0xa0

Definition at line 158 of file bpf.h.

◆ BPF_MUL

#define BPF_MUL   0x20

Definition at line 166 of file bpf.h.

◆ BPF_NEG

#define BPF_NEG   0x80

Definition at line 172 of file bpf.h.

◆ BPF_OP

#define BPF_OP (   code)    ((code) & 0xf0)

Definition at line 163 of file bpf.h.

◆ BPF_OR

#define BPF_OR   0x40

Definition at line 168 of file bpf.h.

◆ BPF_RELEASE

#define BPF_RELEASE   199606

Definition at line 91 of file bpf.h.

◆ BPF_RET

#define BPF_RET   0x06

Definition at line 143 of file bpf.h.

◆ BPF_RSH

#define BPF_RSH   0x70

Definition at line 171 of file bpf.h.

◆ BPF_RVAL

#define BPF_RVAL (   code)    ((code) & 0x18)

Definition at line 202 of file bpf.h.

◆ BPF_SIZE

#define BPF_SIZE (   code)    ((code) & 0x18)

Definition at line 147 of file bpf.h.

◆ BPF_SRC

#define BPF_SRC (   code)    ((code) & 0x08)

Definition at line 197 of file bpf.h.

◆ BPF_ST

#define BPF_ST   0x02

Definition at line 139 of file bpf.h.

◆ BPF_STMT

#define BPF_STMT (   code,
 
)    { (u_short)(code), 0, 0, k }

Definition at line 265 of file bpf.h.

◆ BPF_STX

#define BPF_STX   0x03

Definition at line 140 of file bpf.h.

◆ BPF_SUB

#define BPF_SUB   0x10

Definition at line 165 of file bpf.h.

◆ BPF_TAX

#define BPF_TAX   0x00

Definition at line 208 of file bpf.h.

◆ BPF_TXA

#define BPF_TXA   0x80

Definition at line 225 of file bpf.h.

◆ BPF_W

#define BPF_W   0x00

Definition at line 148 of file bpf.h.

◆ BPF_WORDALIGN

#define BPF_WORDALIGN (   x)    (((x)+(BPF_ALIGNMENT-1))&~(BPF_ALIGNMENT-1))

Definition at line 112 of file bpf.h.

◆ BPF_X

#define BPF_X   0x08

Definition at line 199 of file bpf.h.

◆ BPF_XOR

#define BPF_XOR   0xa0

Definition at line 174 of file bpf.h.

Typedef Documentation

◆ bpf_int32

typedef int bpf_int32

Definition at line 97 of file bpf.h.

◆ bpf_u_int32

typedef u_int bpf_u_int32

Definition at line 98 of file bpf.h.

Function Documentation

◆ bpf_dump()

void bpf_dump ( const struct bpf_program p,
int  option 
)

◆ bpf_filter()

u_int bpf_filter ( const struct bpf_insn pc,
const u_char *  p,
u_int  wirelen,
u_int  buflen 
)

Definition at line 536 of file bpf_filter.c.

References pcap_filter().

◆ bpf_image()

◆ bpf_validate()

int bpf_validate ( const struct bpf_insn f,
int  len 
)

Definition at line 543 of file bpf_filter.c.

References pcap_validate_filter().

Referenced by daemon_unpackapplyfilter(), and main().