xref: /freebsd/usr.sbin/ppp/filter.h (revision 02f2e93b60c2b91feac8f45c4c889a5a8e40d8a2)
1 /*
2  *	    Written by Toshiharu OHNO (tony-o@iij.ad.jp)
3  *
4  *   Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd.
5  *
6  * Redistribution and use in source and binary forms are permitted
7  * provided that the above copyright notice and this paragraph are
8  * duplicated in all such forms and that any documentation,
9  * advertising materials, and other materials related to such
10  * distribution and use acknowledge that the software was developed
11  * by the Internet Initiative Japan.  The name of the
12  * IIJ may not be used to endorse or promote products derived
13  * from this software without specific prior written permission.
14  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
15  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
16  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17  *
18  * $Id: filter.h,v 1.9 1997/08/25 00:29:11 brian Exp $
19  *
20  *	TODO:
21  */
22 
23 /*
24  *   Actions
25  */
26 #define	A_NONE		0
27 #define	A_PERMIT	1
28 #define	A_DENY		2
29 #define	A_MASK		3
30 #define	A_UHOST		4
31 #define	A_UPORT		8
32 
33 /*
34  *   Known protocols
35  */
36 #define	P_NONE	0
37 #define	P_TCP	1
38 #define	P_UDP	2
39 #define	P_ICMP	3
40 
41 /*
42  *   Operations
43  */
44 #define	OP_NONE	0
45 #define	OP_EQ	1
46 #define	OP_GT	2
47 #define	OP_LT	4
48 
49 struct filterent {
50   int action;			/* Filtering action */
51   int swidth;			/* Effective source address width */
52   struct in_addr saddr;		/* Source address */
53   struct in_addr smask;		/* Source address mask */
54   int dwidth;			/* Effective destination address width */
55   struct in_addr daddr;		/* Destination address */
56   struct in_addr dmask;		/* Destination address mask */
57   int proto;			/* Protocol */
58   struct {
59     short srcop;
60     u_short srcport;
61     short dstop;
62     u_short dstport;
63     int estab;
64   } opt;
65 };
66 
67 #define	MAXFILTERS	20
68 
69 #define FL_IN		0
70 #define FL_OUT		1
71 #define FL_DIAL		2
72 #define FL_KEEP		3
73 
74 extern struct filterent ifilters[MAXFILTERS];	/* incoming packet filter */
75 extern struct filterent ofilters[MAXFILTERS];	/* outgoing packet filter */
76 extern struct filterent dfilters[MAXFILTERS];	/* dial-out packet filter */
77 extern struct filterent afilters[MAXFILTERS];	/* keep-alive packet filter */
78 
79 extern int ParseAddr(int, char **, struct in_addr *, struct in_addr *, int *);
80 extern int ShowIfilter(struct cmdtab *, int, char **);
81 extern int ShowOfilter(struct cmdtab *, int, char **);
82 extern int ShowDfilter(struct cmdtab *, int, char **);
83 extern int ShowAfilter(struct cmdtab *, int, char **);
84 extern int SetIfilter(struct cmdtab *, int, char **);
85 extern int SetOfilter(struct cmdtab *, int, char **);
86 extern int SetDfilter(struct cmdtab *, int, char **);
87 extern int SetAfilter(struct cmdtab *, int, char **);
88