xref: /freebsd/sbin/pfctl/pfctl_parser.h (revision 3b3a8eb937bf8045231e8364bfd1b94cd4a95979)
1*3b3a8eb9SGleb Smirnoff /*	$OpenBSD: pfctl_parser.h,v 1.86 2006/10/31 23:46:25 mcbride Exp $ */
2*3b3a8eb9SGleb Smirnoff 
3*3b3a8eb9SGleb Smirnoff /*
4*3b3a8eb9SGleb Smirnoff  * Copyright (c) 2001 Daniel Hartmeier
5*3b3a8eb9SGleb Smirnoff  * All rights reserved.
6*3b3a8eb9SGleb Smirnoff  *
7*3b3a8eb9SGleb Smirnoff  * Redistribution and use in source and binary forms, with or without
8*3b3a8eb9SGleb Smirnoff  * modification, are permitted provided that the following conditions
9*3b3a8eb9SGleb Smirnoff  * are met:
10*3b3a8eb9SGleb Smirnoff  *
11*3b3a8eb9SGleb Smirnoff  *    - Redistributions of source code must retain the above copyright
12*3b3a8eb9SGleb Smirnoff  *      notice, this list of conditions and the following disclaimer.
13*3b3a8eb9SGleb Smirnoff  *    - Redistributions in binary form must reproduce the above
14*3b3a8eb9SGleb Smirnoff  *      copyright notice, this list of conditions and the following
15*3b3a8eb9SGleb Smirnoff  *      disclaimer in the documentation and/or other materials provided
16*3b3a8eb9SGleb Smirnoff  *      with the distribution.
17*3b3a8eb9SGleb Smirnoff  *
18*3b3a8eb9SGleb Smirnoff  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19*3b3a8eb9SGleb Smirnoff  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20*3b3a8eb9SGleb Smirnoff  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21*3b3a8eb9SGleb Smirnoff  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22*3b3a8eb9SGleb Smirnoff  * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
23*3b3a8eb9SGleb Smirnoff  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24*3b3a8eb9SGleb Smirnoff  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25*3b3a8eb9SGleb Smirnoff  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26*3b3a8eb9SGleb Smirnoff  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27*3b3a8eb9SGleb Smirnoff  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28*3b3a8eb9SGleb Smirnoff  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29*3b3a8eb9SGleb Smirnoff  * POSSIBILITY OF SUCH DAMAGE.
30*3b3a8eb9SGleb Smirnoff  *
31*3b3a8eb9SGleb Smirnoff  * $FreeBSD$
32*3b3a8eb9SGleb Smirnoff  */
33*3b3a8eb9SGleb Smirnoff 
34*3b3a8eb9SGleb Smirnoff #ifndef _PFCTL_PARSER_H_
35*3b3a8eb9SGleb Smirnoff #define _PFCTL_PARSER_H_
36*3b3a8eb9SGleb Smirnoff 
37*3b3a8eb9SGleb Smirnoff #define PF_OSFP_FILE		"/etc/pf.os"
38*3b3a8eb9SGleb Smirnoff 
39*3b3a8eb9SGleb Smirnoff #define PF_OPT_DISABLE		0x0001
40*3b3a8eb9SGleb Smirnoff #define PF_OPT_ENABLE		0x0002
41*3b3a8eb9SGleb Smirnoff #define PF_OPT_VERBOSE		0x0004
42*3b3a8eb9SGleb Smirnoff #define PF_OPT_NOACTION		0x0008
43*3b3a8eb9SGleb Smirnoff #define PF_OPT_QUIET		0x0010
44*3b3a8eb9SGleb Smirnoff #define PF_OPT_CLRRULECTRS	0x0020
45*3b3a8eb9SGleb Smirnoff #define PF_OPT_USEDNS		0x0040
46*3b3a8eb9SGleb Smirnoff #define PF_OPT_VERBOSE2		0x0080
47*3b3a8eb9SGleb Smirnoff #define PF_OPT_DUMMYACTION	0x0100
48*3b3a8eb9SGleb Smirnoff #define PF_OPT_DEBUG		0x0200
49*3b3a8eb9SGleb Smirnoff #define PF_OPT_SHOWALL		0x0400
50*3b3a8eb9SGleb Smirnoff #define PF_OPT_OPTIMIZE		0x0800
51*3b3a8eb9SGleb Smirnoff #define PF_OPT_NUMERIC		0x1000
52*3b3a8eb9SGleb Smirnoff #define PF_OPT_MERGE		0x2000
53*3b3a8eb9SGleb Smirnoff #define PF_OPT_RECURSE		0x4000
54*3b3a8eb9SGleb Smirnoff 
55*3b3a8eb9SGleb Smirnoff #define PF_TH_ALL		0xFF
56*3b3a8eb9SGleb Smirnoff 
57*3b3a8eb9SGleb Smirnoff #define PF_NAT_PROXY_PORT_LOW	50001
58*3b3a8eb9SGleb Smirnoff #define PF_NAT_PROXY_PORT_HIGH	65535
59*3b3a8eb9SGleb Smirnoff 
60*3b3a8eb9SGleb Smirnoff #define PF_OPTIMIZE_BASIC	0x0001
61*3b3a8eb9SGleb Smirnoff #define PF_OPTIMIZE_PROFILE	0x0002
62*3b3a8eb9SGleb Smirnoff 
63*3b3a8eb9SGleb Smirnoff #define FCNT_NAMES { \
64*3b3a8eb9SGleb Smirnoff 	"searches", \
65*3b3a8eb9SGleb Smirnoff 	"inserts", \
66*3b3a8eb9SGleb Smirnoff 	"removals", \
67*3b3a8eb9SGleb Smirnoff 	NULL \
68*3b3a8eb9SGleb Smirnoff }
69*3b3a8eb9SGleb Smirnoff 
70*3b3a8eb9SGleb Smirnoff struct pfr_buffer;	/* forward definition */
71*3b3a8eb9SGleb Smirnoff 
72*3b3a8eb9SGleb Smirnoff 
73*3b3a8eb9SGleb Smirnoff struct pfctl {
74*3b3a8eb9SGleb Smirnoff 	int dev;
75*3b3a8eb9SGleb Smirnoff 	int opts;
76*3b3a8eb9SGleb Smirnoff 	int optimize;
77*3b3a8eb9SGleb Smirnoff 	int loadopt;
78*3b3a8eb9SGleb Smirnoff 	int asd;			/* anchor stack depth */
79*3b3a8eb9SGleb Smirnoff 	int bn;				/* brace number */
80*3b3a8eb9SGleb Smirnoff 	int brace;
81*3b3a8eb9SGleb Smirnoff 	int tdirty;			/* kernel dirty */
82*3b3a8eb9SGleb Smirnoff #define PFCTL_ANCHOR_STACK_DEPTH 64
83*3b3a8eb9SGleb Smirnoff 	struct pf_anchor *astack[PFCTL_ANCHOR_STACK_DEPTH];
84*3b3a8eb9SGleb Smirnoff 	struct pfioc_pooladdr paddr;
85*3b3a8eb9SGleb Smirnoff 	struct pfioc_altq *paltq;
86*3b3a8eb9SGleb Smirnoff 	struct pfioc_queue *pqueue;
87*3b3a8eb9SGleb Smirnoff 	struct pfr_buffer *trans;
88*3b3a8eb9SGleb Smirnoff 	struct pf_anchor *anchor, *alast;
89*3b3a8eb9SGleb Smirnoff 	const char *ruleset;
90*3b3a8eb9SGleb Smirnoff 
91*3b3a8eb9SGleb Smirnoff 	/* 'set foo' options */
92*3b3a8eb9SGleb Smirnoff 	u_int32_t	 timeout[PFTM_MAX];
93*3b3a8eb9SGleb Smirnoff 	u_int32_t	 limit[PF_LIMIT_MAX];
94*3b3a8eb9SGleb Smirnoff 	u_int32_t	 debug;
95*3b3a8eb9SGleb Smirnoff 	u_int32_t	 hostid;
96*3b3a8eb9SGleb Smirnoff 	char		*ifname;
97*3b3a8eb9SGleb Smirnoff 
98*3b3a8eb9SGleb Smirnoff 	u_int8_t	 timeout_set[PFTM_MAX];
99*3b3a8eb9SGleb Smirnoff 	u_int8_t	 limit_set[PF_LIMIT_MAX];
100*3b3a8eb9SGleb Smirnoff 	u_int8_t	 debug_set;
101*3b3a8eb9SGleb Smirnoff 	u_int8_t	 hostid_set;
102*3b3a8eb9SGleb Smirnoff 	u_int8_t	 ifname_set;
103*3b3a8eb9SGleb Smirnoff };
104*3b3a8eb9SGleb Smirnoff 
105*3b3a8eb9SGleb Smirnoff struct node_if {
106*3b3a8eb9SGleb Smirnoff 	char			 ifname[IFNAMSIZ];
107*3b3a8eb9SGleb Smirnoff 	u_int8_t		 not;
108*3b3a8eb9SGleb Smirnoff 	u_int8_t		 dynamic; /* antispoof */
109*3b3a8eb9SGleb Smirnoff 	u_int			 ifa_flags;
110*3b3a8eb9SGleb Smirnoff 	struct node_if		*next;
111*3b3a8eb9SGleb Smirnoff 	struct node_if		*tail;
112*3b3a8eb9SGleb Smirnoff };
113*3b3a8eb9SGleb Smirnoff 
114*3b3a8eb9SGleb Smirnoff struct node_host {
115*3b3a8eb9SGleb Smirnoff 	struct pf_addr_wrap	 addr;
116*3b3a8eb9SGleb Smirnoff 	struct pf_addr		 bcast;
117*3b3a8eb9SGleb Smirnoff 	struct pf_addr		 peer;
118*3b3a8eb9SGleb Smirnoff 	sa_family_t		 af;
119*3b3a8eb9SGleb Smirnoff 	u_int8_t		 not;
120*3b3a8eb9SGleb Smirnoff 	u_int32_t		 ifindex;	/* link-local IPv6 addrs */
121*3b3a8eb9SGleb Smirnoff 	char			*ifname;
122*3b3a8eb9SGleb Smirnoff 	u_int			 ifa_flags;
123*3b3a8eb9SGleb Smirnoff 	struct node_host	*next;
124*3b3a8eb9SGleb Smirnoff 	struct node_host	*tail;
125*3b3a8eb9SGleb Smirnoff };
126*3b3a8eb9SGleb Smirnoff 
127*3b3a8eb9SGleb Smirnoff struct node_os {
128*3b3a8eb9SGleb Smirnoff 	char			*os;
129*3b3a8eb9SGleb Smirnoff 	pf_osfp_t		 fingerprint;
130*3b3a8eb9SGleb Smirnoff 	struct node_os		*next;
131*3b3a8eb9SGleb Smirnoff 	struct node_os		*tail;
132*3b3a8eb9SGleb Smirnoff };
133*3b3a8eb9SGleb Smirnoff 
134*3b3a8eb9SGleb Smirnoff struct node_queue_bw {
135*3b3a8eb9SGleb Smirnoff 	u_int32_t	bw_absolute;
136*3b3a8eb9SGleb Smirnoff 	u_int16_t	bw_percent;
137*3b3a8eb9SGleb Smirnoff };
138*3b3a8eb9SGleb Smirnoff 
139*3b3a8eb9SGleb Smirnoff struct node_hfsc_sc {
140*3b3a8eb9SGleb Smirnoff 	struct node_queue_bw	m1;	/* slope of 1st segment; bps */
141*3b3a8eb9SGleb Smirnoff 	u_int			d;	/* x-projection of m1; msec */
142*3b3a8eb9SGleb Smirnoff 	struct node_queue_bw	m2;	/* slope of 2nd segment; bps */
143*3b3a8eb9SGleb Smirnoff 	u_int8_t		used;
144*3b3a8eb9SGleb Smirnoff };
145*3b3a8eb9SGleb Smirnoff 
146*3b3a8eb9SGleb Smirnoff struct node_hfsc_opts {
147*3b3a8eb9SGleb Smirnoff 	struct node_hfsc_sc	realtime;
148*3b3a8eb9SGleb Smirnoff 	struct node_hfsc_sc	linkshare;
149*3b3a8eb9SGleb Smirnoff 	struct node_hfsc_sc	upperlimit;
150*3b3a8eb9SGleb Smirnoff 	int			flags;
151*3b3a8eb9SGleb Smirnoff };
152*3b3a8eb9SGleb Smirnoff 
153*3b3a8eb9SGleb Smirnoff struct node_queue_opt {
154*3b3a8eb9SGleb Smirnoff 	int			 qtype;
155*3b3a8eb9SGleb Smirnoff 	union {
156*3b3a8eb9SGleb Smirnoff 		struct cbq_opts		cbq_opts;
157*3b3a8eb9SGleb Smirnoff 		struct priq_opts	priq_opts;
158*3b3a8eb9SGleb Smirnoff 		struct node_hfsc_opts	hfsc_opts;
159*3b3a8eb9SGleb Smirnoff 	}			 data;
160*3b3a8eb9SGleb Smirnoff };
161*3b3a8eb9SGleb Smirnoff 
162*3b3a8eb9SGleb Smirnoff #ifdef __FreeBSD__
163*3b3a8eb9SGleb Smirnoff /*
164*3b3a8eb9SGleb Smirnoff  * XXX
165*3b3a8eb9SGleb Smirnoff  * Absolutely this is not correct location to define this.
166*3b3a8eb9SGleb Smirnoff  * Should we use an another sperate header file?
167*3b3a8eb9SGleb Smirnoff  */
168*3b3a8eb9SGleb Smirnoff #define	SIMPLEQ_HEAD			STAILQ_HEAD
169*3b3a8eb9SGleb Smirnoff #define	SIMPLEQ_HEAD_INITIALIZER	STAILQ_HEAD_INITIALIZER
170*3b3a8eb9SGleb Smirnoff #define	SIMPLEQ_ENTRY			STAILQ_ENTRY
171*3b3a8eb9SGleb Smirnoff #define	SIMPLEQ_FIRST			STAILQ_FIRST
172*3b3a8eb9SGleb Smirnoff #define	SIMPLEQ_END(head)		NULL
173*3b3a8eb9SGleb Smirnoff #define	SIMPLEQ_EMPTY			STAILQ_EMPTY
174*3b3a8eb9SGleb Smirnoff #define	SIMPLEQ_NEXT			STAILQ_NEXT
175*3b3a8eb9SGleb Smirnoff /*#define	SIMPLEQ_FOREACH			STAILQ_FOREACH*/
176*3b3a8eb9SGleb Smirnoff #define	SIMPLEQ_FOREACH(var, head, field)		\
177*3b3a8eb9SGleb Smirnoff     for((var) = SIMPLEQ_FIRST(head);			\
178*3b3a8eb9SGleb Smirnoff 	(var) != SIMPLEQ_END(head);			\
179*3b3a8eb9SGleb Smirnoff 	(var) = SIMPLEQ_NEXT(var, field))
180*3b3a8eb9SGleb Smirnoff #define	SIMPLEQ_INIT			STAILQ_INIT
181*3b3a8eb9SGleb Smirnoff #define	SIMPLEQ_INSERT_HEAD		STAILQ_INSERT_HEAD
182*3b3a8eb9SGleb Smirnoff #define	SIMPLEQ_INSERT_TAIL		STAILQ_INSERT_TAIL
183*3b3a8eb9SGleb Smirnoff #define	SIMPLEQ_INSERT_AFTER		STAILQ_INSERT_AFTER
184*3b3a8eb9SGleb Smirnoff #define	SIMPLEQ_REMOVE_HEAD		STAILQ_REMOVE_HEAD
185*3b3a8eb9SGleb Smirnoff #endif
186*3b3a8eb9SGleb Smirnoff SIMPLEQ_HEAD(node_tinithead, node_tinit);
187*3b3a8eb9SGleb Smirnoff struct node_tinit {	/* table initializer */
188*3b3a8eb9SGleb Smirnoff 	SIMPLEQ_ENTRY(node_tinit)	 entries;
189*3b3a8eb9SGleb Smirnoff 	struct node_host		*host;
190*3b3a8eb9SGleb Smirnoff 	char				*file;
191*3b3a8eb9SGleb Smirnoff };
192*3b3a8eb9SGleb Smirnoff 
193*3b3a8eb9SGleb Smirnoff 
194*3b3a8eb9SGleb Smirnoff /* optimizer created tables */
195*3b3a8eb9SGleb Smirnoff struct pf_opt_tbl {
196*3b3a8eb9SGleb Smirnoff 	char			 pt_name[PF_TABLE_NAME_SIZE];
197*3b3a8eb9SGleb Smirnoff 	int			 pt_rulecount;
198*3b3a8eb9SGleb Smirnoff 	int			 pt_generated;
199*3b3a8eb9SGleb Smirnoff 	struct node_tinithead	 pt_nodes;
200*3b3a8eb9SGleb Smirnoff 	struct pfr_buffer	*pt_buf;
201*3b3a8eb9SGleb Smirnoff };
202*3b3a8eb9SGleb Smirnoff #define PF_OPT_TABLE_PREFIX	"__automatic_"
203*3b3a8eb9SGleb Smirnoff 
204*3b3a8eb9SGleb Smirnoff /* optimizer pf_rule container */
205*3b3a8eb9SGleb Smirnoff struct pf_opt_rule {
206*3b3a8eb9SGleb Smirnoff 	struct pf_rule		 por_rule;
207*3b3a8eb9SGleb Smirnoff 	struct pf_opt_tbl	*por_src_tbl;
208*3b3a8eb9SGleb Smirnoff 	struct pf_opt_tbl	*por_dst_tbl;
209*3b3a8eb9SGleb Smirnoff 	u_int64_t		 por_profile_count;
210*3b3a8eb9SGleb Smirnoff 	TAILQ_ENTRY(pf_opt_rule) por_entry;
211*3b3a8eb9SGleb Smirnoff 	TAILQ_ENTRY(pf_opt_rule) por_skip_entry[PF_SKIP_COUNT];
212*3b3a8eb9SGleb Smirnoff };
213*3b3a8eb9SGleb Smirnoff 
214*3b3a8eb9SGleb Smirnoff TAILQ_HEAD(pf_opt_queue, pf_opt_rule);
215*3b3a8eb9SGleb Smirnoff 
216*3b3a8eb9SGleb Smirnoff int	pfctl_rules(int, char *, int, int, char *, struct pfr_buffer *);
217*3b3a8eb9SGleb Smirnoff int	pfctl_optimize_ruleset(struct pfctl *, struct pf_ruleset *);
218*3b3a8eb9SGleb Smirnoff 
219*3b3a8eb9SGleb Smirnoff int	pfctl_add_rule(struct pfctl *, struct pf_rule *, const char *);
220*3b3a8eb9SGleb Smirnoff int	pfctl_add_altq(struct pfctl *, struct pf_altq *);
221*3b3a8eb9SGleb Smirnoff int	pfctl_add_pool(struct pfctl *, struct pf_pool *, sa_family_t);
222*3b3a8eb9SGleb Smirnoff void	pfctl_move_pool(struct pf_pool *, struct pf_pool *);
223*3b3a8eb9SGleb Smirnoff void	pfctl_clear_pool(struct pf_pool *);
224*3b3a8eb9SGleb Smirnoff 
225*3b3a8eb9SGleb Smirnoff int	pfctl_set_timeout(struct pfctl *, const char *, int, int);
226*3b3a8eb9SGleb Smirnoff int	pfctl_set_optimization(struct pfctl *, const char *);
227*3b3a8eb9SGleb Smirnoff int	pfctl_set_limit(struct pfctl *, const char *, unsigned int);
228*3b3a8eb9SGleb Smirnoff int	pfctl_set_logif(struct pfctl *, char *);
229*3b3a8eb9SGleb Smirnoff int	pfctl_set_hostid(struct pfctl *, u_int32_t);
230*3b3a8eb9SGleb Smirnoff int	pfctl_set_debug(struct pfctl *, char *);
231*3b3a8eb9SGleb Smirnoff int	pfctl_set_interface_flags(struct pfctl *, char *, int, int);
232*3b3a8eb9SGleb Smirnoff 
233*3b3a8eb9SGleb Smirnoff int	parse_config(char *, struct pfctl *);
234*3b3a8eb9SGleb Smirnoff int	parse_flags(char *);
235*3b3a8eb9SGleb Smirnoff int	pfctl_load_anchors(int, struct pfctl *, struct pfr_buffer *);
236*3b3a8eb9SGleb Smirnoff 
237*3b3a8eb9SGleb Smirnoff void	print_pool(struct pf_pool *, u_int16_t, u_int16_t, sa_family_t, int);
238*3b3a8eb9SGleb Smirnoff void	print_src_node(struct pf_src_node *, int);
239*3b3a8eb9SGleb Smirnoff void	print_rule(struct pf_rule *, const char *, int, int);
240*3b3a8eb9SGleb Smirnoff void	print_tabledef(const char *, int, int, struct node_tinithead *);
241*3b3a8eb9SGleb Smirnoff void	print_status(struct pf_status *, int);
242*3b3a8eb9SGleb Smirnoff 
243*3b3a8eb9SGleb Smirnoff int	eval_pfaltq(struct pfctl *, struct pf_altq *, struct node_queue_bw *,
244*3b3a8eb9SGleb Smirnoff 	    struct node_queue_opt *);
245*3b3a8eb9SGleb Smirnoff int	eval_pfqueue(struct pfctl *, struct pf_altq *, struct node_queue_bw *,
246*3b3a8eb9SGleb Smirnoff 	    struct node_queue_opt *);
247*3b3a8eb9SGleb Smirnoff 
248*3b3a8eb9SGleb Smirnoff void	 print_altq(const struct pf_altq *, unsigned, struct node_queue_bw *,
249*3b3a8eb9SGleb Smirnoff 	    struct node_queue_opt *);
250*3b3a8eb9SGleb Smirnoff void	 print_queue(const struct pf_altq *, unsigned, struct node_queue_bw *,
251*3b3a8eb9SGleb Smirnoff 	    int, struct node_queue_opt *);
252*3b3a8eb9SGleb Smirnoff 
253*3b3a8eb9SGleb Smirnoff int	pfctl_define_table(char *, int, int, const char *, struct pfr_buffer *,
254*3b3a8eb9SGleb Smirnoff 	    u_int32_t);
255*3b3a8eb9SGleb Smirnoff 
256*3b3a8eb9SGleb Smirnoff void		 pfctl_clear_fingerprints(int, int);
257*3b3a8eb9SGleb Smirnoff int		 pfctl_file_fingerprints(int, int, const char *);
258*3b3a8eb9SGleb Smirnoff pf_osfp_t	 pfctl_get_fingerprint(const char *);
259*3b3a8eb9SGleb Smirnoff int		 pfctl_load_fingerprints(int, int);
260*3b3a8eb9SGleb Smirnoff char		*pfctl_lookup_fingerprint(pf_osfp_t, char *, size_t);
261*3b3a8eb9SGleb Smirnoff void		 pfctl_show_fingerprints(int);
262*3b3a8eb9SGleb Smirnoff 
263*3b3a8eb9SGleb Smirnoff 
264*3b3a8eb9SGleb Smirnoff struct icmptypeent {
265*3b3a8eb9SGleb Smirnoff 	const char *name;
266*3b3a8eb9SGleb Smirnoff 	u_int8_t type;
267*3b3a8eb9SGleb Smirnoff };
268*3b3a8eb9SGleb Smirnoff 
269*3b3a8eb9SGleb Smirnoff struct icmpcodeent {
270*3b3a8eb9SGleb Smirnoff 	const char *name;
271*3b3a8eb9SGleb Smirnoff 	u_int8_t type;
272*3b3a8eb9SGleb Smirnoff 	u_int8_t code;
273*3b3a8eb9SGleb Smirnoff };
274*3b3a8eb9SGleb Smirnoff 
275*3b3a8eb9SGleb Smirnoff const struct icmptypeent *geticmptypebynumber(u_int8_t, u_int8_t);
276*3b3a8eb9SGleb Smirnoff const struct icmptypeent *geticmptypebyname(char *, u_int8_t);
277*3b3a8eb9SGleb Smirnoff const struct icmpcodeent *geticmpcodebynumber(u_int8_t, u_int8_t, u_int8_t);
278*3b3a8eb9SGleb Smirnoff const struct icmpcodeent *geticmpcodebyname(u_long, char *, u_int8_t);
279*3b3a8eb9SGleb Smirnoff 
280*3b3a8eb9SGleb Smirnoff struct pf_timeout {
281*3b3a8eb9SGleb Smirnoff 	const char	*name;
282*3b3a8eb9SGleb Smirnoff 	int		 timeout;
283*3b3a8eb9SGleb Smirnoff };
284*3b3a8eb9SGleb Smirnoff 
285*3b3a8eb9SGleb Smirnoff #define PFCTL_FLAG_FILTER	0x02
286*3b3a8eb9SGleb Smirnoff #define PFCTL_FLAG_NAT		0x04
287*3b3a8eb9SGleb Smirnoff #define PFCTL_FLAG_OPTION	0x08
288*3b3a8eb9SGleb Smirnoff #define PFCTL_FLAG_ALTQ		0x10
289*3b3a8eb9SGleb Smirnoff #define PFCTL_FLAG_TABLE	0x20
290*3b3a8eb9SGleb Smirnoff 
291*3b3a8eb9SGleb Smirnoff extern const struct pf_timeout pf_timeouts[];
292*3b3a8eb9SGleb Smirnoff 
293*3b3a8eb9SGleb Smirnoff void			 set_ipmask(struct node_host *, u_int8_t);
294*3b3a8eb9SGleb Smirnoff int			 check_netmask(struct node_host *, sa_family_t);
295*3b3a8eb9SGleb Smirnoff int			 unmask(struct pf_addr *, sa_family_t);
296*3b3a8eb9SGleb Smirnoff void			 ifa_load(void);
297*3b3a8eb9SGleb Smirnoff struct node_host	*ifa_exists(const char *);
298*3b3a8eb9SGleb Smirnoff struct node_host	*ifa_lookup(const char *, int);
299*3b3a8eb9SGleb Smirnoff struct node_host	*host(const char *);
300*3b3a8eb9SGleb Smirnoff 
301*3b3a8eb9SGleb Smirnoff int			 append_addr(struct pfr_buffer *, char *, int);
302*3b3a8eb9SGleb Smirnoff int			 append_addr_host(struct pfr_buffer *,
303*3b3a8eb9SGleb Smirnoff 			    struct node_host *, int, int);
304*3b3a8eb9SGleb Smirnoff 
305*3b3a8eb9SGleb Smirnoff #endif /* _PFCTL_PARSER_H_ */
306