pfctl.h revision 1.4 1 1.3 yamt /* $NetBSD: pfctl.h,v 1.4 2005/07/01 12:43:50 peter Exp $ */
2 1.4 peter /* $OpenBSD: pfctl.h,v 1.37 2005/01/05 18:23:10 mcbride Exp $ */
3 1.1 itojun
4 1.1 itojun /*
5 1.1 itojun * Copyright (c) 2001 Daniel Hartmeier
6 1.1 itojun * All rights reserved.
7 1.1 itojun *
8 1.1 itojun * Redistribution and use in source and binary forms, with or without
9 1.1 itojun * modification, are permitted provided that the following conditions
10 1.1 itojun * are met:
11 1.1 itojun *
12 1.1 itojun * - Redistributions of source code must retain the above copyright
13 1.1 itojun * notice, this list of conditions and the following disclaimer.
14 1.1 itojun * - Redistributions in binary form must reproduce the above
15 1.1 itojun * copyright notice, this list of conditions and the following
16 1.1 itojun * disclaimer in the documentation and/or other materials provided
17 1.1 itojun * with the distribution.
18 1.1 itojun *
19 1.1 itojun * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 1.1 itojun * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 1.1 itojun * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
22 1.1 itojun * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23 1.1 itojun * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
24 1.1 itojun * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 1.1 itojun * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26 1.1 itojun * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27 1.1 itojun * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 1.1 itojun * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
29 1.1 itojun * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 1.1 itojun * POSSIBILITY OF SUCH DAMAGE.
31 1.1 itojun *
32 1.1 itojun */
33 1.1 itojun
34 1.1 itojun #ifndef _PFCTL_H_
35 1.1 itojun #define _PFCTL_H_
36 1.1 itojun
37 1.1 itojun enum { PFRB_TABLES = 1, PFRB_TSTATS, PFRB_ADDRS, PFRB_ASTATS,
38 1.1 itojun PFRB_IFACES, PFRB_TRANS, PFRB_MAX };
39 1.1 itojun struct pfr_buffer {
40 1.1 itojun int pfrb_type; /* type of content, see enum above */
41 1.1 itojun int pfrb_size; /* number of objects in buffer */
42 1.1 itojun int pfrb_msize; /* maximum number of objects in buffer */
43 1.1 itojun void *pfrb_caddr; /* malloc'ated memory area */
44 1.1 itojun };
45 1.1 itojun #define PFRB_FOREACH(var, buf) \
46 1.1 itojun for ((var) = pfr_buf_next((buf), NULL); \
47 1.1 itojun (var) != NULL; \
48 1.1 itojun (var) = pfr_buf_next((buf), (var)))
49 1.1 itojun
50 1.1 itojun void pfr_set_fd(int);
51 1.1 itojun int pfr_get_fd(void);
52 1.1 itojun int pfr_clr_tables(struct pfr_table *, int *, int);
53 1.1 itojun int pfr_add_tables(struct pfr_table *, int, int *, int);
54 1.1 itojun int pfr_del_tables(struct pfr_table *, int, int *, int);
55 1.1 itojun int pfr_get_tables(struct pfr_table *, struct pfr_table *, int *, int);
56 1.1 itojun int pfr_get_tstats(struct pfr_table *, struct pfr_tstats *, int *, int);
57 1.1 itojun int pfr_clr_tstats(struct pfr_table *, int, int *, int);
58 1.1 itojun int pfr_clr_addrs(struct pfr_table *, int *, int);
59 1.1 itojun int pfr_add_addrs(struct pfr_table *, struct pfr_addr *, int, int *, int);
60 1.1 itojun int pfr_del_addrs(struct pfr_table *, struct pfr_addr *, int, int *, int);
61 1.1 itojun int pfr_set_addrs(struct pfr_table *, struct pfr_addr *, int, int *,
62 1.1 itojun int *, int *, int *, int);
63 1.1 itojun int pfr_get_addrs(struct pfr_table *, struct pfr_addr *, int *, int);
64 1.1 itojun int pfr_get_astats(struct pfr_table *, struct pfr_astats *, int *, int);
65 1.1 itojun int pfr_clr_astats(struct pfr_table *, struct pfr_addr *, int, int *, int);
66 1.1 itojun int pfr_tst_addrs(struct pfr_table *, struct pfr_addr *, int, int *, int);
67 1.1 itojun int pfr_set_tflags(struct pfr_table *, int, int, int, int *, int *, int);
68 1.1 itojun int pfr_ina_define(struct pfr_table *, struct pfr_addr *, int, int *,
69 1.1 itojun int *, int, int);
70 1.1 itojun void pfr_buf_clear(struct pfr_buffer *);
71 1.1 itojun int pfr_buf_add(struct pfr_buffer *, const void *);
72 1.1 itojun void *pfr_buf_next(struct pfr_buffer *, const void *);
73 1.1 itojun int pfr_buf_grow(struct pfr_buffer *, int);
74 1.1 itojun int pfr_buf_load(struct pfr_buffer *, char *, int,
75 1.1 itojun int (*)(struct pfr_buffer *, char *, int));
76 1.1 itojun char *pfr_strerror(int);
77 1.1 itojun int pfi_get_ifaces(const char *, struct pfi_if *, int *, int);
78 1.1 itojun int pfi_clr_istats(const char *, int *, int);
79 1.1 itojun
80 1.1 itojun void pfctl_print_title(char *);
81 1.3 yamt int pfctl_clear_tables(const char *, int);
82 1.3 yamt int pfctl_show_tables(const char *, int);
83 1.1 itojun int pfctl_command_tables(int, char *[], char *, const char *, char *,
84 1.3 yamt const char *, int);
85 1.1 itojun int pfctl_show_altq(int, const char *, int, int);
86 1.1 itojun void warn_namespace_collision(const char *);
87 1.1 itojun int pfctl_show_ifaces(const char *, int);
88 1.3 yamt FILE *pfctl_fopen(const char *, const char *);
89 1.1 itojun
90 1.1 itojun #ifndef DEFAULT_PRIORITY
91 1.1 itojun #define DEFAULT_PRIORITY 1
92 1.1 itojun #endif
93 1.1 itojun
94 1.1 itojun #ifndef DEFAULT_QLIMIT
95 1.1 itojun #define DEFAULT_QLIMIT 50
96 1.1 itojun #endif
97 1.1 itojun
98 1.1 itojun /*
99 1.1 itojun * generalized service curve used for admission control
100 1.1 itojun */
101 1.1 itojun struct segment {
102 1.1 itojun LIST_ENTRY(segment) _next;
103 1.1 itojun double x, y, d, m;
104 1.1 itojun };
105 1.1 itojun
106 1.4 peter extern int loadopt;
107 1.4 peter
108 1.1 itojun int check_commit_altq(int, int);
109 1.1 itojun void pfaltq_store(struct pf_altq *);
110 1.1 itojun void pfaltq_free(struct pf_altq *);
111 1.1 itojun struct pf_altq *pfaltq_lookup(const char *);
112 1.1 itojun char *rate2str(double);
113 1.1 itojun
114 1.1 itojun void print_addr(struct pf_addr_wrap *, sa_family_t, int);
115 1.1 itojun void print_host(struct pf_state_host *, sa_family_t, int);
116 1.1 itojun void print_seq(struct pf_state_peer *);
117 1.1 itojun void print_state(struct pf_state *, int);
118 1.1 itojun int unmask(struct pf_addr *, sa_family_t);
119 1.1 itojun
120 1.1 itojun int pfctl_cmdline_symset(char *);
121 1.3 yamt int pfctl_add_trans(struct pfr_buffer *, int, const char *);
122 1.1 itojun u_int32_t
123 1.3 yamt pfctl_get_ticket(struct pfr_buffer *, int, const char *);
124 1.1 itojun int pfctl_trans(int, struct pfr_buffer *, u_long, int);
125 1.1 itojun
126 1.1 itojun #endif /* _PFCTL_H_ */
127