]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - packages/net/tcpip/v2_0/include/net/bpfdesc.h
Initial revision
[karo-tx-redboot.git] / packages / net / tcpip / v2_0 / include / net / bpfdesc.h
1 //==========================================================================
2 //
3 //      include/net/bpfdesc.h
4 //
5 //      
6 //
7 //==========================================================================
8 //####BSDCOPYRIGHTBEGIN####
9 //
10 // -------------------------------------------
11 //
12 // Portions of this software may have been derived from OpenBSD or other sources,
13 // and are covered by the appropriate copyright disclaimers included herein.
14 //
15 // -------------------------------------------
16 //
17 //####BSDCOPYRIGHTEND####
18 //==========================================================================
19 //#####DESCRIPTIONBEGIN####
20 //
21 // Author(s):    gthomas
22 // Contributors: gthomas
23 // Date:         2000-01-10
24 // Purpose:      
25 // Description:  
26 //              
27 //
28 //####DESCRIPTIONEND####
29 //
30 //==========================================================================
31
32
33 /*      $OpenBSD: bpfdesc.h,v 1.5 1999/08/08 00:43:00 niklas Exp $      */
34 /*      $NetBSD: bpfdesc.h,v 1.11 1995/09/27 18:30:42 thorpej Exp $     */
35
36 /*
37  * Copyright (c) 1990, 1991, 1993
38  *      The Regents of the University of California.  All rights reserved.
39  *
40  * This code is derived from the Stanford/CMU enet packet filter,
41  * (net/enet.c) distributed as part of 4.3BSD, and code contributed
42  * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence
43  * Berkeley Laboratory.
44  *
45  * Redistribution and use in source and binary forms, with or without
46  * modification, are permitted provided that the following conditions
47  * are met:
48  * 1. Redistributions of source code must retain the above copyright
49  *    notice, this list of conditions and the following disclaimer.
50  * 2. Redistributions in binary form must reproduce the above copyright
51  *    notice, this list of conditions and the following disclaimer in the
52  *    documentation and/or other materials provided with the distribution.
53  * 3. All advertising materials mentioning features or use of this software
54  *    must display the following acknowledgement:
55  *      This product includes software developed by the University of
56  *      California, Berkeley and its contributors.
57  * 4. Neither the name of the University nor the names of its contributors
58  *    may be used to endorse or promote products derived from this software
59  *    without specific prior written permission.
60  *
61  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
62  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
63  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
64  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
65  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
66  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
67  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
68  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
69  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
70  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
71  * SUCH DAMAGE.
72  *
73  *      @(#)bpfdesc.h   8.1 (Berkeley) 6/10/93
74  */
75
76 #ifndef _NET_BPFDESC_H_
77 #define _NET_BPFDESC_H_
78
79 #include <sys/select.h>
80
81 /*
82  * Descriptor associated with each open bpf file.
83  */
84 struct bpf_d {
85         struct bpf_d    *bd_next;       /* Linked list of descriptors */
86         /*
87          * Buffer slots: two mbuf clusters buffer the incoming packets.
88          *   The model has three slots.  Sbuf is always occupied.
89          *   sbuf (store) - Receive interrupt puts packets here.
90          *   hbuf (hold) - When sbuf is full, put cluster here and
91          *                 wakeup read (replace sbuf with fbuf).
92          *   fbuf (free) - When read is done, put cluster here.
93          * On receiving, if sbuf is full and fbuf is 0, packet is dropped.
94          */
95         caddr_t         bd_sbuf;        /* store slot */
96         caddr_t         bd_hbuf;        /* hold slot */
97         caddr_t         bd_fbuf;        /* free slot */
98         int             bd_slen;        /* current length of store buffer */
99         int             bd_hlen;        /* current length of hold buffer */
100
101         int             bd_bufsize;     /* absolute length of buffers */
102
103         struct bpf_if * bd_bif;         /* interface descriptor */
104         u_long          bd_rtout;       /* Read timeout in 'ticks' */
105         u_long          bd_rdStart;     /* when the read started */
106         struct bpf_insn *bd_filter;     /* filter code */
107         u_long          bd_rcount;      /* number of packets received */
108         u_long          bd_dcount;      /* number of packets dropped */
109
110         u_char          bd_promisc;     /* true if listening promiscuously */
111         u_char          bd_state;       /* idle, waiting, or timed out */
112         u_char          bd_immediate;   /* true to return on packet arrival */
113         int             bd_async;       /* non-zero if packet reception should generate signal */
114         int             bd_sig;         /* signal to send upon packet reception */
115         pid_t           bd_pgid;        /* process or group id for signal */
116         uid_t           bd_siguid;      /* uid for process that set pgid */
117         uid_t           bd_sigeuid;     /* euid for process that set pgid */
118 #if BSD < 199103
119         u_char          bd_selcoll;     /* true if selects collide */
120         int             bd_timedout;
121         struct proc *   bd_selproc;     /* process that last selected us */
122 #else
123         u_char          bd_pad;         /* explicit alignment */
124         struct selinfo  bd_sel;         /* bsd select info */
125 #endif
126 };
127
128 /*
129  * Descriptor associated with each attached hardware interface.
130  */
131 struct bpf_if {
132         struct bpf_if *bif_next;        /* list of all interfaces */
133         struct bpf_d *bif_dlist;        /* descriptor list */
134         struct bpf_if **bif_driverp;    /* pointer into softc */
135         u_int bif_dlt;                  /* link layer type */
136         u_int bif_hdrlen;               /* length of header (with padding) */
137         struct ifnet *bif_ifp;          /* correspoding interface */
138 };
139
140 #ifdef _KERNEL
141 int      bpf_setf __P((struct bpf_d *, struct bpf_program *));
142 #endif
143
144 #endif // _NET_BPFDESC_H_