1 1.5 yamt /* $NetBSD: pfctl.h,v 1.5 2008/06/18 09:06:26 yamt Exp $ */ 2 1.5 yamt /* $OpenBSD: pfctl.h,v 1.41 2007/05/31 04:13:37 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.5 yamt enum pfctl_show { PFCTL_SHOW_RULES, PFCTL_SHOW_LABELS, PFCTL_SHOW_NOTHING }; 38 1.5 yamt 39 1.1 itojun enum { PFRB_TABLES = 1, PFRB_TSTATS, PFRB_ADDRS, PFRB_ASTATS, 40 1.1 itojun PFRB_IFACES, PFRB_TRANS, PFRB_MAX }; 41 1.1 itojun struct pfr_buffer { 42 1.1 itojun int pfrb_type; /* type of content, see enum above */ 43 1.1 itojun int pfrb_size; /* number of objects in buffer */ 44 1.1 itojun int pfrb_msize; /* maximum number of objects in buffer */ 45 1.1 itojun void *pfrb_caddr; /* malloc'ated memory area */ 46 1.1 itojun }; 47 1.1 itojun #define PFRB_FOREACH(var, buf) \ 48 1.1 itojun for ((var) = pfr_buf_next((buf), NULL); \ 49 1.1 itojun (var) != NULL; \ 50 1.1 itojun (var) = pfr_buf_next((buf), (var))) 51 1.1 itojun 52 1.1 itojun void pfr_set_fd(int); 53 1.1 itojun int pfr_get_fd(void); 54 1.1 itojun int pfr_clr_tables(struct pfr_table *, int *, int); 55 1.1 itojun int pfr_add_tables(struct pfr_table *, int, int *, int); 56 1.1 itojun int pfr_del_tables(struct pfr_table *, int, int *, int); 57 1.1 itojun int pfr_get_tables(struct pfr_table *, struct pfr_table *, int *, int); 58 1.1 itojun int pfr_get_tstats(struct pfr_table *, struct pfr_tstats *, int *, int); 59 1.1 itojun int pfr_clr_tstats(struct pfr_table *, int, int *, int); 60 1.1 itojun int pfr_clr_addrs(struct pfr_table *, int *, int); 61 1.1 itojun int pfr_add_addrs(struct pfr_table *, struct pfr_addr *, int, int *, int); 62 1.1 itojun int pfr_del_addrs(struct pfr_table *, struct pfr_addr *, int, int *, int); 63 1.1 itojun int pfr_set_addrs(struct pfr_table *, struct pfr_addr *, int, int *, 64 1.1 itojun int *, int *, int *, int); 65 1.1 itojun int pfr_get_addrs(struct pfr_table *, struct pfr_addr *, int *, int); 66 1.1 itojun int pfr_get_astats(struct pfr_table *, struct pfr_astats *, int *, int); 67 1.1 itojun int pfr_clr_astats(struct pfr_table *, struct pfr_addr *, int, int *, int); 68 1.1 itojun int pfr_tst_addrs(struct pfr_table *, struct pfr_addr *, int, int *, int); 69 1.1 itojun int pfr_set_tflags(struct pfr_table *, int, int, int, int *, int *, int); 70 1.1 itojun int pfr_ina_define(struct pfr_table *, struct pfr_addr *, int, int *, 71 1.1 itojun int *, int, int); 72 1.1 itojun void pfr_buf_clear(struct pfr_buffer *); 73 1.1 itojun int pfr_buf_add(struct pfr_buffer *, const void *); 74 1.1 itojun void *pfr_buf_next(struct pfr_buffer *, const void *); 75 1.1 itojun int pfr_buf_grow(struct pfr_buffer *, int); 76 1.1 itojun int pfr_buf_load(struct pfr_buffer *, char *, int, 77 1.1 itojun int (*)(struct pfr_buffer *, char *, int)); 78 1.1 itojun char *pfr_strerror(int); 79 1.5 yamt int pfi_get_ifaces(const char *, struct pfi_kif *, int *); 80 1.1 itojun int pfi_clr_istats(const char *, int *, int); 81 1.1 itojun 82 1.1 itojun void pfctl_print_title(char *); 83 1.3 yamt int pfctl_clear_tables(const char *, int); 84 1.3 yamt int pfctl_show_tables(const char *, int); 85 1.1 itojun int pfctl_command_tables(int, char *[], char *, const char *, char *, 86 1.3 yamt const char *, int); 87 1.1 itojun int pfctl_show_altq(int, const char *, int, int); 88 1.1 itojun void warn_namespace_collision(const char *); 89 1.1 itojun int pfctl_show_ifaces(const char *, int); 90 1.3 yamt FILE *pfctl_fopen(const char *, const char *); 91 1.1 itojun 92 1.1 itojun #ifndef DEFAULT_PRIORITY 93 1.1 itojun #define DEFAULT_PRIORITY 1 94 1.1 itojun #endif 95 1.1 itojun 96 1.1 itojun #ifndef DEFAULT_QLIMIT 97 1.1 itojun #define DEFAULT_QLIMIT 50 98 1.1 itojun #endif 99 1.1 itojun 100 1.1 itojun /* 101 1.1 itojun * generalized service curve used for admission control 102 1.1 itojun */ 103 1.1 itojun struct segment { 104 1.1 itojun LIST_ENTRY(segment) _next; 105 1.1 itojun double x, y, d, m; 106 1.1 itojun }; 107 1.1 itojun 108 1.4 peter extern int loadopt; 109 1.4 peter 110 1.1 itojun int check_commit_altq(int, int); 111 1.1 itojun void pfaltq_store(struct pf_altq *); 112 1.1 itojun struct pf_altq *pfaltq_lookup(const char *); 113 1.1 itojun char *rate2str(double); 114 1.1 itojun 115 1.1 itojun void print_addr(struct pf_addr_wrap *, sa_family_t, int); 116 1.5 yamt void print_host(struct pfsync_state_host *, sa_family_t, int); 117 1.5 yamt void print_seq(struct pfsync_state_peer *); 118 1.5 yamt void print_state(struct pfsync_state *, int); 119 1.1 itojun int unmask(struct pf_addr *, sa_family_t); 120 1.1 itojun 121 1.1 itojun int pfctl_cmdline_symset(char *); 122 1.3 yamt int pfctl_add_trans(struct pfr_buffer *, int, const char *); 123 1.1 itojun u_int32_t 124 1.3 yamt pfctl_get_ticket(struct pfr_buffer *, int, const char *); 125 1.1 itojun int pfctl_trans(int, struct pfr_buffer *, u_long, int); 126 1.1 itojun 127 1.1 itojun #endif /* _PFCTL_H_ */ 128