1/*
| 1/*
|
2 * Copyright (C) 1997-2000 by Darren Reed.
| 2 * Copyright (C) 1997-2001 by Darren Reed.
|
3 *
| 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.
| 4 * See the IPFILTER.LICENCE file for details on licencing.
|
7 * 8 * $Id: ip_proxy.h,v 2.8.2.4 2000/12/02 00:15:03 darrenr Exp $
| 5 * 6 * $Id: ip_proxy.h,v 2.8.2.4 2000/12/02 00:15:03 darrenr Exp $
|
9 * $FreeBSD: head/sys/contrib/ipfilter/netinet/ip_proxy.h 72006 2001-02-04 14:26:56Z darrenr $
| 7 * $FreeBSD: head/sys/contrib/ipfilter/netinet/ip_proxy.h 80482 2001-07-28 11:58:26Z darrenr $
|
10 */ 11 12#ifndef __IP_PROXY_H__ 13#define __IP_PROXY_H__ 14 15#ifndef SOLARIS 16#define SOLARIS (defined(sun) && (defined(__svr4__) || defined(__SVR4))) 17#endif 18 19#ifndef APR_LABELLEN 20#define APR_LABELLEN 16 21#endif 22#define AP_SESS_SIZE 53 23 24struct nat; 25struct ipnat; 26 27typedef struct ap_tcp { 28 u_short apt_sport; /* source port */ 29 u_short apt_dport; /* destination port */ 30 short apt_sel[2]; /* {seq,ack}{off,min} set selector */ 31 short apt_seqoff[2]; /* sequence # difference */ 32 tcp_seq apt_seqmin[2]; /* don't change seq-off until after this */ 33 short apt_ackoff[2]; /* sequence # difference */ 34 tcp_seq apt_ackmin[2]; /* don't change seq-off until after this */ 35 u_char apt_state[2]; /* connection state */ 36} ap_tcp_t; 37 38typedef struct ap_udp { 39 u_short apu_sport; /* source port */ 40 u_short apu_dport; /* destination port */ 41} ap_udp_t; 42 43typedef struct ap_session { 44 struct aproxy *aps_apr; 45 union { 46 struct ap_tcp apu_tcp; 47 struct ap_udp apu_udp; 48 } aps_un; 49 u_int aps_flags; 50 U_QUAD_T aps_bytes; /* bytes sent */ 51 U_QUAD_T aps_pkts; /* packets sent */ 52 void *aps_nat; /* pointer back to nat struct */ 53 void *aps_data; /* private data */ 54 int aps_p; /* protocol */ 55 int aps_psiz; /* size of private data */ 56 struct ap_session *aps_hnext; 57 struct ap_session *aps_next; 58} ap_session_t; 59 60#define aps_sport aps_un.apu_tcp.apt_sport 61#define aps_dport aps_un.apu_tcp.apt_dport 62#define aps_sel aps_un.apu_tcp.apt_sel 63#define aps_seqoff aps_un.apu_tcp.apt_seqoff 64#define aps_seqmin aps_un.apu_tcp.apt_seqmin 65#define aps_state aps_un.apu_tcp.apt_state 66#define aps_ackoff aps_un.apu_tcp.apt_ackoff 67#define aps_ackmin aps_un.apu_tcp.apt_ackmin 68 69 70typedef struct aproxy { 71 struct aproxy *apr_next; 72 char apr_label[APR_LABELLEN]; /* Proxy label # */ 73 u_char apr_p; /* protocol */ 74 int apr_ref; /* +1 per rule referencing it */ 75 int apr_flags; 76 int (* apr_init) __P((void)); 77 void (* apr_fini) __P((void)); 78 int (* apr_new) __P((fr_info_t *, ip_t *, 79 ap_session_t *, struct nat *)); 80 int (* apr_inpkt) __P((fr_info_t *, ip_t *, 81 ap_session_t *, struct nat *)); 82 int (* apr_outpkt) __P((fr_info_t *, ip_t *, 83 ap_session_t *, struct nat *)); 84} aproxy_t; 85 86#define APR_DELETE 1 87 88#define APR_ERR(x) (((x) & 0xffff) << 16) 89#define APR_EXIT(x) (((x) >> 16) & 0xffff) 90#define APR_INC(x) ((x) & 0xffff) 91 92#define FTP_BUFSZ 160 93/* 94 * For the ftp proxy. 95 */ 96typedef struct ftpside { 97 char *ftps_rptr; 98 char *ftps_wptr; 99 u_32_t ftps_seq; 100 u_32_t ftps_len; 101 int ftps_junk; 102 char ftps_buf[FTP_BUFSZ]; 103} ftpside_t; 104 105typedef struct ftpinfo {
| 8 */ 9 10#ifndef __IP_PROXY_H__ 11#define __IP_PROXY_H__ 12 13#ifndef SOLARIS 14#define SOLARIS (defined(sun) && (defined(__svr4__) || defined(__SVR4))) 15#endif 16 17#ifndef APR_LABELLEN 18#define APR_LABELLEN 16 19#endif 20#define AP_SESS_SIZE 53 21 22struct nat; 23struct ipnat; 24 25typedef struct ap_tcp { 26 u_short apt_sport; /* source port */ 27 u_short apt_dport; /* destination port */ 28 short apt_sel[2]; /* {seq,ack}{off,min} set selector */ 29 short apt_seqoff[2]; /* sequence # difference */ 30 tcp_seq apt_seqmin[2]; /* don't change seq-off until after this */ 31 short apt_ackoff[2]; /* sequence # difference */ 32 tcp_seq apt_ackmin[2]; /* don't change seq-off until after this */ 33 u_char apt_state[2]; /* connection state */ 34} ap_tcp_t; 35 36typedef struct ap_udp { 37 u_short apu_sport; /* source port */ 38 u_short apu_dport; /* destination port */ 39} ap_udp_t; 40 41typedef struct ap_session { 42 struct aproxy *aps_apr; 43 union { 44 struct ap_tcp apu_tcp; 45 struct ap_udp apu_udp; 46 } aps_un; 47 u_int aps_flags; 48 U_QUAD_T aps_bytes; /* bytes sent */ 49 U_QUAD_T aps_pkts; /* packets sent */ 50 void *aps_nat; /* pointer back to nat struct */ 51 void *aps_data; /* private data */ 52 int aps_p; /* protocol */ 53 int aps_psiz; /* size of private data */ 54 struct ap_session *aps_hnext; 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_seqmin aps_un.apu_tcp.apt_seqmin 63#define aps_state aps_un.apu_tcp.apt_state 64#define aps_ackoff aps_un.apu_tcp.apt_ackoff 65#define aps_ackmin aps_un.apu_tcp.apt_ackmin 66 67 68typedef struct aproxy { 69 struct aproxy *apr_next; 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 void (* apr_fini) __P((void)); 76 int (* apr_new) __P((fr_info_t *, ip_t *, 77 ap_session_t *, struct nat *)); 78 int (* apr_inpkt) __P((fr_info_t *, ip_t *, 79 ap_session_t *, struct nat *)); 80 int (* apr_outpkt) __P((fr_info_t *, ip_t *, 81 ap_session_t *, struct nat *)); 82} aproxy_t; 83 84#define APR_DELETE 1 85 86#define APR_ERR(x) (((x) & 0xffff) << 16) 87#define APR_EXIT(x) (((x) >> 16) & 0xffff) 88#define APR_INC(x) ((x) & 0xffff) 89 90#define FTP_BUFSZ 160 91/* 92 * For the ftp proxy. 93 */ 94typedef struct ftpside { 95 char *ftps_rptr; 96 char *ftps_wptr; 97 u_32_t ftps_seq; 98 u_32_t ftps_len; 99 int ftps_junk; 100 char ftps_buf[FTP_BUFSZ]; 101} ftpside_t; 102 103typedef struct ftpinfo {
|
106 u_int ftp_passok;
| 104 int ftp_passok; 105 int ftp_incok;
|
107 ftpside_t ftp_side[2]; 108} ftpinfo_t; 109 110/* 111 * Real audio proxy structure and #defines 112 */ 113typedef struct { 114 int rap_seenpna; 115 int rap_seenver; 116 int rap_version; 117 int rap_eos; /* End Of Startup */ 118 int rap_gotid; 119 int rap_gotlen; 120 int rap_mode; 121 int rap_sdone; 122 u_short rap_plport; 123 u_short rap_prport; 124 u_short rap_srport; 125 char rap_svr[19]; 126 u_32_t rap_sbf; /* flag to indicate which of the 19 bytes have 127 * been filled 128 */ 129 tcp_seq rap_sseq; 130} raudio_t; 131 132#define RA_ID_END 0 133#define RA_ID_UDP 1 134#define RA_ID_ROBUST 7 135 136#define RAP_M_UDP 1 137#define RAP_M_ROBUST 2 138#define RAP_M_TCP 4 139#define RAP_M_UDP_ROBUST (RAP_M_UDP|RAP_M_ROBUST) 140 141 142extern ap_session_t *ap_sess_tab[AP_SESS_SIZE]; 143extern ap_session_t *ap_sess_list; 144extern aproxy_t ap_proxies[]; 145extern int ippr_ftp_pasvonly; 146 147extern int appr_add __P((aproxy_t *)); 148extern int appr_del __P((aproxy_t *)); 149extern int appr_init __P((void)); 150extern void appr_unload __P((void)); 151extern int appr_ok __P((ip_t *, tcphdr_t *, struct ipnat *)); 152extern void appr_free __P((aproxy_t *)); 153extern void aps_free __P((ap_session_t *)); 154extern int appr_check __P((ip_t *, fr_info_t *, struct nat *)); 155extern aproxy_t *appr_match __P((u_int, char *)); 156 157#endif /* __IP_PROXY_H__ */
| 106 ftpside_t ftp_side[2]; 107} ftpinfo_t; 108 109/* 110 * Real audio proxy structure and #defines 111 */ 112typedef struct { 113 int rap_seenpna; 114 int rap_seenver; 115 int rap_version; 116 int rap_eos; /* End Of Startup */ 117 int rap_gotid; 118 int rap_gotlen; 119 int rap_mode; 120 int rap_sdone; 121 u_short rap_plport; 122 u_short rap_prport; 123 u_short rap_srport; 124 char rap_svr[19]; 125 u_32_t rap_sbf; /* flag to indicate which of the 19 bytes have 126 * been filled 127 */ 128 tcp_seq rap_sseq; 129} raudio_t; 130 131#define RA_ID_END 0 132#define RA_ID_UDP 1 133#define RA_ID_ROBUST 7 134 135#define RAP_M_UDP 1 136#define RAP_M_ROBUST 2 137#define RAP_M_TCP 4 138#define RAP_M_UDP_ROBUST (RAP_M_UDP|RAP_M_ROBUST) 139 140 141extern ap_session_t *ap_sess_tab[AP_SESS_SIZE]; 142extern ap_session_t *ap_sess_list; 143extern aproxy_t ap_proxies[]; 144extern int ippr_ftp_pasvonly; 145 146extern int appr_add __P((aproxy_t *)); 147extern int appr_del __P((aproxy_t *)); 148extern int appr_init __P((void)); 149extern void appr_unload __P((void)); 150extern int appr_ok __P((ip_t *, tcphdr_t *, struct ipnat *)); 151extern void appr_free __P((aproxy_t *)); 152extern void aps_free __P((ap_session_t *)); 153extern int appr_check __P((ip_t *, fr_info_t *, struct nat *)); 154extern aproxy_t *appr_match __P((u_int, char *)); 155 156#endif /* __IP_PROXY_H__ */
|