microuptime.9 microtime.9: Fix documentation of the get* function versions.
[dragonfly.git] / sys / net / ipfw3 / ip_fw3_sync.h
blob232861ad29d96bbd042c30c48a14739b2a858747
1 /*
2 * Copyright (c) 2016 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_SYNC_H_
37 #define _IP_FW3_SYNC_H_
39 #define MAX_EDGES 10
41 #define SYNC_TYPE_SEND_TEST 0 /* testing sync status */
42 #define SYNC_TYPE_SEND_STATE 1 /* syncing state */
43 #define SYNC_TYPE_SEND_NAT 2 /* syncing nat */
46 struct ipfw_sync_edge {
47 in_addr_t addr;
48 u_short port;
51 struct ipfw_ioc_sync_context {
52 int edge_port; /* edge listening port */
53 int hw_same; /* duplicate to all CPU when hardware different */
54 int count; /* count of edge */
55 struct ipfw_sync_edge edges[0]; /* edge */
58 struct ipfw_ioc_sync_centre {
59 int count; /* count of edge */
60 struct ipfw_sync_edge edges[0]; /* edge */
63 struct ipfw_ioc_sync_edge {
64 int port;
65 int hw_same;
68 struct ipfw_sync_context{
69 int edge_port; /* edge listening port */
70 int hw_same; /* duplicate to all CPU when hardware different */
71 int count; /* count of edge */
72 int running; /* edge 01, centre 10 */
73 struct ipfw_sync_edge *edges; /* edge */
74 struct thread *edge_td; /* edge handler thread */
75 struct socket *edge_sock; /* edge sock */
76 struct socket *centre_socks[MAX_EDGES]; /* centre socks */
79 #ifdef _KERNEL
82 void ipfw3_sync_modevent(int type);
84 struct cmd_send_test {
85 int type;
86 int num;
89 struct cmd_send_state {
90 int type; /* test, state or NAT */
91 struct ipfw_flow_id flow;
92 uint32_t expiry;
93 uint16_t lifetime;
94 int rulenum;
95 int cpu;
96 int hash;
99 struct cmd_send_nat {
100 int type; /* test, state, or NAT */
103 struct netmsg_sync {
104 struct netmsg_base base;
105 struct ipfw_ioc_sync_centre *centre;
106 int retval;
110 typedef void ipfw_sync_install_state_t(struct cmd_send_state *cmd);
112 void sync_centre_conf_dispath(netmsg_t nmsg);
113 int ipfw_ctl_sync_centre_conf(struct sockopt *sopt);
114 int ipfw_ctl_sync_show_conf(struct sockopt *sopt);
115 int ipfw_ctl_sync_show_status(struct sockopt *sopt);
116 int ipfw_ctl_sync_edge_conf(struct sockopt *sopt);
117 void sync_edge_socket_handler(void *dummy);
118 int ipfw_ctl_sync_edge_start(struct sockopt *sopt);
119 int ipfw_ctl_sync_edge_test(struct sockopt *sopt);
120 int ipfw_ctl_sync_centre_start(struct sockopt *sopt);
121 int ipfw_ctl_sync_centre_test(struct sockopt *sopt);
122 int ipfw_ctl_sync_edge_stop(struct sockopt *sopt);
123 int ipfw_ctl_sync_centre_stop(struct sockopt *sopt);
124 int ipfw_ctl_sync_edge_clear(struct sockopt *sopt);
125 int ipfw_ctl_sync_centre_clear(struct sockopt *sopt);
126 int ipfw_ctl_sync_sockopt(struct sockopt *sopt);
127 void ipfw_sync_send_state(struct ip_fw_state *state, int cpu, int hash);
129 #endif /* _KERNEL */
130 #endif /* _IP_FW3_SYNC_H_ */