libpam: Reorganize libpam build structure.
[dragonfly.git] / sys / net / ipfw3 / ip_fw3_table.h
blobc481bf3eefa3f6454981cc78d2e66b4090ef9a8c
1 /*
2 * Copyright (c) 2015 The DragonFly Project. All rights reserved.
4 * This code is derived from software contributed to The DragonFly Project
5 * by Bill Yuan <bycn82@dragonflybsd.org>
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
16 * distribution.
17 * 3. Neither the name of The DragonFly Project nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific, prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
31 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
36 #ifndef _IP_FW3_TABLE_H_
37 #define _IP_FW3_TABLE_H_
39 #define IPFW_TABLES_MAX 32
40 #define IPFW_TABLE_NAME_LEN 32
42 #ifdef _KERNEL
43 struct ipfw_table_context {
44 struct radix_node_head *node;
45 struct radix_node_head *mask;
46 char name[IPFW_TABLE_NAME_LEN];
47 int count;
48 int type;
51 struct table_ip_entry{
52 struct radix_node rn[2];
53 struct sockaddr_in addr;
54 struct sockaddr_in mask;
57 struct table_mac_entry {
58 struct radix_node rn[2];
59 struct sockaddr addr;
60 struct sockaddr mask;
63 struct netmsg_table {
64 struct netmsg_base base;
65 struct ipfw_ioc_table *ioc_table;
66 int retval;
69 int ipfw_ctl_table_list(struct sockopt *sopt);
70 int ipfw_ctl_table_remove(struct sockopt *sopt);
71 int ipfw_ctl_table_flush(struct sockopt *sopt);
72 int flush_table_ip_entry(struct radix_node *rn, void *arg);
73 int flush_table_mac_entry(struct radix_node *rn, void *arg);
74 int dump_table_ip_entry(struct radix_node *rn, void *arg);
75 int dump_table_mac_entry(struct radix_node *rn, void *arg);
76 int ipfw_ctl_table_show(struct sockopt *sopt);
77 int ipfw_ctl_table_test(struct sockopt *sopt);
78 int ipfw_ctl_table_rename(struct sockopt *sopt);
79 int ipfw_ctl_table_create(struct sockopt *sopt);
80 int ipfw_ctl_table_delete(struct sockopt *sopt);
81 int ipfw_ctl_table_append(struct sockopt *sopt);
82 int ipfw_ctl_table_sockopt(struct sockopt *sopt);
84 void table_init_dispatch(netmsg_t nmsg);
85 void table_fini(void);
87 #endif /* _KERNEL */
89 struct ipfw_ioc_table_ip_entry {
90 in_addr_t addr; /* network address */
91 u_int8_t masklen; /* mask length */
94 struct ipfw_ioc_table_mac_entry {
95 struct ether_addr addr;
98 struct ipfw_ioc_table {
99 int id;
100 int type;
101 int count;
102 char name[IPFW_TABLE_NAME_LEN];
103 struct ipfw_ioc_table_ip_entry ip_ent[0];
104 struct ipfw_ioc_table_mac_entry mac_ent[0];
107 #endif /* _IP_FW3_TABLE_H_ */