ip_proxy.h revision 1.2.4.3 1 1.2.4.3 yamt /* $NetBSD: ip_proxy.h,v 1.2.4.3 2012/10/30 17:22:20 yamt Exp $ */
2 1.2.4.2 yamt
3 1.2.4.2 yamt /*
4 1.2.4.3 yamt * Copyright (C) 2012 by Darren Reed.
5 1.2.4.2 yamt *
6 1.2.4.2 yamt * See the IPFILTER.LICENCE file for details on licencing.
7 1.2.4.2 yamt *
8 1.2.4.3 yamt * Id: ip_proxy.h,v 1.1.1.2 2012/07/22 13:45:33 darrenr Exp
9 1.2.4.2 yamt */
10 1.2.4.2 yamt
11 1.2.4.2 yamt #ifndef _NETINET_IP_PROXY_H_
12 1.2.4.2 yamt #define _NETINET_IP_PROXY_H_
13 1.2.4.2 yamt
14 1.2.4.2 yamt #ifndef SOLARIS
15 1.2.4.3 yamt # if (defined(sun) && (defined(__svr4__) || defined(__SVR4)))
16 1.2.4.3 yamt # define SOLARIS 1
17 1.2.4.3 yamt # else
18 1.2.4.3 yamt # define SOLARIS 0
19 1.2.4.3 yamt # endif
20 1.2.4.2 yamt #endif
21 1.2.4.2 yamt
22 1.2.4.2 yamt #if defined(__STDC__) || defined(__GNUC__) || defined(_AIX51)
23 1.2.4.2 yamt #define SIOCPROXY _IOWR('r', 64, struct ap_control)
24 1.2.4.2 yamt #else
25 1.2.4.2 yamt #define SIOCPROXY _IOWR(r, 64, struct ap_control)
26 1.2.4.2 yamt #endif
27 1.2.4.2 yamt
28 1.2.4.2 yamt #ifndef APR_LABELLEN
29 1.2.4.2 yamt #define APR_LABELLEN 16
30 1.2.4.2 yamt #endif
31 1.2.4.2 yamt #define AP_SESS_SIZE 53
32 1.2.4.2 yamt
33 1.2.4.2 yamt struct nat;
34 1.2.4.2 yamt struct ipnat;
35 1.2.4.2 yamt struct ipstate;
36 1.2.4.2 yamt
37 1.2.4.2 yamt typedef struct ap_tcp {
38 1.2.4.2 yamt u_short apt_sport; /* source port */
39 1.2.4.2 yamt u_short apt_dport; /* destination port */
40 1.2.4.2 yamt short apt_sel[2]; /* {seq,ack}{off,min} set selector */
41 1.2.4.2 yamt short apt_seqoff[2]; /* sequence # difference */
42 1.2.4.2 yamt u_32_t apt_seqmin[2]; /* don't change seq-off until after this */
43 1.2.4.2 yamt short apt_ackoff[2]; /* sequence # difference */
44 1.2.4.2 yamt u_32_t apt_ackmin[2]; /* don't change seq-off until after this */
45 1.2.4.2 yamt u_char apt_state[2]; /* connection state */
46 1.2.4.2 yamt } ap_tcp_t;
47 1.2.4.2 yamt
48 1.2.4.2 yamt typedef struct ap_udp {
49 1.2.4.2 yamt u_short apu_sport; /* source port */
50 1.2.4.2 yamt u_short apu_dport; /* destination port */
51 1.2.4.2 yamt } ap_udp_t;
52 1.2.4.2 yamt
53 1.2.4.2 yamt typedef struct ap_session {
54 1.2.4.2 yamt struct aproxy *aps_apr;
55 1.2.4.2 yamt union {
56 1.2.4.2 yamt struct ap_tcp apu_tcp;
57 1.2.4.2 yamt struct ap_udp apu_udp;
58 1.2.4.2 yamt } aps_un;
59 1.2.4.2 yamt U_QUAD_T aps_bytes; /* bytes sent */
60 1.2.4.2 yamt U_QUAD_T aps_pkts; /* packets sent */
61 1.2.4.2 yamt void *aps_nat; /* pointer back to nat struct */
62 1.2.4.2 yamt void *aps_data; /* private data */
63 1.2.4.2 yamt int aps_psiz; /* size of private data */
64 1.2.4.2 yamt struct ap_session *aps_next;
65 1.2.4.2 yamt } ap_session_t;
66 1.2.4.2 yamt
67 1.2.4.2 yamt #define aps_sport aps_un.apu_tcp.apt_sport
68 1.2.4.2 yamt #define aps_dport aps_un.apu_tcp.apt_dport
69 1.2.4.2 yamt #define aps_sel aps_un.apu_tcp.apt_sel
70 1.2.4.2 yamt #define aps_seqoff aps_un.apu_tcp.apt_seqoff
71 1.2.4.2 yamt #define aps_seqmin aps_un.apu_tcp.apt_seqmin
72 1.2.4.2 yamt #define aps_state aps_un.apu_tcp.apt_state
73 1.2.4.2 yamt #define aps_ackoff aps_un.apu_tcp.apt_ackoff
74 1.2.4.2 yamt #define aps_ackmin aps_un.apu_tcp.apt_ackmin
75 1.2.4.2 yamt
76 1.2.4.2 yamt
77 1.2.4.2 yamt typedef struct ap_control {
78 1.2.4.2 yamt char apc_label[APR_LABELLEN];
79 1.2.4.2 yamt char apc_config[APR_LABELLEN];
80 1.2.4.2 yamt u_char apc_p;
81 1.2.4.2 yamt /*
82 1.2.4.2 yamt * The following fields are upto the proxy's apr_ctl routine to deal
83 1.2.4.2 yamt * with. When the proxy gets this in kernel space, apc_data will
84 1.2.4.2 yamt * point to a malloc'd region of memory of apc_dsize bytes. If the
85 1.2.4.2 yamt * proxy wants to keep that memory, it must set apc_data to NULL
86 1.2.4.2 yamt * before it returns. It is expected if this happens that it will
87 1.2.4.2 yamt * take care to free it in apr_fini or otherwise as appropriate.
88 1.2.4.2 yamt * apc_cmd is provided as a standard place to put simple commands,
89 1.2.4.2 yamt * with apc_arg being available to put a simple arg.
90 1.2.4.2 yamt */
91 1.2.4.2 yamt u_long apc_cmd;
92 1.2.4.2 yamt u_long apc_arg;
93 1.2.4.2 yamt void *apc_data;
94 1.2.4.2 yamt size_t apc_dsize;
95 1.2.4.2 yamt } ap_ctl_t;
96 1.2.4.2 yamt
97 1.2.4.2 yamt #define APC_CMD_ADD 0
98 1.2.4.2 yamt #define APC_CMD_DEL 1
99 1.2.4.2 yamt
100 1.2.4.2 yamt
101 1.2.4.2 yamt typedef struct aproxy {
102 1.2.4.2 yamt struct aproxy *apr_next;
103 1.2.4.2 yamt struct aproxy *apr_parent;
104 1.2.4.2 yamt char apr_label[APR_LABELLEN]; /* Proxy label # */
105 1.2.4.2 yamt u_char apr_p; /* protocol */
106 1.2.4.2 yamt int apr_flags;
107 1.2.4.2 yamt int apr_ref;
108 1.2.4.2 yamt int apr_clones;
109 1.2.4.2 yamt void (* apr_load)(void);
110 1.2.4.2 yamt void (* apr_unload)(void);
111 1.2.4.2 yamt void *(* apr_create)(ipf_main_softc_t *);
112 1.2.4.2 yamt void (* apr_destroy)(ipf_main_softc_t *, void *);
113 1.2.4.2 yamt int (* apr_init)(ipf_main_softc_t *, void *);
114 1.2.4.2 yamt void (* apr_fini)(ipf_main_softc_t *, void *);
115 1.2.4.2 yamt int (* apr_new)(void *, fr_info_t *, ap_session_t *,
116 1.2.4.2 yamt struct nat *);
117 1.2.4.2 yamt void (* apr_del)(ipf_main_softc_t *, ap_session_t *);
118 1.2.4.2 yamt int (* apr_inpkt)(void *, fr_info_t *, ap_session_t *,
119 1.2.4.2 yamt struct nat *);
120 1.2.4.2 yamt int (* apr_outpkt)(void *, fr_info_t *, ap_session_t *,
121 1.2.4.2 yamt struct nat *);
122 1.2.4.2 yamt int (* apr_match)(fr_info_t *, ap_session_t *, struct nat *);
123 1.2.4.2 yamt int (* apr_ctl)(ipf_main_softc_t *, void *, ap_ctl_t *);
124 1.2.4.2 yamt int (* apr_clear)(struct aproxy *);
125 1.2.4.2 yamt int (* apr_flush)(struct aproxy *, int);
126 1.2.4.2 yamt void *apr_soft;
127 1.2.4.2 yamt } aproxy_t;
128 1.2.4.2 yamt
129 1.2.4.2 yamt #define APR_DELETE 1
130 1.2.4.2 yamt
131 1.2.4.2 yamt #define APR_ERR(x) ((x) << 16)
132 1.2.4.2 yamt #define APR_EXIT(x) (((x) >> 16) & 0xffff)
133 1.2.4.2 yamt #define APR_INC(x) ((x) & 0xffff)
134 1.2.4.2 yamt
135 1.2.4.2 yamt
136 1.2.4.2 yamt #ifdef _KERNEL
137 1.2.4.2 yamt /*
138 1.2.4.2 yamt * Generic #define's to cover missing things in the kernel
139 1.2.4.2 yamt */
140 1.2.4.2 yamt # ifndef isdigit
141 1.2.4.2 yamt # define isdigit(x) ((x) >= '0' && (x) <= '9')
142 1.2.4.2 yamt # endif
143 1.2.4.2 yamt # ifndef isupper
144 1.2.4.2 yamt # define isupper(x) (((unsigned)(x) >= 'A') && ((unsigned)(x) <= 'Z'))
145 1.2.4.2 yamt # endif
146 1.2.4.2 yamt # ifndef islower
147 1.2.4.2 yamt # define islower(x) (((unsigned)(x) >= 'a') && ((unsigned)(x) <= 'z'))
148 1.2.4.2 yamt # endif
149 1.2.4.2 yamt # ifndef isalpha
150 1.2.4.2 yamt # define isalpha(x) (isupper(x) || islower(x))
151 1.2.4.2 yamt # endif
152 1.2.4.2 yamt # ifndef toupper
153 1.2.4.2 yamt # define toupper(x) (isupper(x) ? (x) : (x) - 'a' + 'A')
154 1.2.4.2 yamt # endif
155 1.2.4.2 yamt # ifndef isspace
156 1.2.4.2 yamt # define isspace(x) (((x) == ' ') || ((x) == '\r') || ((x) == '\n') || \
157 1.2.4.2 yamt ((x) == '\t') || ((x) == '\b'))
158 1.2.4.2 yamt # endif
159 1.2.4.2 yamt #endif /* _KERNEL */
160 1.2.4.2 yamt
161 1.2.4.2 yamt /*
162 1.2.4.2 yamt * For the ftp proxy.
163 1.2.4.2 yamt */
164 1.2.4.2 yamt #define FTP_BUFSZ 160
165 1.2.4.2 yamt #define IPF_FTPBUFSZ 160
166 1.2.4.2 yamt
167 1.2.4.2 yamt typedef struct ftpside {
168 1.2.4.2 yamt char *ftps_rptr;
169 1.2.4.2 yamt char *ftps_wptr;
170 1.2.4.2 yamt void *ftps_ifp;
171 1.2.4.2 yamt u_32_t ftps_seq[2];
172 1.2.4.2 yamt u_32_t ftps_len;
173 1.2.4.2 yamt int ftps_junk;
174 1.2.4.2 yamt int ftps_cmds;
175 1.2.4.2 yamt int ftps_cmd;
176 1.2.4.2 yamt char ftps_buf[FTP_BUFSZ];
177 1.2.4.2 yamt } ftpside_t;
178 1.2.4.2 yamt
179 1.2.4.2 yamt typedef struct ftpinfo {
180 1.2.4.2 yamt int ftp_passok;
181 1.2.4.2 yamt int ftp_incok;
182 1.2.4.2 yamt void *ftp_pendstate;
183 1.2.4.2 yamt nat_t *ftp_pendnat;
184 1.2.4.2 yamt ftpside_t ftp_side[2];
185 1.2.4.2 yamt } ftpinfo_t;
186 1.2.4.2 yamt
187 1.2.4.2 yamt
188 1.2.4.2 yamt /*
189 1.2.4.3 yamt * IPsec proxy
190 1.2.4.3 yamt */
191 1.2.4.3 yamt typedef u_32_t ipsec_cookie_t[2];
192 1.2.4.3 yamt
193 1.2.4.3 yamt typedef struct ipsec_pxy {
194 1.2.4.3 yamt ipsec_cookie_t ipsc_icookie;
195 1.2.4.3 yamt ipsec_cookie_t ipsc_rcookie;
196 1.2.4.3 yamt int ipsc_rckset;
197 1.2.4.3 yamt nat_t *ipsc_nat;
198 1.2.4.3 yamt struct ipstate *ipsc_state;
199 1.2.4.3 yamt ipnat_t *ipsc_rule;
200 1.2.4.3 yamt } ipsec_pxy_t;
201 1.2.4.3 yamt
202 1.2.4.3 yamt
203 1.2.4.3 yamt /*
204 1.2.4.2 yamt * For the irc proxy.
205 1.2.4.2 yamt */
206 1.2.4.2 yamt typedef struct ircinfo {
207 1.2.4.2 yamt size_t irc_len;
208 1.2.4.2 yamt char *irc_snick;
209 1.2.4.2 yamt char *irc_dnick;
210 1.2.4.2 yamt char *irc_type;
211 1.2.4.2 yamt char *irc_arg;
212 1.2.4.2 yamt char *irc_addr;
213 1.2.4.2 yamt u_32_t irc_ipnum;
214 1.2.4.2 yamt u_short irc_port;
215 1.2.4.2 yamt } ircinfo_t;
216 1.2.4.2 yamt
217 1.2.4.2 yamt
218 1.2.4.2 yamt /*
219 1.2.4.2 yamt * For the DNS "proxy"
220 1.2.4.2 yamt */
221 1.2.4.2 yamt typedef struct dnsinfo {
222 1.2.4.2 yamt ipfmutex_t dnsi_lock;
223 1.2.4.2 yamt u_short dnsi_id;
224 1.2.4.2 yamt char dnsi_buffer[512];
225 1.2.4.2 yamt } dnsinfo_t;
226 1.2.4.2 yamt
227 1.2.4.2 yamt
228 1.2.4.2 yamt /*
229 1.2.4.2 yamt * Real audio proxy structure and #defines
230 1.2.4.2 yamt */
231 1.2.4.2 yamt typedef struct raudio_s {
232 1.2.4.2 yamt int rap_seenpna;
233 1.2.4.2 yamt int rap_seenver;
234 1.2.4.2 yamt int rap_version;
235 1.2.4.2 yamt int rap_eos; /* End Of Startup */
236 1.2.4.2 yamt int rap_gotid;
237 1.2.4.2 yamt int rap_gotlen;
238 1.2.4.2 yamt int rap_mode;
239 1.2.4.2 yamt int rap_sdone;
240 1.2.4.2 yamt u_short rap_plport;
241 1.2.4.2 yamt u_short rap_prport;
242 1.2.4.2 yamt u_short rap_srport;
243 1.2.4.2 yamt char rap_svr[19];
244 1.2.4.2 yamt u_32_t rap_sbf; /* flag to indicate which of the 19 bytes have
245 1.2.4.2 yamt * been filled
246 1.2.4.2 yamt */
247 1.2.4.2 yamt u_32_t rap_sseq;
248 1.2.4.2 yamt } raudio_t;
249 1.2.4.2 yamt
250 1.2.4.2 yamt #define RA_ID_END 0
251 1.2.4.2 yamt #define RA_ID_UDP 1
252 1.2.4.2 yamt #define RA_ID_ROBUST 7
253 1.2.4.2 yamt
254 1.2.4.2 yamt #define RAP_M_UDP 1
255 1.2.4.2 yamt #define RAP_M_ROBUST 2
256 1.2.4.2 yamt #define RAP_M_TCP 4
257 1.2.4.2 yamt #define RAP_M_UDP_ROBUST (RAP_M_UDP|RAP_M_ROBUST)
258 1.2.4.2 yamt
259 1.2.4.2 yamt
260 1.2.4.2 yamt /*
261 1.2.4.2 yamt * MSN RPC proxy
262 1.2.4.2 yamt */
263 1.2.4.2 yamt typedef struct msnrpcinfo {
264 1.2.4.2 yamt u_int mri_flags;
265 1.2.4.2 yamt int mri_cmd[2];
266 1.2.4.2 yamt u_int mri_valid;
267 1.2.4.2 yamt struct in_addr mri_raddr;
268 1.2.4.2 yamt u_short mri_rport;
269 1.2.4.2 yamt } msnrpcinfo_t;
270 1.2.4.2 yamt
271 1.2.4.2 yamt
272 1.2.4.2 yamt /*
273 1.2.4.2 yamt * Sun RPCBIND proxy
274 1.2.4.2 yamt */
275 1.2.4.2 yamt #define RPCB_MAXMSG 888
276 1.2.4.2 yamt #define RPCB_RES_PMAP 0 /* Response contains a v2 port. */
277 1.2.4.2 yamt #define RPCB_RES_STRING 1 /* " " " v3 (GETADDR) string. */
278 1.2.4.2 yamt #define RPCB_RES_LIST 2 /* " " " v4 (GETADDRLIST) list. */
279 1.2.4.2 yamt #define RPCB_MAXREQS 32 /* Arbitrary limit on tracked transactions */
280 1.2.4.2 yamt
281 1.2.4.2 yamt #define RPCB_REQMIN 40
282 1.2.4.2 yamt #define RPCB_REQMAX 888
283 1.2.4.2 yamt #define RPCB_REPMIN 20
284 1.2.4.2 yamt #define RPCB_REPMAX 604 /* XXX double check this! */
285 1.2.4.2 yamt
286 1.2.4.2 yamt /*
287 1.2.4.2 yamt * These macros determine the number of bytes between p and the end of
288 1.2.4.2 yamt * r->rs_buf relative to l.
289 1.2.4.2 yamt */
290 1.2.4.2 yamt #define RPCB_BUF_END(r) (char *)((r)->rm_msgbuf + (r)->rm_buflen)
291 1.2.4.2 yamt #define RPCB_BUF_GEQ(r, p, l) \
292 1.2.4.2 yamt ((RPCB_BUF_END((r)) > (char *)(p)) && \
293 1.2.4.2 yamt ((RPCB_BUF_END((r)) - (char *)(p)) >= (l)))
294 1.2.4.2 yamt #define RPCB_BUF_EQ(r, p, l) \
295 1.2.4.2 yamt (RPCB_BUF_END((r)) == ((char *)(p) + (l)))
296 1.2.4.2 yamt
297 1.2.4.2 yamt /*
298 1.2.4.2 yamt * The following correspond to RPC(B) detailed in RFC183[13].
299 1.2.4.2 yamt */
300 1.2.4.2 yamt #define RPCB_CALL 0
301 1.2.4.2 yamt #define RPCB_REPLY 1
302 1.2.4.2 yamt #define RPCB_MSG_VERSION 2
303 1.2.4.2 yamt #define RPCB_PROG 100000
304 1.2.4.2 yamt #define RPCB_GETPORT 3
305 1.2.4.2 yamt #define RPCB_GETADDR 3
306 1.2.4.2 yamt #define RPCB_GETADDRLIST 11
307 1.2.4.2 yamt #define RPCB_MSG_ACCEPTED 0
308 1.2.4.2 yamt #define RPCB_MSG_DENIED 1
309 1.2.4.2 yamt
310 1.2.4.2 yamt /* BEGIN (Generic XDR structures) */
311 1.2.4.2 yamt typedef struct xdr_string {
312 1.2.4.2 yamt u_32_t *xs_len;
313 1.2.4.2 yamt char *xs_str;
314 1.2.4.2 yamt } xdr_string_t;
315 1.2.4.2 yamt
316 1.2.4.2 yamt typedef struct xdr_auth {
317 1.2.4.2 yamt /* u_32_t xa_flavor; */
318 1.2.4.2 yamt xdr_string_t xa_string;
319 1.2.4.2 yamt } xdr_auth_t;
320 1.2.4.2 yamt
321 1.2.4.2 yamt typedef struct xdr_uaddr {
322 1.2.4.2 yamt u_32_t xu_ip;
323 1.2.4.2 yamt u_short xu_port;
324 1.2.4.2 yamt xdr_string_t xu_str;
325 1.2.4.2 yamt } xdr_uaddr_t;
326 1.2.4.2 yamt
327 1.2.4.2 yamt typedef struct xdr_proto {
328 1.2.4.2 yamt u_int xp_proto;
329 1.2.4.2 yamt xdr_string_t xp_str;
330 1.2.4.2 yamt } xdr_proto_t;
331 1.2.4.2 yamt
332 1.2.4.2 yamt #define xu_xslen xu_str.xs_len
333 1.2.4.2 yamt #define xu_xsstr xu_str.xs_str
334 1.2.4.2 yamt #define xp_xslen xp_str.xs_len
335 1.2.4.2 yamt #define xp_xsstr xp_str.xs_str
336 1.2.4.2 yamt /* END (Generic XDR structures) */
337 1.2.4.2 yamt
338 1.2.4.2 yamt /* BEGIN (RPC call structures) */
339 1.2.4.2 yamt typedef struct pmap_args {
340 1.2.4.2 yamt /* u_32_t pa_prog; */
341 1.2.4.2 yamt /* u_32_t pa_vers; */
342 1.2.4.2 yamt u_32_t *pa_prot;
343 1.2.4.2 yamt /* u_32_t pa_port; */
344 1.2.4.2 yamt } pmap_args_t;
345 1.2.4.2 yamt
346 1.2.4.2 yamt typedef struct rpcb_args {
347 1.2.4.2 yamt /* u_32_t *ra_prog; */
348 1.2.4.2 yamt /* u_32_t *ra_vers; */
349 1.2.4.2 yamt xdr_proto_t ra_netid;
350 1.2.4.2 yamt xdr_uaddr_t ra_maddr;
351 1.2.4.2 yamt /* xdr_string_t ra_owner; */
352 1.2.4.2 yamt } rpcb_args_t;
353 1.2.4.2 yamt
354 1.2.4.2 yamt typedef struct rpc_call {
355 1.2.4.2 yamt /* u_32_t rc_rpcvers; */
356 1.2.4.2 yamt /* u_32_t rc_prog; */
357 1.2.4.2 yamt u_32_t *rc_vers;
358 1.2.4.2 yamt u_32_t *rc_proc;
359 1.2.4.2 yamt xdr_auth_t rc_authcred;
360 1.2.4.2 yamt xdr_auth_t rc_authverf;
361 1.2.4.2 yamt union {
362 1.2.4.2 yamt pmap_args_t ra_pmapargs;
363 1.2.4.2 yamt rpcb_args_t ra_rpcbargs;
364 1.2.4.2 yamt } rpcb_args;
365 1.2.4.2 yamt } rpc_call_t;
366 1.2.4.2 yamt
367 1.2.4.2 yamt #define rc_pmapargs rpcb_args.ra_pmapargs
368 1.2.4.2 yamt #define rc_rpcbargs rpcb_args.ra_rpcbargs
369 1.2.4.2 yamt /* END (RPC call structures) */
370 1.2.4.2 yamt
371 1.2.4.2 yamt /* BEGIN (RPC reply structures) */
372 1.2.4.2 yamt typedef struct rpcb_entry {
373 1.2.4.2 yamt xdr_uaddr_t re_maddr;
374 1.2.4.2 yamt xdr_proto_t re_netid;
375 1.2.4.2 yamt /* u_32_t re_semantics; */
376 1.2.4.2 yamt xdr_string_t re_family;
377 1.2.4.2 yamt xdr_proto_t re_proto;
378 1.2.4.2 yamt u_32_t *re_more; /* 1 == another entry follows */
379 1.2.4.2 yamt } rpcb_entry_t;
380 1.2.4.2 yamt
381 1.2.4.2 yamt typedef struct rpcb_listp {
382 1.2.4.2 yamt u_32_t *rl_list; /* 1 == list follows */
383 1.2.4.2 yamt int rl_cnt;
384 1.2.4.2 yamt rpcb_entry_t rl_entries[2]; /* TCP / UDP only */
385 1.2.4.2 yamt } rpcb_listp_t;
386 1.2.4.2 yamt
387 1.2.4.2 yamt typedef struct rpc_resp {
388 1.2.4.2 yamt /* u_32_t rr_acceptdeny; */
389 1.2.4.2 yamt /* Omitted 'message denied' fork; we don't care about rejects. */
390 1.2.4.2 yamt xdr_auth_t rr_authverf;
391 1.2.4.2 yamt /* u_32_t *rr_astat; */
392 1.2.4.2 yamt union {
393 1.2.4.2 yamt u_32_t *resp_pmap;
394 1.2.4.2 yamt xdr_uaddr_t resp_getaddr;
395 1.2.4.2 yamt rpcb_listp_t resp_getaddrlist;
396 1.2.4.2 yamt } rpcb_reply;
397 1.2.4.2 yamt } rpc_resp_t;
398 1.2.4.2 yamt
399 1.2.4.2 yamt #define rr_v2 rpcb_reply.resp_pmap
400 1.2.4.2 yamt #define rr_v3 rpcb_reply.resp_getaddr
401 1.2.4.2 yamt #define rr_v4 rpcb_reply.resp_getaddrlist
402 1.2.4.2 yamt /* END (RPC reply structures) */
403 1.2.4.2 yamt
404 1.2.4.2 yamt /* BEGIN (RPC message structure & macros) */
405 1.2.4.2 yamt typedef struct rpc_msg {
406 1.2.4.2 yamt char rm_msgbuf[RPCB_MAXMSG]; /* RPCB data buffer */
407 1.2.4.2 yamt u_int rm_buflen;
408 1.2.4.2 yamt u_32_t *rm_xid;
409 1.2.4.2 yamt /* u_32_t Call vs Reply */
410 1.2.4.2 yamt union {
411 1.2.4.2 yamt rpc_call_t rb_call;
412 1.2.4.2 yamt rpc_resp_t rb_resp;
413 1.2.4.2 yamt } rm_body;
414 1.2.4.2 yamt } rpc_msg_t;
415 1.2.4.2 yamt
416 1.2.4.2 yamt #define rm_call rm_body.rb_call
417 1.2.4.2 yamt #define rm_resp rm_body.rb_resp
418 1.2.4.2 yamt /* END (RPC message structure & macros) */
419 1.2.4.2 yamt
420 1.2.4.2 yamt /*
421 1.2.4.2 yamt * These code paths aren't hot enough to warrant per transaction
422 1.2.4.2 yamt * mutexes.
423 1.2.4.2 yamt */
424 1.2.4.2 yamt typedef struct rpcb_xact {
425 1.2.4.2 yamt struct rpcb_xact *rx_next;
426 1.2.4.2 yamt struct rpcb_xact **rx_pnext;
427 1.2.4.2 yamt u_32_t rx_xid; /* RPC transmission ID */
428 1.2.4.2 yamt u_int rx_type; /* RPCB response type */
429 1.2.4.2 yamt u_int rx_ref; /* reference count */
430 1.2.4.2 yamt u_int rx_proto; /* transport protocol (v2 only) */
431 1.2.4.2 yamt } rpcb_xact_t;
432 1.2.4.2 yamt
433 1.2.4.2 yamt typedef struct rpcb_session {
434 1.2.4.2 yamt ipfmutex_t rs_rxlock;
435 1.2.4.2 yamt rpcb_xact_t *rs_rxlist;
436 1.2.4.2 yamt } rpcb_session_t;
437 1.2.4.2 yamt
438 1.2.4.2 yamt /*
439 1.2.4.2 yamt * For an explanation, please see the following:
440 1.2.4.2 yamt * RFC1832 - Sections 3.11, 4.4, and 4.5.
441 1.2.4.2 yamt */
442 1.2.4.2 yamt #define XDRALIGN(x) ((((x) % 4) != 0) ? ((((x) + 3) / 4) * 4) : (x))
443 1.2.4.2 yamt
444 1.2.4.2 yamt extern int ipf_proxy_add(void *, aproxy_t *);
445 1.2.4.2 yamt extern int ipf_proxy_check(fr_info_t *, struct nat *);
446 1.2.4.2 yamt extern int ipf_proxy_ctl(ipf_main_softc_t *, void *, ap_ctl_t *);
447 1.2.4.2 yamt extern int ipf_proxy_del(aproxy_t *);
448 1.2.4.3 yamt extern void ipf_proxy_deref(aproxy_t *);
449 1.2.4.2 yamt extern void ipf_proxy_flush(void *, int);
450 1.2.4.3 yamt extern void ipf_proxy_free(ipf_main_softc_t *, ap_session_t *);
451 1.2.4.2 yamt extern int ipf_proxy_init(void);
452 1.2.4.2 yamt extern int ipf_proxy_ioctl(ipf_main_softc_t *, void *, ioctlcmd_t, int, void *);
453 1.2.4.2 yamt extern aproxy_t *ipf_proxy_lookup(void *, u_int, char *);
454 1.2.4.2 yamt extern int ipf_proxy_match(fr_info_t *, struct nat *);
455 1.2.4.2 yamt extern int ipf_proxy_new(fr_info_t *, struct nat *);
456 1.2.4.2 yamt extern int ipf_proxy_ok(fr_info_t *, tcphdr_t *, struct ipnat *);
457 1.2.4.2 yamt extern void aps_free(ipf_main_softc_t *, void *, ap_session_t *);
458 1.2.4.2 yamt extern int ipf_proxy_main_load(void);
459 1.2.4.2 yamt extern int ipf_proxy_main_unload(void);
460 1.2.4.3 yamt extern ipnat_t *ipf_proxy_rule_fwd(nat_t *);
461 1.2.4.3 yamt extern ipnat_t *ipf_proxy_rule_rev(nat_t *);
462 1.2.4.2 yamt extern void *ipf_proxy_soft_create(ipf_main_softc_t *);
463 1.2.4.2 yamt extern void ipf_proxy_soft_destroy(ipf_main_softc_t *, void *);
464 1.2.4.2 yamt extern int ipf_proxy_soft_fini(ipf_main_softc_t *, void *);
465 1.2.4.3 yamt extern int ipf_proxy_soft_init(ipf_main_softc_t *, void *);
466 1.2.4.2 yamt
467 1.2.4.2 yamt #endif /* _NETINET_IP_PROXY_H_ */
468