Changeset View
Changeset View
Standalone View
Standalone View
head/sys/net/bpf.h
Show All 36 Lines | |||||
* @(#)bpf.h 1.34 (LBL) 6/16/96 | * @(#)bpf.h 1.34 (LBL) 6/16/96 | ||||
* | * | ||||
* $FreeBSD$ | * $FreeBSD$ | ||||
*/ | */ | ||||
#ifndef _NET_BPF_H_ | #ifndef _NET_BPF_H_ | ||||
#define _NET_BPF_H_ | #define _NET_BPF_H_ | ||||
#include <sys/ck.h> | |||||
#include <net/dlt.h> | |||||
/* BSD style release date */ | /* BSD style release date */ | ||||
#define BPF_RELEASE 199606 | #define BPF_RELEASE 199606 | ||||
typedef int32_t bpf_int32; | typedef int32_t bpf_int32; | ||||
typedef u_int32_t bpf_u_int32; | typedef u_int32_t bpf_u_int32; | ||||
typedef int64_t bpf_int64; | typedef int64_t bpf_int64; | ||||
typedef u_int64_t bpf_u_int64; | typedef u_int64_t bpf_u_int64; | ||||
▲ Show 20 Lines • Show All 175 Lines • ▼ Show 20 Lines | |||||
*/ | */ | ||||
struct bpf_zbuf_header { | struct bpf_zbuf_header { | ||||
volatile u_int bzh_kernel_gen; /* Kernel generation number. */ | volatile u_int bzh_kernel_gen; /* Kernel generation number. */ | ||||
volatile u_int bzh_kernel_len; /* Length of data in the buffer. */ | volatile u_int bzh_kernel_len; /* Length of data in the buffer. */ | ||||
volatile u_int bzh_user_gen; /* User generation number. */ | volatile u_int bzh_user_gen; /* User generation number. */ | ||||
u_int _bzh_pad[5]; | u_int _bzh_pad[5]; | ||||
}; | }; | ||||
/* Pull in data-link level type codes. */ | |||||
#include <net/dlt.h> | |||||
/* | /* | ||||
* The instruction encodings. | * The instruction encodings. | ||||
* | * | ||||
* Please inform tcpdump-workers@lists.tcpdump.org if you use any | * Please inform tcpdump-workers@lists.tcpdump.org if you use any | ||||
* of the reserved values, so that we can note that they're used | * of the reserved values, so that we can note that they're used | ||||
* (and perhaps implement it in the reference BPF implementation | * (and perhaps implement it in the reference BPF implementation | ||||
* and encourage its implementation elsewhere). | * and encourage its implementation elsewhere). | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 157 Lines • ▼ Show 20 Lines | |||||
} while (0) | } while (0) | ||||
/* | /* | ||||
* Descriptor associated with each attached hardware interface. | * Descriptor associated with each attached hardware interface. | ||||
* Part of this structure is exposed to external callers to speed up | * Part of this structure is exposed to external callers to speed up | ||||
* bpf_peers_present() calls. | * bpf_peers_present() calls. | ||||
*/ | */ | ||||
struct bpf_if; | struct bpf_if; | ||||
CK_LIST_HEAD(bpfd_list, bpf_d); | |||||
struct bpf_if_ext { | struct bpf_if_ext { | ||||
LIST_ENTRY(bpf_if) bif_next; /* list of all interfaces */ | CK_LIST_ENTRY(bpf_if) bif_next; /* list of all interfaces */ | ||||
LIST_HEAD(, bpf_d) bif_dlist; /* descriptor list */ | struct bpfd_list bif_dlist; /* descriptor list */ | ||||
}; | }; | ||||
void bpf_bufheld(struct bpf_d *d); | void bpf_bufheld(struct bpf_d *d); | ||||
int bpf_validate(const struct bpf_insn *, int); | int bpf_validate(const struct bpf_insn *, int); | ||||
void bpf_tap(struct bpf_if *, u_char *, u_int); | void bpf_tap(struct bpf_if *, u_char *, u_int); | ||||
void bpf_mtap(struct bpf_if *, struct mbuf *); | void bpf_mtap(struct bpf_if *, struct mbuf *); | ||||
void bpf_mtap2(struct bpf_if *, void *, u_int, struct mbuf *); | void bpf_mtap2(struct bpf_if *, void *, u_int, struct mbuf *); | ||||
void bpfattach(struct ifnet *, u_int, u_int); | void bpfattach(struct ifnet *, u_int, u_int); | ||||
void bpfattach2(struct ifnet *, u_int, u_int, struct bpf_if **); | void bpfattach2(struct ifnet *, u_int, u_int, struct bpf_if **); | ||||
void bpfdetach(struct ifnet *); | void bpfdetach(struct ifnet *); | ||||
#ifdef VIMAGE | #ifdef VIMAGE | ||||
int bpf_get_bp_params(struct bpf_if *, u_int *, u_int *); | int bpf_get_bp_params(struct bpf_if *, u_int *, u_int *); | ||||
#endif | #endif | ||||
void bpfilterattach(int); | void bpfilterattach(int); | ||||
u_int bpf_filter(const struct bpf_insn *, u_char *, u_int, u_int); | u_int bpf_filter(const struct bpf_insn *, u_char *, u_int, u_int); | ||||
static __inline int | static __inline int | ||||
bpf_peers_present(struct bpf_if *bpf) | bpf_peers_present(struct bpf_if *bpf) | ||||
{ | { | ||||
struct bpf_if_ext *ext; | struct bpf_if_ext *ext; | ||||
ext = (struct bpf_if_ext *)bpf; | ext = (struct bpf_if_ext *)bpf; | ||||
if (!LIST_EMPTY(&ext->bif_dlist)) | if (!CK_LIST_EMPTY(&ext->bif_dlist)) | ||||
return (1); | return (1); | ||||
return (0); | return (0); | ||||
} | } | ||||
#define BPF_TAP(_ifp,_pkt,_pktlen) do { \ | #define BPF_TAP(_ifp,_pkt,_pktlen) do { \ | ||||
if (bpf_peers_present((_ifp)->if_bpf)) \ | if (bpf_peers_present((_ifp)->if_bpf)) \ | ||||
bpf_tap((_ifp)->if_bpf, (_pkt), (_pktlen)); \ | bpf_tap((_ifp)->if_bpf, (_pkt), (_pktlen)); \ | ||||
} while (0) | } while (0) | ||||
Show All 28 Lines |