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.23.2.2 2005/06/10 18:02:37 darrenr Exp $
8 *
9 * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
10 * Use is subject to license terms.
11 */
12
13#ifndef	__IP_FRAG_H__
14#define	__IP_FRAG_H__
15
16#define	IPFT_SIZE	257
17
18typedef	struct	ipfr	{
19	struct	ipfr	*ipfr_hnext, **ipfr_hprev;
20	struct	ipfr	*ipfr_next, **ipfr_prev;
21	void	*ipfr_data;
22	void	*ipfr_ifp;
23	i6addr_t	ipfr_src;
24	i6addr_t	ipfr_dst;
25	u_32_t	ipfr_optmsk;
26	u_short	ipfr_secmsk;
27	u_short	ipfr_auth;
28	u_32_t	ipfr_id;
29	u_32_t	ipfr_p;
30	u_32_t	ipfr_tos;
31	u_32_t	ipfr_pass;
32	u_short	ipfr_off;
33	u_long	ipfr_ttl;
34	u_char	ipfr_seen0;
35	frentry_t *ipfr_rule;
36	int	ipfr_ref;
37} ipfr_t;
38
39typedef	struct	ipfrstat {
40	u_long	ifs_exists;	/* add & already exists */
41	u_long	ifs_nomem;
42	u_long	ifs_new;
43	u_long	ifs_hits;
44	u_long	ifs_expire;
45	u_long	ifs_inuse;
46	u_long	ifs_retrans0;
47	u_long	ifs_short;
48	struct	ipfr	**ifs_table;
49	struct	ipfr	**ifs_nattab;
50} ipfrstat_t;
51
52#define	IPFR_CMPSZ	(offsetof(ipfr_t, ipfr_tos) - \
53			 offsetof(ipfr_t, ipfr_ifp))
54
55extern	int	fr_fraginit __P((ipf_stack_t *));
56extern	void	fr_fragunload __P((ipf_stack_t *));
57extern	ipfrstat_t	*fr_fragstats __P((ipf_stack_t *));
58
59extern	int	fr_newfrag __P((fr_info_t *, u_32_t));
60extern	frentry_t *fr_knownfrag __P((fr_info_t *, u_32_t *));
61
62extern	int	fr_nat_newfrag __P((fr_info_t *, u_32_t, struct nat *));
63extern	nat_t	*fr_nat_knownfrag __P((fr_info_t *));
64
65extern	int	fr_ipid_newfrag __P((fr_info_t *, u_32_t));
66extern	u_32_t	fr_ipid_knownfrag __P((fr_info_t *));
67extern  void    fr_fragderef __P((ipfr_t **, ipfrwlock_t *, ipf_stack_t *));
68
69extern	void	fr_forget __P((void *, ipf_stack_t *));
70extern	void	fr_forgetnat __P((void *, ipf_stack_t *));
71extern	void	fr_fragclear __P((ipf_stack_t *));
72extern	void	fr_fragexpire __P((ipf_stack_t *));
73extern	int	fr_nextfrag __P((ipftoken_t *, ipfgeniter_t *, ipfr_t **, \
74				 ipfr_t ***, ipfrwlock_t *, ipf_stack_t *));
75
76#if     defined(_KERNEL) && ((BSD >= 199306) || defined(SOLARIS) || \
77	defined(__sgi) || defined(__osf__) || \
78	(defined(__sgi) && (IRIX >= 60500)))
79# if defined(SOLARIS2) && (SOLARIS2 < 7)
80extern	void	fr_slowtimer __P((void *));
81# else
82extern	void	fr_slowtimer __P((void *));
83# endif
84#else
85# if defined(linux) && defined(_KERNEL)
86extern	void	fr_slowtimer __P((long));
87# else
88extern	int	fr_slowtimer __P((void *));
89# endif
90#endif
91
92#endif	/* __IP_FRAG_H__ */
93