2001-03-26 10:11:46 +04:00
|
|
|
/* $NetBSD: ip_proxy.h,v 1.16 2001/03/26 06:13:14 mike Exp $ */
|
1997-05-28 04:17:11 +04:00
|
|
|
|
1997-05-26 19:18:15 +04:00
|
|
|
/*
|
2000-05-03 15:12:03 +04:00
|
|
|
* Copyright (C) 1997-2000 by Darren Reed.
|
1997-05-26 19:18:15 +04:00
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms are permitted
|
|
|
|
* provided that this notice is preserved and due credit is given
|
|
|
|
* to the original author and the contributors.
|
|
|
|
*
|
2001-03-26 10:11:46 +04:00
|
|
|
* Id: ip_proxy.h,v 2.8.2.4 2000/12/02 00:15:03 darrenr Exp
|
1997-05-26 19:18:15 +04:00
|
|
|
*/
|
|
|
|
|
1998-02-10 04:26:19 +03:00
|
|
|
#ifndef _NETINET_IP_PROXY_H_
|
|
|
|
#define _NETINET_IP_PROXY_H_
|
1997-05-26 19:18:15 +04:00
|
|
|
|
|
|
|
#ifndef SOLARIS
|
|
|
|
#define SOLARIS (defined(sun) && (defined(__svr4__) || defined(__SVR4)))
|
|
|
|
#endif
|
|
|
|
|
1997-07-05 09:38:14 +04:00
|
|
|
#ifndef APR_LABELLEN
|
1997-05-26 19:18:15 +04:00
|
|
|
#define APR_LABELLEN 16
|
1997-07-05 09:38:14 +04:00
|
|
|
#endif
|
1997-05-26 19:18:15 +04:00
|
|
|
#define AP_SESS_SIZE 53
|
|
|
|
|
|
|
|
struct nat;
|
1997-05-27 05:23:50 +04:00
|
|
|
struct ipnat;
|
1997-05-26 19:18:15 +04:00
|
|
|
|
|
|
|
typedef struct ap_tcp {
|
|
|
|
u_short apt_sport; /* source port */
|
|
|
|
u_short apt_dport; /* destination port */
|
1998-11-22 18:17:18 +03:00
|
|
|
short apt_sel[2]; /* {seq,ack}{off,min} set selector */
|
1997-10-30 19:08:54 +03:00
|
|
|
short apt_seqoff[2]; /* sequence # difference */
|
1998-11-22 18:17:18 +03:00
|
|
|
tcp_seq apt_seqmin[2]; /* don't change seq-off until after this */
|
|
|
|
short apt_ackoff[2]; /* sequence # difference */
|
|
|
|
tcp_seq apt_ackmin[2]; /* don't change seq-off until after this */
|
1997-10-30 19:08:54 +03:00
|
|
|
u_char apt_state[2]; /* connection state */
|
1997-05-26 19:18:15 +04:00
|
|
|
} ap_tcp_t;
|
|
|
|
|
|
|
|
typedef struct ap_udp {
|
|
|
|
u_short apu_sport; /* source port */
|
|
|
|
u_short apu_dport; /* destination port */
|
|
|
|
} ap_udp_t;
|
|
|
|
|
|
|
|
typedef struct ap_session {
|
|
|
|
struct aproxy *aps_apr;
|
|
|
|
union {
|
|
|
|
struct ap_tcp apu_tcp;
|
|
|
|
struct ap_udp apu_udp;
|
|
|
|
} aps_un;
|
|
|
|
u_int aps_flags;
|
1998-11-22 18:17:18 +03:00
|
|
|
U_QUAD_T aps_bytes; /* bytes sent */
|
|
|
|
U_QUAD_T aps_pkts; /* packets sent */
|
|
|
|
void *aps_nat; /* pointer back to nat struct */
|
1997-05-26 19:18:15 +04:00
|
|
|
void *aps_data; /* private data */
|
1999-12-12 14:11:15 +03:00
|
|
|
int aps_p; /* protocol */
|
1997-05-26 19:18:15 +04:00
|
|
|
int aps_psiz; /* size of private data */
|
1998-11-22 18:17:18 +03:00
|
|
|
struct ap_session *aps_hnext;
|
1997-05-26 19:18:15 +04:00
|
|
|
struct ap_session *aps_next;
|
2000-05-03 15:12:03 +04:00
|
|
|
} ap_session_t;
|
1997-05-26 19:18:15 +04:00
|
|
|
|
|
|
|
#define aps_sport aps_un.apu_tcp.apt_sport
|
|
|
|
#define aps_dport aps_un.apu_tcp.apt_dport
|
1997-10-30 19:08:54 +03:00
|
|
|
#define aps_sel aps_un.apu_tcp.apt_sel
|
1997-05-26 19:18:15 +04:00
|
|
|
#define aps_seqoff aps_un.apu_tcp.apt_seqoff
|
1998-11-22 18:17:18 +03:00
|
|
|
#define aps_seqmin aps_un.apu_tcp.apt_seqmin
|
1997-10-30 19:08:54 +03:00
|
|
|
#define aps_state aps_un.apu_tcp.apt_state
|
1998-11-22 18:17:18 +03:00
|
|
|
#define aps_ackoff aps_un.apu_tcp.apt_ackoff
|
|
|
|
#define aps_ackmin aps_un.apu_tcp.apt_ackmin
|
1997-05-26 19:18:15 +04:00
|
|
|
|
|
|
|
|
|
|
|
typedef struct aproxy {
|
2000-05-03 15:12:03 +04:00
|
|
|
struct aproxy *apr_next;
|
1997-05-26 19:18:15 +04:00
|
|
|
char apr_label[APR_LABELLEN]; /* Proxy label # */
|
1997-07-05 09:38:14 +04:00
|
|
|
u_char apr_p; /* protocol */
|
1997-05-26 19:18:15 +04:00
|
|
|
int apr_ref; /* +1 per rule referencing it */
|
|
|
|
int apr_flags;
|
1999-12-12 14:11:15 +03:00
|
|
|
int (* apr_init) __P((void));
|
2000-05-03 15:12:03 +04:00
|
|
|
void (* apr_fini) __P((void));
|
1999-12-12 14:11:15 +03:00
|
|
|
int (* apr_new) __P((fr_info_t *, ip_t *,
|
|
|
|
ap_session_t *, struct nat *));
|
1998-11-22 18:17:18 +03:00
|
|
|
int (* apr_inpkt) __P((fr_info_t *, ip_t *,
|
1997-05-26 19:18:15 +04:00
|
|
|
ap_session_t *, struct nat *));
|
1998-11-22 18:17:18 +03:00
|
|
|
int (* apr_outpkt) __P((fr_info_t *, ip_t *,
|
1997-05-26 19:18:15 +04:00
|
|
|
ap_session_t *, struct nat *));
|
|
|
|
} aproxy_t;
|
|
|
|
|
|
|
|
#define APR_DELETE 1
|
|
|
|
|
2000-05-11 23:46:05 +04:00
|
|
|
#define APR_ERR(x) (((x) & 0xffff) << 16)
|
|
|
|
#define APR_EXIT(x) (((x) >> 16) & 0xffff)
|
|
|
|
#define APR_INC(x) ((x) & 0xffff)
|
1997-05-26 19:18:15 +04:00
|
|
|
|
2000-05-11 23:46:05 +04:00
|
|
|
#define FTP_BUFSZ 160
|
2000-05-03 15:12:03 +04:00
|
|
|
/*
|
|
|
|
* For the ftp proxy.
|
|
|
|
*/
|
2000-05-11 23:46:05 +04:00
|
|
|
typedef struct ftpside {
|
|
|
|
char *ftps_rptr;
|
|
|
|
char *ftps_wptr;
|
|
|
|
u_32_t ftps_seq;
|
2001-03-26 10:11:46 +04:00
|
|
|
u_32_t ftps_len;
|
2000-05-11 23:46:05 +04:00
|
|
|
int ftps_junk;
|
|
|
|
char ftps_buf[FTP_BUFSZ];
|
|
|
|
} ftpside_t;
|
|
|
|
|
2000-05-03 15:12:03 +04:00
|
|
|
typedef struct ftpinfo {
|
2000-05-11 23:46:05 +04:00
|
|
|
u_int ftp_passok;
|
|
|
|
ftpside_t ftp_side[2];
|
2000-05-03 15:12:03 +04:00
|
|
|
} ftpinfo_t;
|
|
|
|
|
1999-12-12 14:11:15 +03:00
|
|
|
/*
|
|
|
|
* Real audio proxy structure and #defines
|
|
|
|
*/
|
|
|
|
typedef struct {
|
|
|
|
int rap_seenpna;
|
|
|
|
int rap_seenver;
|
|
|
|
int rap_version;
|
|
|
|
int rap_eos; /* End Of Startup */
|
|
|
|
int rap_gotid;
|
|
|
|
int rap_gotlen;
|
|
|
|
int rap_mode;
|
|
|
|
int rap_sdone;
|
|
|
|
u_short rap_plport;
|
|
|
|
u_short rap_prport;
|
|
|
|
u_short rap_srport;
|
|
|
|
char rap_svr[19];
|
|
|
|
u_32_t rap_sbf; /* flag to indicate which of the 19 bytes have
|
|
|
|
* been filled
|
|
|
|
*/
|
|
|
|
tcp_seq rap_sseq;
|
|
|
|
} raudio_t;
|
|
|
|
|
|
|
|
#define RA_ID_END 0
|
|
|
|
#define RA_ID_UDP 1
|
|
|
|
#define RA_ID_ROBUST 7
|
|
|
|
|
|
|
|
#define RAP_M_UDP 1
|
|
|
|
#define RAP_M_ROBUST 2
|
|
|
|
#define RAP_M_TCP 4
|
|
|
|
#define RAP_M_UDP_ROBUST (RAP_M_UDP|RAP_M_ROBUST)
|
|
|
|
|
|
|
|
|
1997-05-26 19:18:15 +04:00
|
|
|
extern ap_session_t *ap_sess_tab[AP_SESS_SIZE];
|
1998-11-22 18:17:18 +03:00
|
|
|
extern ap_session_t *ap_sess_list;
|
1997-05-26 19:18:15 +04:00
|
|
|
extern aproxy_t ap_proxies[];
|
2000-05-03 15:12:03 +04:00
|
|
|
extern int ippr_ftp_pasvonly;
|
1997-05-26 19:18:15 +04:00
|
|
|
|
2000-05-03 15:12:03 +04:00
|
|
|
extern int appr_add __P((aproxy_t *));
|
|
|
|
extern int appr_del __P((aproxy_t *));
|
1999-12-12 14:11:15 +03:00
|
|
|
extern int appr_init __P((void));
|
2000-05-03 15:12:03 +04:00
|
|
|
extern void appr_unload __P((void));
|
1999-12-12 14:11:15 +03:00
|
|
|
extern int appr_ok __P((ip_t *, tcphdr_t *, struct ipnat *));
|
|
|
|
extern void appr_free __P((aproxy_t *));
|
1997-07-05 09:38:14 +04:00
|
|
|
extern void aps_free __P((ap_session_t *));
|
1999-12-12 14:11:15 +03:00
|
|
|
extern int appr_check __P((ip_t *, fr_info_t *, struct nat *));
|
|
|
|
extern aproxy_t *appr_match __P((u_int, char *));
|
1997-05-26 19:18:15 +04:00
|
|
|
|
1998-02-10 04:26:19 +03:00
|
|
|
#endif /* _NETINET_IP_PROXY_H_ */
|