Home | History | Annotate | Line # | Download | only in net
pfil.h revision 1.1
      1 /*	$NetBSD: pfil.h,v 1.1 1996/09/14 14:40:21 mrg Exp $	*/
      2 
      3 /*
      4  * Copyright (c) 1996 Matthew R. Green
      5  * All rights reserved.
      6  *
      7  * Redistribution and use in source and binary forms, with or without
      8  * modification, are permitted provided that the following conditions
      9  * are met:
     10  * 1. Redistributions of source code must retain the above copyright
     11  *    notice, this list of conditions and the following disclaimer.
     12  * 2. Redistributions in binary form must reproduce the above copyright
     13  *    notice, this list of conditions and the following disclaimer in the
     14  *    documentation and/or other materials provided with the distribution.
     15  * 3. All advertising materials mentioning features or use of this software
     16  *    must display the following acknowledgement:
     17  *      This product includes software developed by Matthew R. Green.
     18  * 4. The name of the author may not be used to endorse or promote products
     19  *    derived from this software without specific prior written permission.
     20  *
     21  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     22  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     23  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     24  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     25  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
     26  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
     27  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
     28  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
     29  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     30  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     31  * SUCH DAMAGE.
     32  */
     33 
     34 #ifndef _NET_PFIL_H_
     35 #define _NET_PFIL_H_
     36 
     37 /* note: this file needs <net/if.h> and <sys/mbuf.h> */
     38 
     39 #ifdef _KERNEL
     40 #include <sys/queue.h>
     41 
     42 /*
     43  * The packet filter hooks are designed for anything to call them to
     44  * possibly intercept the packet.
     45  */
     46 struct packet_filter_hook {
     47         LIST_ENTRY(packet_filter_hook) pfil_link;
     48         int	(*pfil_func) __P((void *, int, struct ifnet *, int,
     49 				  struct mbuf **));
     50 	int	pfil_flags;
     51 };
     52 
     53 #define PFIL_IN		0x00000001
     54 #define PFIL_OUT	0x00000002
     55 #define PFIL_BAD	0x00000004
     56 #define PFIL_WAITOK	0x00000008
     57 #define PFIL_ALL	(PFIL_IN|PFIL_OUT|PFIL_BAD)
     58 
     59 struct packet_filter_hook *pfil_hook_get __P((int));
     60 void	pfil_add_hook __P((int (*func) __P((void *, int,
     61 	    struct ifnet *, int, struct mbuf **)), int));
     62 void	pfil_remove_hook __P((int (*func) __P((void *, int,
     63 	    struct ifnet *, int, struct mbuf **)), int));
     64 #endif /* _KERNEL */
     65 
     66 #endif /* _NET_PFIL_H_ */
     67