pfil.h revision 1.6 1 /* $NetBSD: pfil.h,v 1.6 1997/02/22 17:52:44 scottr 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 for
18 * the NetBSD Project.
19 * 4. The name of the author may not be used to endorse or promote products
20 * derived from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 */
34
35 #ifndef _NET_PFIL_H_
36 #define _NET_PFIL_H_
37
38 /* note: this file needs <net/if.h> and <sys/mbuf.h> */
39
40 #ifdef _KERNEL
41 #include <sys/queue.h>
42
43 /*
44 * The packet filter hooks are designed for anything to call them to
45 * possibly intercept the packet.
46 */
47 struct packet_filter_hook {
48 LIST_ENTRY(packet_filter_hook) pfil_link;
49 int (*pfil_func) __P((void *, int, struct ifnet *, int,
50 struct mbuf **));
51 int pfil_flags;
52 };
53
54 #define PFIL_IN 0x00000001
55 #define PFIL_OUT 0x00000002
56 #define PFIL_WAITOK 0x00000008
57 #define PFIL_ALL (PFIL_IN|PFIL_OUT)
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 /* XXX */
67 #ifndef _LKM
68 #include "ipfilter.h"
69 #endif
70
71 #if NIPFILTER > 0
72 #ifdef PFIL_HOOKS
73 #undef PFIL_HOOKS
74 #endif
75 #define PFIL_HOOKS
76 #endif /* NIPFILTER */
77
78 #endif /* _NET_PFIL_H_ */
79