Import 2.3.6
[davej-history.git] / include / linux / ip_masq.h
blobba89313830234c9b8a39d90ccfd17151e0b4e3cc
1 /*
2 * IP_MASQ user space control interface
3 * $Id: ip_masq.h,v 1.2 1998/12/08 05:41:48 davem Exp $
4 */
6 #ifndef _LINUX_IP_MASQ_H
7 #define _LINUX_IP_MASQ_H
9 #ifdef __KERNEL__
10 #include <linux/types.h>
11 #include <linux/stddef.h>
12 #else
13 #include <sys/types.h>
14 #include <stddef.h>
15 #endif
17 struct ip_masq_user {
18 int protocol;
19 u_int16_t sport, dport, mport;
20 u_int32_t saddr, daddr, maddr;
21 u_int32_t rt_daddr; /* dst address to use for rt query */
22 u_int32_t rt_saddr;
23 u_int32_t ip_tos; /* TOS */
24 unsigned timeout; /* in ticks (HZ per sec) */
25 unsigned flags;
26 int fd; /* NOT IMPL: attach tunnel to this fd */
27 int state; /* NOT IMPL: return conn state */
30 #define IP_MASQ_USER_F_LISTEN 0x01 /* put entry to LISTEN state */
31 #define IP_MASQ_USER_F_DEAD 0x02 /* mark as DEAD */
32 #define IP_MASQ_USER_F_FORCE 0x04 /* force operation */
34 struct ip_masq_timeout {
35 int protocol;
36 union {
37 struct {
38 unsigned established;
39 unsigned syn_sent;
40 unsigned syn_recv;
41 unsigned fin_wait;
42 unsigned time_wait;
43 unsigned close;
44 unsigned close_wait;
45 unsigned last_ack;
46 unsigned listen;
47 } tcp;
48 unsigned udp;
49 unsigned icmp;
50 } u;
53 /*
54 * AUTOFW stuff
56 #define IP_FWD_RANGE 1
57 #define IP_FWD_PORT 2
58 #define IP_FWD_DIRECT 3
60 #define IP_AUTOFW_ACTIVE 1
61 #define IP_AUTOFW_USETIME 2
62 #define IP_AUTOFW_SECURE 4
65 /* WARNING: bitwise equal to ip_autofw in net/ip_autofw.h */
66 struct ip_autofw_user {
67 void * next;
68 u_int16_t type;
69 u_int16_t low;
70 u_int16_t hidden;
71 u_int16_t high;
72 u_int16_t visible;
73 u_int16_t protocol;
74 u_int32_t lastcontact;
75 u_int32_t where;
76 u_int16_t ctlproto;
77 u_int16_t ctlport;
78 u_int16_t flags;
79 /* struct timer_list timer; */
82 /*
83 * PORTFW stuff
85 struct ip_portfw_user {
86 u_int16_t protocol; /* Which protocol are we talking? */
87 u_int32_t laddr, raddr; /* Remote address */
88 u_int16_t lport, rport; /* Local and remote port */
89 int pref; /* Preference value */
92 /*
93 * MFW stuff
95 struct ip_mfw_user {
96 u_int32_t fwmark; /* Firewalling mark */
97 u_int32_t raddr; /* remote port */
98 u_int16_t rport; /* remote port */
99 u_int16_t dummy; /* Make up to multiple of 4 */
100 int pref; /* Preference value */
101 unsigned flags; /* misc flags */
104 #define IP_MASQ_MFW_SCHED 0x01
106 #define IP_FW_MASQCTL_MAX 256
107 #define IP_MASQ_TNAME_MAX 32
109 struct ip_masq_ctl {
110 int m_target;
111 int m_cmd;
112 char m_tname[IP_MASQ_TNAME_MAX];
113 union {
114 struct ip_portfw_user portfw_user;
115 struct ip_autofw_user autofw_user;
116 struct ip_mfw_user mfw_user;
117 struct ip_masq_user user;
118 unsigned char m_raw[IP_FW_MASQCTL_MAX];
119 } u;
122 #define IP_MASQ_CTL_BSIZE (offsetof (struct ip_masq_ctl,u))
124 #define IP_MASQ_TARGET_CORE 1
125 #define IP_MASQ_TARGET_MOD 2 /* masq_mod is selected by "name" */
126 #define IP_MASQ_TARGET_USER 3
127 #define IP_MASQ_TARGET_LAST 4
129 #define IP_MASQ_CMD_NONE 0 /* just peek */
130 #define IP_MASQ_CMD_INSERT 1
131 #define IP_MASQ_CMD_ADD 2
132 #define IP_MASQ_CMD_SET 3
133 #define IP_MASQ_CMD_DEL 4
134 #define IP_MASQ_CMD_GET 5
135 #define IP_MASQ_CMD_FLUSH 6
136 #define IP_MASQ_CMD_LIST 7 /* actually fake: done via /proc */
137 #define IP_MASQ_CMD_ENABLE 8
138 #define IP_MASQ_CMD_DISABLE 9
140 #endif /* _LINUX_IP_MASQ_H */