1/*
|
2 * Copyright (C) 1997-2000 by Darren Reed.
|
2 * Copyright (C) 1997-2001 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.
|
4 * See the IPFILTER.LICENCE file for details on licencing. |
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 $ |
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; |
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__ */
|