]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/ipfilter/ip_proxy.h
This commit was generated by cvs2svn to compensate for changes in r54816,
[FreeBSD/FreeBSD.git] / contrib / ipfilter / ip_proxy.h
1 /*
2  * Copyright (C) 1997-1998 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  * $Id: ip_proxy.h,v 2.1.2.1 1999/09/19 12:18:20 darrenr Exp $
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[2];     /* {seq,ack}{off,min} set selector */
30         short   apt_seqoff[2];  /* sequence # difference */
31         tcp_seq apt_seqmin[2];  /* don't change seq-off until after this */
32         short   apt_ackoff[2];  /* sequence # difference */
33         tcp_seq apt_ackmin[2];  /* don't change seq-off until after this */
34         u_char  apt_state[2];   /* connection state */
35 } ap_tcp_t;
36
37 typedef struct  ap_udp {
38         u_short apu_sport;      /* source port */
39         u_short apu_dport;      /* destination port */
40 } ap_udp_t;
41
42 typedef struct ap_session {
43         struct  aproxy  *aps_apr;
44         union {
45                 struct  ap_tcp  apu_tcp;
46                 struct  ap_udp  apu_udp;
47         } aps_un;
48         u_int   aps_flags;
49         U_QUAD_T aps_bytes;     /* bytes sent */
50         U_QUAD_T aps_pkts;      /* packets sent */
51         void    *aps_nat;       /* pointer back to nat struct */
52         void    *aps_data;      /* private data */
53         int     aps_p;          /* protocol */
54         int     aps_psiz;       /* size of private data */
55         struct  ap_session      *aps_hnext;
56         struct  ap_session      *aps_next;
57 } ap_session_t ;
58
59 #define aps_sport       aps_un.apu_tcp.apt_sport
60 #define aps_dport       aps_un.apu_tcp.apt_dport
61 #define aps_sel         aps_un.apu_tcp.apt_sel
62 #define aps_seqoff      aps_un.apu_tcp.apt_seqoff
63 #define aps_seqmin      aps_un.apu_tcp.apt_seqmin
64 #define aps_state       aps_un.apu_tcp.apt_state
65 #define aps_ackoff      aps_un.apu_tcp.apt_ackoff
66 #define aps_ackmin      aps_un.apu_tcp.apt_ackmin
67
68
69 typedef struct  aproxy  {
70         char    apr_label[APR_LABELLEN];        /* Proxy label # */
71         u_char  apr_p;          /* protocol */
72         int     apr_ref;        /* +1 per rule referencing it */
73         int     apr_flags;
74         int     (* apr_init) __P((void));
75         int     (* apr_new) __P((fr_info_t *, ip_t *,
76                                  ap_session_t *, struct nat *));
77         int     (* apr_inpkt) __P((fr_info_t *, ip_t *,
78                                    ap_session_t *, struct nat *));
79         int     (* apr_outpkt) __P((fr_info_t *, ip_t *,
80                                     ap_session_t *, struct nat *));
81 } aproxy_t;
82
83 #define APR_DELETE      1
84
85
86 /*
87  * Real audio proxy structure and #defines
88  */
89 typedef struct  {
90         int     rap_seenpna;
91         int     rap_seenver;
92         int     rap_version;
93         int     rap_eos;        /* End Of Startup */
94         int     rap_gotid;
95         int     rap_gotlen;
96         int     rap_mode;
97         int     rap_sdone;
98         u_short rap_plport;
99         u_short rap_prport;
100         u_short rap_srport;
101         char    rap_svr[19];
102         u_32_t  rap_sbf;        /* flag to indicate which of the 19 bytes have
103                                  * been filled
104                                  */
105         tcp_seq rap_sseq;
106 } raudio_t;
107
108 #define RA_ID_END       0
109 #define RA_ID_UDP       1
110 #define RA_ID_ROBUST    7
111
112 #define RAP_M_UDP       1
113 #define RAP_M_ROBUST    2
114 #define RAP_M_TCP       4
115 #define RAP_M_UDP_ROBUST        (RAP_M_UDP|RAP_M_ROBUST)
116
117
118 extern  ap_session_t    *ap_sess_tab[AP_SESS_SIZE];
119 extern  ap_session_t    *ap_sess_list;
120 extern  aproxy_t        ap_proxies[];
121
122 extern  int     appr_init __P((void));
123 extern  int     appr_ok __P((ip_t *, tcphdr_t *, struct ipnat *));
124 extern  void    appr_free __P((aproxy_t *));
125 extern  void    aps_free __P((ap_session_t *));
126 extern  int     appr_check __P((ip_t *, fr_info_t *, struct nat *));
127 extern  aproxy_t        *appr_match __P((u_int, char *));
128
129 #endif /* __IP_PROXY_H__ */