MULTICAST is now standard
[unix-history] / usr / src / sys / net / bpfdesc.h
CommitLineData
81c7b6ec
SM
1/*
2 * Copyright (c) 1990, 1991 Regents of the University of California.
06f08e67
SM
3 * All rights reserved.
4 *
6cfe221b
KB
5 * This code is derived from the Stanford/CMU enet packet filter,
6 * (net/enet.c) distributed as part of 4.3BSD, and code contributed
81c7b6ec 7 * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence
c096a108 8 * Berkeley Laboratory.
06f08e67 9 *
81c7b6ec 10 * %sccs.include.redist.c%
6cfe221b 11 *
49ed2d4b 12 * @(#)bpfdesc.h 7.5 (Berkeley) %G%
c096a108
SM
13 *
14 * @(#) $Header: bpfdesc.h,v 1.9 91/10/27 21:22:38 mccanne Exp $ (LBL)
06f08e67
SM
15 */
16
17/*
18 * Descriptor associated with each open bpf file.
19 */
20struct bpf_d {
21 struct bpf_d *bd_next; /* Linked list of descriptors */
22 /*
23 * Buffer slots: two mbuf clusters buffer the incoming packets.
24 * The model has three slots. Sbuf is always occupied.
25 * sbuf (store) - Receive interrupt puts packets here.
26 * hbuf (hold) - When sbuf is full, put cluster here and
27 * wakeup read (replace sbuf with fbuf).
28 * fbuf (free) - When read is done, put cluster here.
29 * On receiving, if sbuf is full and fbuf is 0, packet is dropped.
30 */
f8e186b1
SM
31 caddr_t bd_sbuf; /* store slot */
32 caddr_t bd_hbuf; /* hold slot */
33 caddr_t bd_fbuf; /* free slot */
34 int bd_slen; /* current length of store buffer */
35 int bd_hlen; /* current length of hold buffer */
36
37 int bd_bufsize; /* absolute length of buffers */
06f08e67
SM
38
39 struct bpf_if * bd_bif; /* interface descriptor */
40 u_long bd_rtout; /* Read timeout in 'ticks' */
f8e186b1 41 struct bpf_insn *bd_filter; /* filter code */
06f08e67
SM
42 u_long bd_rcount; /* number of packets received */
43 u_long bd_dcount; /* number of packets dropped */
06f08e67
SM
44
45 u_char bd_promisc; /* true if listening promiscuously */
46 u_char bd_state; /* idle, waiting, or timed out */
06f08e67 47 u_char bd_immediate; /* true to return on packet arrival */
c096a108 48#if BSD < 199103
49ed2d4b 49 u_char bd_selcoll; /* true if selects collide */
c096a108 50 int bd_timedout;
49ed2d4b
SM
51 struct proc * bd_selproc; /* process that last selected us */
52#else
53 u_char bd_pad; /* explicit alignment */
54 struct selinfo bd_sel; /* bsd select info */
c096a108 55#endif
06f08e67
SM
56};
57
58/*
59 * Descriptor associated with each attached hardware interface.
60 */
61struct bpf_if {
7249f2db
SM
62 struct bpf_if *bif_next; /* list of all interfaces */
63 struct bpf_d *bif_dlist; /* descriptor list */
64 struct bpf_if **bif_driverp; /* pointer into softc */
65 u_int bif_dlt; /* link layer type */
66 u_int bif_hdrlen; /* length of header (with padding) */
67 struct ifnet *bif_ifp; /* correspoding interface */
06f08e67 68};