home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / amiga / os / bsdss4.tz / bsdss4 / bsdss / server / net / bpfdesc.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-04-22  |  5.0 KB  |  122 lines

  1. /* 
  2.  * Mach Operating System
  3.  * Copyright (c) 1992 Carnegie Mellon University
  4.  * All Rights Reserved.
  5.  * 
  6.  * Permission to use, copy, modify and distribute this software and its
  7.  * documentation is hereby granted, provided that both the copyright
  8.  * notice and this permission notice appear in all copies of the
  9.  * software, derivative works or modified versions, and any portions
  10.  * thereof, and that both notices appear in supporting documentation.
  11.  * 
  12.  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
  13.  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
  14.  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
  15.  * 
  16.  * Carnegie Mellon requests users of this software to return to
  17.  * 
  18.  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
  19.  *  School of Computer Science
  20.  *  Carnegie Mellon University
  21.  *  Pittsburgh PA 15213-3890
  22.  * 
  23.  * any improvements or extensions that they make and grant Carnegie Mellon 
  24.  * the rights to redistribute these changes.
  25.  */
  26. /*
  27.  * HISTORY
  28.  * $Log:    bpfdesc.h,v $
  29.  * Revision 2.1  92/04/21  17:13:53  rwd
  30.  * BSDSS
  31.  * 
  32.  *
  33.  */
  34.  
  35. /*-
  36.  * Copyright (c) 1991 The Regents of the University of California.
  37.  * All rights reserved.
  38.  *
  39.  * This code is derived from the Stanford/CMU enet packet filter,
  40.  * (net/enet.c) distributed as part of 4.3BSD, and code contributed
  41.  * to Berkeley by Steven McCanne of Lawrence Berkeley Laboratory.
  42.  *
  43.  * Redistribution and use in source and binary forms, with or without
  44.  * modification, are permitted provided that the following conditions
  45.  * are met:
  46.  * 1. Redistributions of source code must retain the above copyright
  47.  *    notice, this list of conditions and the following disclaimer.
  48.  * 2. Redistributions in binary form must reproduce the above copyright
  49.  *    notice, this list of conditions and the following disclaimer in the
  50.  *    documentation and/or other materials provided with the distribution.
  51.  * 3. All advertising materials mentioning features or use of this software
  52.  *    must display the following acknowledgement:
  53.  *    This product includes software developed by the University of
  54.  *    California, Berkeley and its contributors.
  55.  * 4. Neither the name of the University nor the names of its contributors
  56.  *    may be used to endorse or promote products derived from this software
  57.  *    without specific prior written permission.
  58.  *
  59.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  60.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  61.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  62.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  63.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  64.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  65.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  66.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  67.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  68.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  69.  * SUCH DAMAGE.
  70.  *
  71.  *    @(#)bpfdesc.h    7.1 (Berkeley) 5/7/91
  72.  *
  73.  * @(#) $Header: /afs/cs.cmu.edu/project/mach/mach3/rcs/bsdss/server/net/bpfdesc.h,v 2.1 92/04/21 17:13:53 rwd Exp $ (LBL)
  74.  */
  75.  
  76. /*
  77.  * Descriptor associated with each open bpf file.
  78.  */
  79. struct bpf_d {
  80.     struct bpf_d    *bd_next;    /* Linked list of descriptors */
  81.     /*
  82.      * Buffer slots: two mbuf clusters buffer the incoming packets.
  83.      *   The model has three slots.  Sbuf is always occupied.
  84.      *   sbuf (store) - Receive interrupt puts packets here.
  85.      *   hbuf (hold) - When sbuf is full, put cluster here and
  86.      *                 wakeup read (replace sbuf with fbuf).
  87.      *   fbuf (free) - When read is done, put cluster here.
  88.      * On receiving, if sbuf is full and fbuf is 0, packet is dropped.
  89.      */
  90.     caddr_t        bd_sbuf;    /* store slot */
  91.     caddr_t        bd_hbuf;    /* hold slot */
  92.     caddr_t        bd_fbuf;    /* free slot */
  93.     int         bd_slen;    /* current length of store buffer */
  94.     int         bd_hlen;    /* current length of hold buffer */
  95.  
  96.     int        bd_bufsize;    /* absolute length of buffers */
  97.  
  98.     struct bpf_if *    bd_bif;        /* interface descriptor */
  99.     u_long        bd_rtout;    /* Read timeout in 'ticks' */
  100.     struct bpf_insn *bd_filter;     /* filter code */
  101.     u_long        bd_rcount;    /* number of packets received */
  102.     u_long        bd_dcount;    /* number of packets dropped */
  103.     struct proc *    bd_selproc;    /* process that last selected us */
  104.  
  105.     u_char        bd_promisc;    /* true if listening promiscuously */
  106.     u_char        bd_state;    /* idle, waiting, or timed out */
  107.     u_char        bd_selcoll;    /* true if selects collide */
  108.     u_char        bd_immediate;    /* true to return on packet arrival */
  109. };
  110.  
  111. /*
  112.  * Descriptor associated with each attached hardware interface.
  113.  */
  114. struct bpf_if {
  115.     struct bpf_if *bif_next;    /* list of all interfaces */
  116.     struct bpf_d *bif_dlist;    /* descriptor list */
  117.     struct bpf_if **bif_driverp;    /* pointer into softc */
  118.     u_int bif_dlt;            /* link layer type */
  119.     u_int bif_hdrlen;        /* length of header (with padding) */
  120.     struct ifnet *bif_ifp;        /* correspoding interface */
  121. };
  122.