13b3a8eb9SGleb Smirnoff /* $OpenBSD: pfctl_parser.h,v 1.86 2006/10/31 23:46:25 mcbride Exp $ */ 23b3a8eb9SGleb Smirnoff 33b3a8eb9SGleb Smirnoff /* 43b3a8eb9SGleb Smirnoff * Copyright (c) 2001 Daniel Hartmeier 53b3a8eb9SGleb Smirnoff * All rights reserved. 63b3a8eb9SGleb Smirnoff * 73b3a8eb9SGleb Smirnoff * Redistribution and use in source and binary forms, with or without 83b3a8eb9SGleb Smirnoff * modification, are permitted provided that the following conditions 93b3a8eb9SGleb Smirnoff * are met: 103b3a8eb9SGleb Smirnoff * 113b3a8eb9SGleb Smirnoff * - Redistributions of source code must retain the above copyright 123b3a8eb9SGleb Smirnoff * notice, this list of conditions and the following disclaimer. 133b3a8eb9SGleb Smirnoff * - Redistributions in binary form must reproduce the above 143b3a8eb9SGleb Smirnoff * copyright notice, this list of conditions and the following 153b3a8eb9SGleb Smirnoff * disclaimer in the documentation and/or other materials provided 163b3a8eb9SGleb Smirnoff * with the distribution. 173b3a8eb9SGleb Smirnoff * 183b3a8eb9SGleb Smirnoff * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 193b3a8eb9SGleb Smirnoff * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 203b3a8eb9SGleb Smirnoff * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 213b3a8eb9SGleb Smirnoff * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 223b3a8eb9SGleb Smirnoff * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 233b3a8eb9SGleb Smirnoff * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 243b3a8eb9SGleb Smirnoff * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 253b3a8eb9SGleb Smirnoff * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 263b3a8eb9SGleb Smirnoff * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 273b3a8eb9SGleb Smirnoff * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 283b3a8eb9SGleb Smirnoff * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 293b3a8eb9SGleb Smirnoff * POSSIBILITY OF SUCH DAMAGE. 303b3a8eb9SGleb Smirnoff * 313b3a8eb9SGleb Smirnoff * $FreeBSD$ 323b3a8eb9SGleb Smirnoff */ 333b3a8eb9SGleb Smirnoff 343b3a8eb9SGleb Smirnoff #ifndef _PFCTL_PARSER_H_ 353b3a8eb9SGleb Smirnoff #define _PFCTL_PARSER_H_ 363b3a8eb9SGleb Smirnoff 373b3a8eb9SGleb Smirnoff #define PF_OSFP_FILE "/etc/pf.os" 383b3a8eb9SGleb Smirnoff 393b3a8eb9SGleb Smirnoff #define PF_OPT_DISABLE 0x0001 403b3a8eb9SGleb Smirnoff #define PF_OPT_ENABLE 0x0002 413b3a8eb9SGleb Smirnoff #define PF_OPT_VERBOSE 0x0004 423b3a8eb9SGleb Smirnoff #define PF_OPT_NOACTION 0x0008 433b3a8eb9SGleb Smirnoff #define PF_OPT_QUIET 0x0010 443b3a8eb9SGleb Smirnoff #define PF_OPT_CLRRULECTRS 0x0020 453b3a8eb9SGleb Smirnoff #define PF_OPT_USEDNS 0x0040 463b3a8eb9SGleb Smirnoff #define PF_OPT_VERBOSE2 0x0080 473b3a8eb9SGleb Smirnoff #define PF_OPT_DUMMYACTION 0x0100 483b3a8eb9SGleb Smirnoff #define PF_OPT_DEBUG 0x0200 493b3a8eb9SGleb Smirnoff #define PF_OPT_SHOWALL 0x0400 503b3a8eb9SGleb Smirnoff #define PF_OPT_OPTIMIZE 0x0800 513b3a8eb9SGleb Smirnoff #define PF_OPT_NUMERIC 0x1000 523b3a8eb9SGleb Smirnoff #define PF_OPT_MERGE 0x2000 533b3a8eb9SGleb Smirnoff #define PF_OPT_RECURSE 0x4000 543b3a8eb9SGleb Smirnoff 553b3a8eb9SGleb Smirnoff #define PF_TH_ALL 0xFF 563b3a8eb9SGleb Smirnoff 573b3a8eb9SGleb Smirnoff #define PF_NAT_PROXY_PORT_LOW 50001 583b3a8eb9SGleb Smirnoff #define PF_NAT_PROXY_PORT_HIGH 65535 593b3a8eb9SGleb Smirnoff 603b3a8eb9SGleb Smirnoff #define PF_OPTIMIZE_BASIC 0x0001 613b3a8eb9SGleb Smirnoff #define PF_OPTIMIZE_PROFILE 0x0002 623b3a8eb9SGleb Smirnoff 633b3a8eb9SGleb Smirnoff #define FCNT_NAMES { \ 643b3a8eb9SGleb Smirnoff "searches", \ 653b3a8eb9SGleb Smirnoff "inserts", \ 663b3a8eb9SGleb Smirnoff "removals", \ 673b3a8eb9SGleb Smirnoff NULL \ 683b3a8eb9SGleb Smirnoff } 693b3a8eb9SGleb Smirnoff 703b3a8eb9SGleb Smirnoff struct pfr_buffer; /* forward definition */ 713b3a8eb9SGleb Smirnoff 723b3a8eb9SGleb Smirnoff 733b3a8eb9SGleb Smirnoff struct pfctl { 743b3a8eb9SGleb Smirnoff int dev; 753b3a8eb9SGleb Smirnoff int opts; 763b3a8eb9SGleb Smirnoff int optimize; 773b3a8eb9SGleb Smirnoff int loadopt; 783b3a8eb9SGleb Smirnoff int asd; /* anchor stack depth */ 793b3a8eb9SGleb Smirnoff int bn; /* brace number */ 803b3a8eb9SGleb Smirnoff int brace; 813b3a8eb9SGleb Smirnoff int tdirty; /* kernel dirty */ 823b3a8eb9SGleb Smirnoff #define PFCTL_ANCHOR_STACK_DEPTH 64 833b3a8eb9SGleb Smirnoff struct pf_anchor *astack[PFCTL_ANCHOR_STACK_DEPTH]; 843b3a8eb9SGleb Smirnoff struct pfioc_pooladdr paddr; 853b3a8eb9SGleb Smirnoff struct pfioc_altq *paltq; 863b3a8eb9SGleb Smirnoff struct pfioc_queue *pqueue; 873b3a8eb9SGleb Smirnoff struct pfr_buffer *trans; 883b3a8eb9SGleb Smirnoff struct pf_anchor *anchor, *alast; 893b3a8eb9SGleb Smirnoff const char *ruleset; 903b3a8eb9SGleb Smirnoff 913b3a8eb9SGleb Smirnoff /* 'set foo' options */ 923b3a8eb9SGleb Smirnoff u_int32_t timeout[PFTM_MAX]; 933b3a8eb9SGleb Smirnoff u_int32_t limit[PF_LIMIT_MAX]; 943b3a8eb9SGleb Smirnoff u_int32_t debug; 953b3a8eb9SGleb Smirnoff u_int32_t hostid; 963b3a8eb9SGleb Smirnoff char *ifname; 973b3a8eb9SGleb Smirnoff 983b3a8eb9SGleb Smirnoff u_int8_t timeout_set[PFTM_MAX]; 993b3a8eb9SGleb Smirnoff u_int8_t limit_set[PF_LIMIT_MAX]; 1003b3a8eb9SGleb Smirnoff u_int8_t debug_set; 1013b3a8eb9SGleb Smirnoff u_int8_t hostid_set; 1023b3a8eb9SGleb Smirnoff u_int8_t ifname_set; 1033b3a8eb9SGleb Smirnoff }; 1043b3a8eb9SGleb Smirnoff 1053b3a8eb9SGleb Smirnoff struct node_if { 1063b3a8eb9SGleb Smirnoff char ifname[IFNAMSIZ]; 1073b3a8eb9SGleb Smirnoff u_int8_t not; 1083b3a8eb9SGleb Smirnoff u_int8_t dynamic; /* antispoof */ 1093b3a8eb9SGleb Smirnoff u_int ifa_flags; 1103b3a8eb9SGleb Smirnoff struct node_if *next; 1113b3a8eb9SGleb Smirnoff struct node_if *tail; 1123b3a8eb9SGleb Smirnoff }; 1133b3a8eb9SGleb Smirnoff 1143b3a8eb9SGleb Smirnoff struct node_host { 1153b3a8eb9SGleb Smirnoff struct pf_addr_wrap addr; 1163b3a8eb9SGleb Smirnoff struct pf_addr bcast; 1173b3a8eb9SGleb Smirnoff struct pf_addr peer; 1183b3a8eb9SGleb Smirnoff sa_family_t af; 1193b3a8eb9SGleb Smirnoff u_int8_t not; 1203b3a8eb9SGleb Smirnoff u_int32_t ifindex; /* link-local IPv6 addrs */ 1213b3a8eb9SGleb Smirnoff char *ifname; 1223b3a8eb9SGleb Smirnoff u_int ifa_flags; 1233b3a8eb9SGleb Smirnoff struct node_host *next; 1243b3a8eb9SGleb Smirnoff struct node_host *tail; 1253b3a8eb9SGleb Smirnoff }; 1263b3a8eb9SGleb Smirnoff 1273b3a8eb9SGleb Smirnoff struct node_os { 1283b3a8eb9SGleb Smirnoff char *os; 1293b3a8eb9SGleb Smirnoff pf_osfp_t fingerprint; 1303b3a8eb9SGleb Smirnoff struct node_os *next; 1313b3a8eb9SGleb Smirnoff struct node_os *tail; 1323b3a8eb9SGleb Smirnoff }; 1333b3a8eb9SGleb Smirnoff 1343b3a8eb9SGleb Smirnoff struct node_queue_bw { 1353b3a8eb9SGleb Smirnoff u_int32_t bw_absolute; 1363b3a8eb9SGleb Smirnoff u_int16_t bw_percent; 1373b3a8eb9SGleb Smirnoff }; 1383b3a8eb9SGleb Smirnoff 1393b3a8eb9SGleb Smirnoff struct node_hfsc_sc { 1403b3a8eb9SGleb Smirnoff struct node_queue_bw m1; /* slope of 1st segment; bps */ 1413b3a8eb9SGleb Smirnoff u_int d; /* x-projection of m1; msec */ 1423b3a8eb9SGleb Smirnoff struct node_queue_bw m2; /* slope of 2nd segment; bps */ 1433b3a8eb9SGleb Smirnoff u_int8_t used; 1443b3a8eb9SGleb Smirnoff }; 1453b3a8eb9SGleb Smirnoff 1463b3a8eb9SGleb Smirnoff struct node_hfsc_opts { 1473b3a8eb9SGleb Smirnoff struct node_hfsc_sc realtime; 1483b3a8eb9SGleb Smirnoff struct node_hfsc_sc linkshare; 1493b3a8eb9SGleb Smirnoff struct node_hfsc_sc upperlimit; 1503b3a8eb9SGleb Smirnoff int flags; 1513b3a8eb9SGleb Smirnoff }; 1523b3a8eb9SGleb Smirnoff 153*a5b789f6SErmal Luçi struct node_fairq_sc { 154*a5b789f6SErmal Luçi struct node_queue_bw m1; /* slope of 1st segment; bps */ 155*a5b789f6SErmal Luçi u_int d; /* x-projection of m1; msec */ 156*a5b789f6SErmal Luçi struct node_queue_bw m2; /* slope of 2nd segment; bps */ 157*a5b789f6SErmal Luçi u_int8_t used; 158*a5b789f6SErmal Luçi }; 159*a5b789f6SErmal Luçi 160*a5b789f6SErmal Luçi struct node_fairq_opts { 161*a5b789f6SErmal Luçi struct node_fairq_sc linkshare; 162*a5b789f6SErmal Luçi struct node_queue_bw hogs_bw; 163*a5b789f6SErmal Luçi u_int nbuckets; 164*a5b789f6SErmal Luçi int flags; 165*a5b789f6SErmal Luçi }; 166*a5b789f6SErmal Luçi 1673b3a8eb9SGleb Smirnoff struct node_queue_opt { 1683b3a8eb9SGleb Smirnoff int qtype; 1693b3a8eb9SGleb Smirnoff union { 1703b3a8eb9SGleb Smirnoff struct cbq_opts cbq_opts; 1713b3a8eb9SGleb Smirnoff struct priq_opts priq_opts; 1723b3a8eb9SGleb Smirnoff struct node_hfsc_opts hfsc_opts; 173*a5b789f6SErmal Luçi struct node_fairq_opts fairq_opts; 1743b3a8eb9SGleb Smirnoff } data; 1753b3a8eb9SGleb Smirnoff }; 1763b3a8eb9SGleb Smirnoff 1773b3a8eb9SGleb Smirnoff #ifdef __FreeBSD__ 1783b3a8eb9SGleb Smirnoff /* 1793b3a8eb9SGleb Smirnoff * XXX 1803b3a8eb9SGleb Smirnoff * Absolutely this is not correct location to define this. 1813b3a8eb9SGleb Smirnoff * Should we use an another sperate header file? 1823b3a8eb9SGleb Smirnoff */ 1833b3a8eb9SGleb Smirnoff #define SIMPLEQ_HEAD STAILQ_HEAD 1843b3a8eb9SGleb Smirnoff #define SIMPLEQ_HEAD_INITIALIZER STAILQ_HEAD_INITIALIZER 1853b3a8eb9SGleb Smirnoff #define SIMPLEQ_ENTRY STAILQ_ENTRY 1863b3a8eb9SGleb Smirnoff #define SIMPLEQ_FIRST STAILQ_FIRST 1873b3a8eb9SGleb Smirnoff #define SIMPLEQ_END(head) NULL 1883b3a8eb9SGleb Smirnoff #define SIMPLEQ_EMPTY STAILQ_EMPTY 1893b3a8eb9SGleb Smirnoff #define SIMPLEQ_NEXT STAILQ_NEXT 1903b3a8eb9SGleb Smirnoff /*#define SIMPLEQ_FOREACH STAILQ_FOREACH*/ 1913b3a8eb9SGleb Smirnoff #define SIMPLEQ_FOREACH(var, head, field) \ 1923b3a8eb9SGleb Smirnoff for((var) = SIMPLEQ_FIRST(head); \ 1933b3a8eb9SGleb Smirnoff (var) != SIMPLEQ_END(head); \ 1943b3a8eb9SGleb Smirnoff (var) = SIMPLEQ_NEXT(var, field)) 1953b3a8eb9SGleb Smirnoff #define SIMPLEQ_INIT STAILQ_INIT 1963b3a8eb9SGleb Smirnoff #define SIMPLEQ_INSERT_HEAD STAILQ_INSERT_HEAD 1973b3a8eb9SGleb Smirnoff #define SIMPLEQ_INSERT_TAIL STAILQ_INSERT_TAIL 1983b3a8eb9SGleb Smirnoff #define SIMPLEQ_INSERT_AFTER STAILQ_INSERT_AFTER 1993b3a8eb9SGleb Smirnoff #define SIMPLEQ_REMOVE_HEAD STAILQ_REMOVE_HEAD 2003b3a8eb9SGleb Smirnoff #endif 2013b3a8eb9SGleb Smirnoff SIMPLEQ_HEAD(node_tinithead, node_tinit); 2023b3a8eb9SGleb Smirnoff struct node_tinit { /* table initializer */ 2033b3a8eb9SGleb Smirnoff SIMPLEQ_ENTRY(node_tinit) entries; 2043b3a8eb9SGleb Smirnoff struct node_host *host; 2053b3a8eb9SGleb Smirnoff char *file; 2063b3a8eb9SGleb Smirnoff }; 2073b3a8eb9SGleb Smirnoff 2083b3a8eb9SGleb Smirnoff 2093b3a8eb9SGleb Smirnoff /* optimizer created tables */ 2103b3a8eb9SGleb Smirnoff struct pf_opt_tbl { 2113b3a8eb9SGleb Smirnoff char pt_name[PF_TABLE_NAME_SIZE]; 2123b3a8eb9SGleb Smirnoff int pt_rulecount; 2133b3a8eb9SGleb Smirnoff int pt_generated; 2143b3a8eb9SGleb Smirnoff struct node_tinithead pt_nodes; 2153b3a8eb9SGleb Smirnoff struct pfr_buffer *pt_buf; 2163b3a8eb9SGleb Smirnoff }; 2173b3a8eb9SGleb Smirnoff #define PF_OPT_TABLE_PREFIX "__automatic_" 2183b3a8eb9SGleb Smirnoff 2193b3a8eb9SGleb Smirnoff /* optimizer pf_rule container */ 2203b3a8eb9SGleb Smirnoff struct pf_opt_rule { 2213b3a8eb9SGleb Smirnoff struct pf_rule por_rule; 2223b3a8eb9SGleb Smirnoff struct pf_opt_tbl *por_src_tbl; 2233b3a8eb9SGleb Smirnoff struct pf_opt_tbl *por_dst_tbl; 2243b3a8eb9SGleb Smirnoff u_int64_t por_profile_count; 2253b3a8eb9SGleb Smirnoff TAILQ_ENTRY(pf_opt_rule) por_entry; 2263b3a8eb9SGleb Smirnoff TAILQ_ENTRY(pf_opt_rule) por_skip_entry[PF_SKIP_COUNT]; 2273b3a8eb9SGleb Smirnoff }; 2283b3a8eb9SGleb Smirnoff 2293b3a8eb9SGleb Smirnoff TAILQ_HEAD(pf_opt_queue, pf_opt_rule); 2303b3a8eb9SGleb Smirnoff 2313b3a8eb9SGleb Smirnoff int pfctl_rules(int, char *, int, int, char *, struct pfr_buffer *); 2323b3a8eb9SGleb Smirnoff int pfctl_optimize_ruleset(struct pfctl *, struct pf_ruleset *); 2333b3a8eb9SGleb Smirnoff 2343b3a8eb9SGleb Smirnoff int pfctl_add_rule(struct pfctl *, struct pf_rule *, const char *); 2353b3a8eb9SGleb Smirnoff int pfctl_add_altq(struct pfctl *, struct pf_altq *); 2363b3a8eb9SGleb Smirnoff int pfctl_add_pool(struct pfctl *, struct pf_pool *, sa_family_t); 2373b3a8eb9SGleb Smirnoff void pfctl_move_pool(struct pf_pool *, struct pf_pool *); 2383b3a8eb9SGleb Smirnoff void pfctl_clear_pool(struct pf_pool *); 2393b3a8eb9SGleb Smirnoff 2403b3a8eb9SGleb Smirnoff int pfctl_set_timeout(struct pfctl *, const char *, int, int); 2413b3a8eb9SGleb Smirnoff int pfctl_set_optimization(struct pfctl *, const char *); 2423b3a8eb9SGleb Smirnoff int pfctl_set_limit(struct pfctl *, const char *, unsigned int); 2433b3a8eb9SGleb Smirnoff int pfctl_set_logif(struct pfctl *, char *); 2443b3a8eb9SGleb Smirnoff int pfctl_set_hostid(struct pfctl *, u_int32_t); 2453b3a8eb9SGleb Smirnoff int pfctl_set_debug(struct pfctl *, char *); 2463b3a8eb9SGleb Smirnoff int pfctl_set_interface_flags(struct pfctl *, char *, int, int); 2473b3a8eb9SGleb Smirnoff 2483b3a8eb9SGleb Smirnoff int parse_config(char *, struct pfctl *); 2493b3a8eb9SGleb Smirnoff int parse_flags(char *); 2503b3a8eb9SGleb Smirnoff int pfctl_load_anchors(int, struct pfctl *, struct pfr_buffer *); 2513b3a8eb9SGleb Smirnoff 2523b3a8eb9SGleb Smirnoff void print_pool(struct pf_pool *, u_int16_t, u_int16_t, sa_family_t, int); 2533b3a8eb9SGleb Smirnoff void print_src_node(struct pf_src_node *, int); 2543b3a8eb9SGleb Smirnoff void print_rule(struct pf_rule *, const char *, int, int); 2553b3a8eb9SGleb Smirnoff void print_tabledef(const char *, int, int, struct node_tinithead *); 2563b3a8eb9SGleb Smirnoff void print_status(struct pf_status *, int); 2573b3a8eb9SGleb Smirnoff 2583b3a8eb9SGleb Smirnoff int eval_pfaltq(struct pfctl *, struct pf_altq *, struct node_queue_bw *, 2593b3a8eb9SGleb Smirnoff struct node_queue_opt *); 2603b3a8eb9SGleb Smirnoff int eval_pfqueue(struct pfctl *, struct pf_altq *, struct node_queue_bw *, 2613b3a8eb9SGleb Smirnoff struct node_queue_opt *); 2623b3a8eb9SGleb Smirnoff 2633b3a8eb9SGleb Smirnoff void print_altq(const struct pf_altq *, unsigned, struct node_queue_bw *, 2643b3a8eb9SGleb Smirnoff struct node_queue_opt *); 2653b3a8eb9SGleb Smirnoff void print_queue(const struct pf_altq *, unsigned, struct node_queue_bw *, 2663b3a8eb9SGleb Smirnoff int, struct node_queue_opt *); 2673b3a8eb9SGleb Smirnoff 2683b3a8eb9SGleb Smirnoff int pfctl_define_table(char *, int, int, const char *, struct pfr_buffer *, 2693b3a8eb9SGleb Smirnoff u_int32_t); 2703b3a8eb9SGleb Smirnoff 2713b3a8eb9SGleb Smirnoff void pfctl_clear_fingerprints(int, int); 2723b3a8eb9SGleb Smirnoff int pfctl_file_fingerprints(int, int, const char *); 2733b3a8eb9SGleb Smirnoff pf_osfp_t pfctl_get_fingerprint(const char *); 2743b3a8eb9SGleb Smirnoff int pfctl_load_fingerprints(int, int); 2753b3a8eb9SGleb Smirnoff char *pfctl_lookup_fingerprint(pf_osfp_t, char *, size_t); 2763b3a8eb9SGleb Smirnoff void pfctl_show_fingerprints(int); 2773b3a8eb9SGleb Smirnoff 2783b3a8eb9SGleb Smirnoff 2793b3a8eb9SGleb Smirnoff struct icmptypeent { 2803b3a8eb9SGleb Smirnoff const char *name; 2813b3a8eb9SGleb Smirnoff u_int8_t type; 2823b3a8eb9SGleb Smirnoff }; 2833b3a8eb9SGleb Smirnoff 2843b3a8eb9SGleb Smirnoff struct icmpcodeent { 2853b3a8eb9SGleb Smirnoff const char *name; 2863b3a8eb9SGleb Smirnoff u_int8_t type; 2873b3a8eb9SGleb Smirnoff u_int8_t code; 2883b3a8eb9SGleb Smirnoff }; 2893b3a8eb9SGleb Smirnoff 2903b3a8eb9SGleb Smirnoff const struct icmptypeent *geticmptypebynumber(u_int8_t, u_int8_t); 2913b3a8eb9SGleb Smirnoff const struct icmptypeent *geticmptypebyname(char *, u_int8_t); 2923b3a8eb9SGleb Smirnoff const struct icmpcodeent *geticmpcodebynumber(u_int8_t, u_int8_t, u_int8_t); 2933b3a8eb9SGleb Smirnoff const struct icmpcodeent *geticmpcodebyname(u_long, char *, u_int8_t); 2943b3a8eb9SGleb Smirnoff 2953b3a8eb9SGleb Smirnoff struct pf_timeout { 2963b3a8eb9SGleb Smirnoff const char *name; 2973b3a8eb9SGleb Smirnoff int timeout; 2983b3a8eb9SGleb Smirnoff }; 2993b3a8eb9SGleb Smirnoff 3003b3a8eb9SGleb Smirnoff #define PFCTL_FLAG_FILTER 0x02 3013b3a8eb9SGleb Smirnoff #define PFCTL_FLAG_NAT 0x04 3023b3a8eb9SGleb Smirnoff #define PFCTL_FLAG_OPTION 0x08 3033b3a8eb9SGleb Smirnoff #define PFCTL_FLAG_ALTQ 0x10 3043b3a8eb9SGleb Smirnoff #define PFCTL_FLAG_TABLE 0x20 3053b3a8eb9SGleb Smirnoff 3063b3a8eb9SGleb Smirnoff extern const struct pf_timeout pf_timeouts[]; 3073b3a8eb9SGleb Smirnoff 3083b3a8eb9SGleb Smirnoff void set_ipmask(struct node_host *, u_int8_t); 3093b3a8eb9SGleb Smirnoff int check_netmask(struct node_host *, sa_family_t); 3103b3a8eb9SGleb Smirnoff int unmask(struct pf_addr *, sa_family_t); 3113b3a8eb9SGleb Smirnoff void ifa_load(void); 312f870cb7fSBjoern A. Zeeb int get_socket_domain(void); 3133b3a8eb9SGleb Smirnoff struct node_host *ifa_exists(const char *); 3143b3a8eb9SGleb Smirnoff struct node_host *ifa_lookup(const char *, int); 3153b3a8eb9SGleb Smirnoff struct node_host *host(const char *); 3163b3a8eb9SGleb Smirnoff 3173b3a8eb9SGleb Smirnoff int append_addr(struct pfr_buffer *, char *, int); 3183b3a8eb9SGleb Smirnoff int append_addr_host(struct pfr_buffer *, 3193b3a8eb9SGleb Smirnoff struct node_host *, int, int); 3203b3a8eb9SGleb Smirnoff 3213b3a8eb9SGleb Smirnoff #endif /* _PFCTL_PARSER_H_ */ 322