1 /*
2  * Copyright (C) 1993-2001 by Darren Reed.
3  *
4  * See the IPFILTER.LICENCE file for details on licencing.
5  *
6  * @(#)ip_frag.h	1.5 3/24/96
7  * $Id: ip_frag.h,v 2.22 2003/06/24 11:13:53 darrenr Exp $
8  */
9 
10 #ifndef	__IP_FRAG_H__
11 #define	__IP_FRAG_H__
12 
13 #define	IPFT_SIZE	257
14 
15 typedef	struct	ipfr	{
16 	struct	ipfr	*ipfr_hnext, **ipfr_hprev;
17 	struct	ipfr	*ipfr_next, **ipfr_prev;
18 	void	*ipfr_data;
19 	void	*ipfr_ifp;
20 	struct	in_addr	ipfr_src;
21 	struct	in_addr	ipfr_dst;
22 	u_32_t	ipfr_optmsk;
23 	u_short	ipfr_secmsk;
24 	u_short	ipfr_auth;
25 	u_short	ipfr_id;
26 	u_char	ipfr_p;
27 	u_char	ipfr_tos;
28 	u_32_t	ipfr_pass;
29 	u_short	ipfr_off;
30 	u_char	ipfr_ttl;
31 	u_char	ipfr_seen0;
32 	frentry_t *ipfr_rule;
33 } ipfr_t;
34 
35 
36 typedef	struct	ipfrstat {
37 	u_long	ifs_exists;	/* add & already exists */
38 	u_long	ifs_nomem;
39 	u_long	ifs_new;
40 	u_long	ifs_hits;
41 	u_long	ifs_expire;
42 	u_long	ifs_inuse;
43 	u_long	ifs_retrans0;
44 	u_long	ifs_short;
45 	struct	ipfr	**ifs_table;
46 	struct	ipfr	**ifs_nattab;
47 } ipfrstat_t;
48 
49 #define	IPFR_CMPSZ	(offsetof(ipfr_t, ipfr_pass) - \
50 			 offsetof(ipfr_t, ipfr_ifp))
51 
52 extern	int	ipfr_size;
53 extern	int	fr_ipfrttl;
54 extern	int	fr_frag_lock;
55 extern	int	fr_fraginit __P((void));
56 extern	void	fr_fragunload __P((void));
57 extern	ipfrstat_t	*fr_fragstats __P((void));
58 
59 extern	int	fr_newfrag __P((fr_info_t *, u_32_t));
60 extern	frentry_t *fr_knownfrag __P((fr_info_t *, u_32_t *));
61 
62 extern	int	fr_nat_newfrag __P((fr_info_t *, u_32_t, struct nat *));
63 extern	nat_t	*fr_nat_knownfrag __P((fr_info_t *));
64 
65 extern	int	fr_ipid_newfrag __P((fr_info_t *, u_32_t));
66 extern	u_32_t	fr_ipid_knownfrag __P((fr_info_t *));
67 
68 extern	void	fr_forget __P((void *));
69 extern	void	fr_forgetnat __P((void *));
70 extern	void	fr_fragclear __P((void));
71 extern	void	fr_fragexpire __P((void));
72 
73 #if     defined(_KERNEL) && ((BSD >= 199306) || SOLARIS || defined(__sgi) \
74 	        || defined(__osf__) || (defined(__sgi) && (IRIX >= 605)))
75 # if defined(SOLARIS2) && (SOLARIS2 < 7)
76 extern	void	fr_slowtimer __P((void));
77 # else
78 #ifndef _KERNEL
79 extern	void	fr_slowtimer __P((void *));
80 #endif
81 # endif
82 #else
83 extern	int	fr_slowtimer __P((void));
84 #endif
85 
86 #endif	/* __IP_FIL_H__ */
87