pfctl.h revision 1.9
1/* $OpenBSD: pfctl.h,v 1.9 2003/01/24 11:11:17 henning 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 */ 32 33#ifndef _PFCTL_H_ 34#define _PFCTL_H_ 35 36void pfr_set_fd(int); 37int pfr_get_fd(void); 38int pfr_clr_tables(int *, int); 39int pfr_add_tables(struct pfr_table *, int, int *, int); 40int pfr_del_tables(struct pfr_table *, int, int *, int); 41int pfr_get_tables(struct pfr_table *, int *, int); 42int pfr_get_tstats(struct pfr_tstats *, int *, int); 43int pfr_clr_tstats(struct pfr_table *, int, int *, int); 44int pfr_clr_addrs(struct pfr_table *, int *, int); 45int pfr_add_addrs(struct pfr_table *, struct pfr_addr *, int, int *, int); 46int pfr_del_addrs(struct pfr_table *, struct pfr_addr *, int, int *, int); 47int pfr_set_addrs(struct pfr_table *, struct pfr_addr *, int, int *, 48 int *, int *, int *, int); 49int pfr_get_addrs(struct pfr_table *, struct pfr_addr *, int *, int); 50int pfr_get_astats(struct pfr_table *, struct pfr_astats *, int *, int); 51int pfr_clr_astats(struct pfr_table *, struct pfr_addr *, int, int *, int); 52int pfr_tst_addrs(struct pfr_table *, struct pfr_addr *, int, int *, int); 53int pfr_set_tflags(struct pfr_table *, int, int, int, int *, int *, int); 54int pfr_ina_begin(int *, int *, int); 55int pfr_ina_commit(int, int *, int *, int); 56int pfr_ina_define(struct pfr_table *, struct pfr_addr *, int, int *, 57 int *, int, int); 58int pfctl_clear_tables(int); 59int pfctl_show_tables(int); 60int pfctl_command_tables(int, char *[], char *, char *, char *, int); 61int pfctl_show_altq(int, int, int); 62 63#ifndef DEFAULT_PRIORITY 64#define DEFAULT_PRIORITY 1 65#endif 66 67#ifndef DEFAULT_QLIMIT 68#define DEFAULT_QLIMIT 50 69#endif 70 71/* 72 * generalized service curve used for admission control 73 */ 74struct segment { 75 LIST_ENTRY(segment) _next; 76 double x, y, d, m; 77}; 78 79int check_commit_altq(int, int); 80void pfaltq_store(struct pf_altq *); 81void pfaltq_free(struct pf_altq *); 82struct pf_altq *pfaltq_lookup(const char *); 83struct pf_altq *qname_to_pfaltq(const char *, const char *); 84u_int32_t qname_to_qid(const char *, const char *); 85char *qid_to_qname(u_int32_t, const char *); 86char *rate2str(double); 87 88void print_altq(const struct pf_altq *, unsigned); 89void print_queue(const struct pf_altq *, unsigned); 90 91void print_addr(struct pf_addr_wrap *, sa_family_t, int); 92void print_host(struct pf_state_host *, sa_family_t, int); 93void print_seq(struct pf_state_peer *); 94void print_state(struct pf_state *, int); 95int unmask(struct pf_addr *, sa_family_t); 96 97#endif /* _PFCTL_H_ */ 98