1 /*
2 * Copyright (C) 1997 by Darren Reed.
3 *
4 * Redistribution and use in source and binary forms are permitted
5 * provided that this notice is preserved and due credit is given
6 * to the original author and the contributors.
7 *
8 * $FreeBSD$
9 */
10
11 #ifndef __IP_PROXY_H__
12 #define __IP_PROXY_H__
13
14 #ifndef SOLARIS
15 #define SOLARIS (defined(sun) && (defined(__svr4__) || defined(__SVR4)))
16 #endif
17
18 #ifndef APR_LABELLEN
19 #define APR_LABELLEN 16
20 #endif
21 #define AP_SESS_SIZE 53
22
23 struct nat;
24 struct ipnat;
25
26 typedef struct ap_tcp {
27 u_short apt_sport; /* source port */
28 u_short apt_dport; /* destination port */
29 short apt_sel; /* seqoff/after set selector */
30 short apt_seqoff[2]; /* sequence # difference */
31 tcp_seq apt_after[2]; /* don't change seq-off until after this */
32 u_char apt_state[2]; /* connection state */
33 } ap_tcp_t;
34
35 typedef struct ap_udp {
36 u_short apu_sport; /* source port */
37 u_short apu_dport; /* destination port */
38 } ap_udp_t;
39
40 typedef struct ap_session {
41 struct aproxy *aps_apr;
42 struct in_addr aps_src; /* source IP# */
43 struct in_addr aps_dst; /* destination IP# */
44 u_char aps_p; /* protocol */
45 union {
46 struct ap_tcp apu_tcp;
47 struct ap_udp apu_udp;
48 } aps_un;
49 u_int aps_flags;
50 QUAD_T aps_bytes; /* bytes sent */
51 QUAD_T aps_pkts; /* packets sent */
52 u_long aps_tout; /* time left before expiring */
53 void *aps_data; /* private data */
54 int aps_psiz; /* size of private data */
55 struct ap_session *aps_next;
56 } ap_session_t ;
57
58 #define aps_sport aps_un.apu_tcp.apt_sport
59 #define aps_dport aps_un.apu_tcp.apt_dport
60 #define aps_sel aps_un.apu_tcp.apt_sel
61 #define aps_seqoff aps_un.apu_tcp.apt_seqoff
62 #define aps_after aps_un.apu_tcp.apt_after
63 #define aps_state aps_un.apu_tcp.apt_state
64
65
66 typedef struct aproxy {
67 char apr_label[APR_LABELLEN]; /* Proxy label # */
68 u_char apr_p; /* protocol */
69 int apr_ref; /* +1 per rule referencing it */
70 int apr_flags;
71 int (* apr_init) __P((fr_info_t *, ip_t *, tcphdr_t *,
72 ap_session_t *, struct nat *));
73 int (* apr_inpkt) __P((fr_info_t *, ip_t *, tcphdr_t *,
74 ap_session_t *, struct nat *));
75 int (* apr_outpkt) __P((fr_info_t *, ip_t *, tcphdr_t *,
76 ap_session_t *, struct nat *));
77 } aproxy_t;
78
79 #define APR_DELETE 1
80
81
82 extern ap_session_t *ap_sess_tab[AP_SESS_SIZE];
83 extern aproxy_t ap_proxies[];
84
85 extern int ap_ok __P((ip_t *, tcphdr_t *, struct ipnat *));
86 extern void ap_unload __P((void));
87 extern void ap_free __P((aproxy_t *));
88 extern void aps_free __P((ap_session_t *));
89 extern int ap_check __P((ip_t *, tcphdr_t *, fr_info_t *, struct nat *));
90 extern aproxy_t *ap_match __P((u_char, char *));
91 extern void ap_expire __P((void));
92
93 #endif /* __IP_PROXY_H__ */
Cache object: 00a4c4f6d8cfa887d6301ca58179c6c4
|