1*51441Smccanne /* 2*51441Smccanne * Copyright (c) 1990, 1991 Regents of the University of California. 347639Smccanne * All rights reserved. 447639Smccanne * 549284Sbostic * This code is derived from the Stanford/CMU enet packet filter, 649284Sbostic * (net/enet.c) distributed as part of 4.3BSD, and code contributed 7*51441Smccanne * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence 851426Smccanne * Berkeley Laboratory. 947639Smccanne * 10*51441Smccanne * %sccs.include.redist.c% 1149284Sbostic * 12*51441Smccanne * @(#)bpfdesc.h 7.3 (Berkeley) 10/29/91 1349284Sbostic * 1451426Smccanne * @(#) $Header: bpfdesc.h,v 1.9 91/10/27 21:22:38 mccanne Exp $ (LBL) 1547639Smccanne */ 1647639Smccanne 1747639Smccanne /* 1847639Smccanne * Descriptor associated with each open bpf file. 1947639Smccanne */ 2047639Smccanne struct bpf_d { 2147639Smccanne struct bpf_d *bd_next; /* Linked list of descriptors */ 2247639Smccanne /* 2347639Smccanne * Buffer slots: two mbuf clusters buffer the incoming packets. 2447639Smccanne * The model has three slots. Sbuf is always occupied. 2547639Smccanne * sbuf (store) - Receive interrupt puts packets here. 2647639Smccanne * hbuf (hold) - When sbuf is full, put cluster here and 2747639Smccanne * wakeup read (replace sbuf with fbuf). 2847639Smccanne * fbuf (free) - When read is done, put cluster here. 2947639Smccanne * On receiving, if sbuf is full and fbuf is 0, packet is dropped. 3047639Smccanne */ 3148933Smccanne caddr_t bd_sbuf; /* store slot */ 3248933Smccanne caddr_t bd_hbuf; /* hold slot */ 3348933Smccanne caddr_t bd_fbuf; /* free slot */ 3448933Smccanne int bd_slen; /* current length of store buffer */ 3548933Smccanne int bd_hlen; /* current length of hold buffer */ 3647639Smccanne 3748933Smccanne int bd_bufsize; /* absolute length of buffers */ 3848933Smccanne 3947639Smccanne struct bpf_if * bd_bif; /* interface descriptor */ 4047639Smccanne u_long bd_rtout; /* Read timeout in 'ticks' */ 4148933Smccanne struct bpf_insn *bd_filter; /* filter code */ 4247639Smccanne u_long bd_rcount; /* number of packets received */ 4347639Smccanne u_long bd_dcount; /* number of packets dropped */ 4448933Smccanne struct proc * bd_selproc; /* process that last selected us */ 4547639Smccanne 4647639Smccanne u_char bd_promisc; /* true if listening promiscuously */ 4747639Smccanne u_char bd_state; /* idle, waiting, or timed out */ 4848933Smccanne u_char bd_selcoll; /* true if selects collide */ 4947639Smccanne u_char bd_immediate; /* true to return on packet arrival */ 5051426Smccanne #if BSD < 199103 5151426Smccanne int bd_timedout; 5251426Smccanne #endif 5347639Smccanne }; 5447639Smccanne 5547639Smccanne /* 5647639Smccanne * Descriptor associated with each attached hardware interface. 5747639Smccanne */ 5847639Smccanne struct bpf_if { 5949199Smccanne struct bpf_if *bif_next; /* list of all interfaces */ 6049199Smccanne struct bpf_d *bif_dlist; /* descriptor list */ 6149199Smccanne struct bpf_if **bif_driverp; /* pointer into softc */ 6249199Smccanne u_int bif_dlt; /* link layer type */ 6349199Smccanne u_int bif_hdrlen; /* length of header (with padding) */ 6449199Smccanne struct ifnet *bif_ifp; /* correspoding interface */ 6547639Smccanne }; 66