source: rtems-libbsd/freebsd/contrib/pf/pfctl/pfctl.h @ 6e9a8ea

5-freebsd-12freebsd-9.3
Last change on this file since 6e9a8ea was 6e9a8ea, checked in by Christian Mauderer <Christian.Mauderer@…>, on Jul 5, 2016 at 2:07:37 PM

pfctl: Import sources from FreeBSD.

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