Commit | Line | Data |
---|---|---|
6cfe221b KB |
1 | /*- |
2 | * Copyright (c) 1991 The 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 | |
7 | * to Berkeley by Steven McCanne of Lawrence Berkeley Laboratory. | |
06f08e67 | 8 | * |
6cfe221b | 9 | * %sccs.include.redist.c% |
06f08e67 | 10 | * |
6cfe221b KB |
11 | * @(#)bpfdesc.h 7.1 (Berkeley) %G% |
12 | * | |
13 | * @(#) $Header: bpfdesc.h,v 1.7 90/12/04 01:05:01 mccanne Exp $ (LBL) | |
06f08e67 SM |
14 | */ |
15 | ||
16 | /* | |
17 | * Descriptor associated with each open bpf file. | |
18 | */ | |
19 | struct bpf_d { | |
20 | struct bpf_d *bd_next; /* Linked list of descriptors */ | |
21 | /* | |
22 | * Buffer slots: two mbuf clusters buffer the incoming packets. | |
23 | * The model has three slots. Sbuf is always occupied. | |
24 | * sbuf (store) - Receive interrupt puts packets here. | |
25 | * hbuf (hold) - When sbuf is full, put cluster here and | |
26 | * wakeup read (replace sbuf with fbuf). | |
27 | * fbuf (free) - When read is done, put cluster here. | |
28 | * On receiving, if sbuf is full and fbuf is 0, packet is dropped. | |
29 | */ | |
f8e186b1 SM |
30 | caddr_t bd_sbuf; /* store slot */ |
31 | caddr_t bd_hbuf; /* hold slot */ | |
32 | caddr_t bd_fbuf; /* free slot */ | |
33 | int bd_slen; /* current length of store buffer */ | |
34 | int bd_hlen; /* current length of hold buffer */ | |
35 | ||
36 | int bd_bufsize; /* absolute length of buffers */ | |
06f08e67 SM |
37 | |
38 | struct bpf_if * bd_bif; /* interface descriptor */ | |
39 | u_long bd_rtout; /* Read timeout in 'ticks' */ | |
f8e186b1 | 40 | struct bpf_insn *bd_filter; /* filter code */ |
06f08e67 SM |
41 | u_long bd_rcount; /* number of packets received */ |
42 | u_long bd_dcount; /* number of packets dropped */ | |
f8e186b1 | 43 | struct proc * bd_selproc; /* process that last selected us */ |
06f08e67 SM |
44 | |
45 | u_char bd_promisc; /* true if listening promiscuously */ | |
46 | u_char bd_state; /* idle, waiting, or timed out */ | |
f8e186b1 | 47 | u_char bd_selcoll; /* true if selects collide */ |
06f08e67 SM |
48 | u_char bd_immediate; /* true to return on packet arrival */ |
49 | }; | |
50 | ||
51 | /* | |
52 | * Descriptor associated with each attached hardware interface. | |
53 | */ | |
54 | struct bpf_if { | |
7249f2db SM |
55 | struct bpf_if *bif_next; /* list of all interfaces */ |
56 | struct bpf_d *bif_dlist; /* descriptor list */ | |
57 | struct bpf_if **bif_driverp; /* pointer into softc */ | |
58 | u_int bif_dlt; /* link layer type */ | |
59 | u_int bif_hdrlen; /* length of header (with padding) */ | |
60 | struct ifnet *bif_ifp; /* correspoding interface */ | |
06f08e67 | 61 | }; |