1/* $OpenBSD: pfctl.h,v 1.25 2003/08/29 21:47:36 cedric 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 36enum { PFRB_TABLES = 1, PFRB_TSTATS, PFRB_ADDRS, PFRB_ASTATS, PFRB_MAX }; 37struct pfr_buffer { 38 int pfrb_type; /* type of content, see enum above */ 39 int pfrb_size; /* number of objects in buffer */ 40 int pfrb_msize; /* maximum number of objects in buffer */ 41 void *pfrb_caddr; /* malloc'ated memory area */ 42}; 43#define PFRB_FOREACH(var, buf) \ 44 for ((var) = pfr_buf_next((buf), NULL); \ 45 (var) != NULL; \ 46 (var) = pfr_buf_next((buf), (var))) 47 48void pfr_set_fd(int); 49int pfr_get_fd(void); 50int pfr_clr_tables(struct pfr_table *, int *, int); 51int pfr_add_tables(struct pfr_table *, int, int *, int); 52int pfr_del_tables(struct pfr_table *, int, int *, int); 53int pfr_get_tables(struct pfr_table *, struct pfr_table *, int *, int); 54int pfr_get_tstats(struct pfr_table *, struct pfr_tstats *, int *, int); 55int pfr_clr_tstats(struct pfr_table *, int, int *, int); 56int pfr_clr_addrs(struct pfr_table *, int *, int); 57int pfr_add_addrs(struct pfr_table *, struct pfr_addr *, int, int *, int); 58int pfr_del_addrs(struct pfr_table *, struct pfr_addr *, int, int *, int); 59int pfr_set_addrs(struct pfr_table *, struct pfr_addr *, int, int *, 60 int *, int *, int *, int); 61int pfr_get_addrs(struct pfr_table *, struct pfr_addr *, int *, int); 62int pfr_get_astats(struct pfr_table *, struct pfr_astats *, int *, int); 63int pfr_clr_astats(struct pfr_table *, struct pfr_addr *, int, int *, int); 64int pfr_tst_addrs(struct pfr_table *, struct pfr_addr *, int, int *, int); 65int pfr_set_tflags(struct pfr_table *, int, int, int, int *, int *, int); 66int pfr_ina_begin(struct pfr_table *, int *, int *, int); 67int pfr_ina_commit(struct pfr_table *, int, int *, int *, int); 68int pfr_ina_define(struct pfr_table *, struct pfr_addr *, int, int *, 69 int *, int, int); 70void pfr_buf_clear(struct pfr_buffer *); 71int pfr_buf_add(struct pfr_buffer *, const void *); 72void *pfr_buf_next(struct pfr_buffer *, const void *); 73int pfr_buf_grow(struct pfr_buffer *, int); 74int pfr_buf_load(struct pfr_buffer *, char *, int, 75 int (*)(struct pfr_buffer *, char *, int)); 76char *pfr_strerror(int); 77 78int pfctl_clear_tables(const char *, const char *, int); 79int pfctl_show_tables(const char *, const char *, int); 80int pfctl_command_tables(int, char *[], char *, const char *, char *, 81 const char *, const char *, int); 82int pfctl_show_altq(int, int, int); 83void warn_namespace_collision(const char *); 84
| 2/* $OpenBSD: pfctl.h,v 1.25 2003/08/29 21:47:36 cedric Exp $ */ 3 4/* 5 * Copyright (c) 2001 Daniel Hartmeier 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 12 * - Redistributions of source code must retain the above copyright 13 * notice, this list of conditions and the following disclaimer. 14 * - Redistributions in binary form must reproduce the above 15 * copyright notice, this list of conditions and the following 16 * disclaimer in the documentation and/or other materials provided 17 * with the distribution. 18 * 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 22 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 23 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 24 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 25 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 29 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 * POSSIBILITY OF SUCH DAMAGE. 31 * 32 */ 33 34#ifndef _PFCTL_H_ 35#define _PFCTL_H_ 36 37enum { PFRB_TABLES = 1, PFRB_TSTATS, PFRB_ADDRS, PFRB_ASTATS, PFRB_MAX }; 38struct pfr_buffer { 39 int pfrb_type; /* type of content, see enum above */ 40 int pfrb_size; /* number of objects in buffer */ 41 int pfrb_msize; /* maximum number of objects in buffer */ 42 void *pfrb_caddr; /* malloc'ated memory area */ 43}; 44#define PFRB_FOREACH(var, buf) \ 45 for ((var) = pfr_buf_next((buf), NULL); \ 46 (var) != NULL; \ 47 (var) = pfr_buf_next((buf), (var))) 48 49void pfr_set_fd(int); 50int pfr_get_fd(void); 51int pfr_clr_tables(struct pfr_table *, int *, int); 52int pfr_add_tables(struct pfr_table *, int, int *, int); 53int pfr_del_tables(struct pfr_table *, int, int *, int); 54int pfr_get_tables(struct pfr_table *, struct pfr_table *, int *, int); 55int pfr_get_tstats(struct pfr_table *, struct pfr_tstats *, int *, int); 56int pfr_clr_tstats(struct pfr_table *, int, int *, int); 57int pfr_clr_addrs(struct pfr_table *, int *, int); 58int pfr_add_addrs(struct pfr_table *, struct pfr_addr *, int, int *, int); 59int pfr_del_addrs(struct pfr_table *, struct pfr_addr *, int, int *, int); 60int pfr_set_addrs(struct pfr_table *, struct pfr_addr *, int, int *, 61 int *, int *, int *, int); 62int pfr_get_addrs(struct pfr_table *, struct pfr_addr *, int *, int); 63int pfr_get_astats(struct pfr_table *, struct pfr_astats *, int *, int); 64int pfr_clr_astats(struct pfr_table *, struct pfr_addr *, int, int *, int); 65int pfr_tst_addrs(struct pfr_table *, struct pfr_addr *, int, int *, int); 66int pfr_set_tflags(struct pfr_table *, int, int, int, int *, int *, int); 67int pfr_ina_begin(struct pfr_table *, int *, int *, int); 68int pfr_ina_commit(struct pfr_table *, int, int *, int *, int); 69int pfr_ina_define(struct pfr_table *, struct pfr_addr *, int, int *, 70 int *, int, int); 71void pfr_buf_clear(struct pfr_buffer *); 72int pfr_buf_add(struct pfr_buffer *, const void *); 73void *pfr_buf_next(struct pfr_buffer *, const void *); 74int pfr_buf_grow(struct pfr_buffer *, int); 75int pfr_buf_load(struct pfr_buffer *, char *, int, 76 int (*)(struct pfr_buffer *, char *, int)); 77char *pfr_strerror(int); 78 79int pfctl_clear_tables(const char *, const char *, int); 80int pfctl_show_tables(const char *, const char *, int); 81int pfctl_command_tables(int, char *[], char *, const char *, char *, 82 const char *, const char *, int); 83int pfctl_show_altq(int, int, int); 84void warn_namespace_collision(const char *); 85
|