xref: /illumos-gate/usr/src/uts/common/inet/ipf/netinet/ip_frag.h (revision 69a119caa6570c7077699161b7c28b6ee9f8b0f4)
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 
18 typedef	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 
39 typedef	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 
55 extern	int	fr_fraginit __P((ipf_stack_t *));
56 extern	void	fr_fragunload __P((ipf_stack_t *));
57 extern	ipfrstat_t	*fr_fragstats __P((ipf_stack_t *));
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 extern  void    fr_fragderef __P((ipfr_t **, ipfrwlock_t *, ipf_stack_t *));
68 
69 extern	void	fr_forget __P((void *, ipf_stack_t *));
70 extern	void	fr_forgetnat __P((void *, ipf_stack_t *));
71 extern	void	fr_fragclear __P((ipf_stack_t *));
72 extern	void	fr_fragexpire __P((ipf_stack_t *));
73 extern	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) || SOLARIS || defined(__sgi) \
77 	        || defined(__osf__) || (defined(__sgi) && (IRIX >= 60500)))
78 # if defined(SOLARIS2) && (SOLARIS2 < 7)
79 extern	void	fr_slowtimer __P((void *));
80 # else
81 extern	void	fr_slowtimer __P((void *));
82 # endif
83 #else
84 # if defined(linux) && defined(_KERNEL)
85 extern	void	fr_slowtimer __P((long));
86 # else
87 extern	int	fr_slowtimer __P((void *));
88 # endif
89 #endif
90 
91 #endif	/* __IP_FRAG_H__ */
92