17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * Copyright (C) 1993-2001 by Darren Reed.
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * See the IPFILTER.LICENCE file for details on licencing.
57c478bd9Sstevel@tonic-gate  *
67c478bd9Sstevel@tonic-gate  * @(#)ip_frag.h	1.5 3/24/96
7ab25eeb5Syz  * $Id: ip_frag.h,v 2.23.2.2 2005/06/10 18:02:37 darrenr Exp $
87663b816Sml  *
9*f4b3ec61Sdh  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
107663b816Sml  * Use is subject to license terms.
117c478bd9Sstevel@tonic-gate  */
127c478bd9Sstevel@tonic-gate 
137663b816Sml #pragma ident	"%Z%%M%	%I%	%E% SMI"
147663b816Sml 
157c478bd9Sstevel@tonic-gate #ifndef	__IP_FRAG_H__
167c478bd9Sstevel@tonic-gate #define	__IP_FRAG_H__
177c478bd9Sstevel@tonic-gate 
187c478bd9Sstevel@tonic-gate #define	IPFT_SIZE	257
197c478bd9Sstevel@tonic-gate 
207c478bd9Sstevel@tonic-gate typedef	struct	ipfr	{
217c478bd9Sstevel@tonic-gate 	struct	ipfr	*ipfr_hnext, **ipfr_hprev;
227c478bd9Sstevel@tonic-gate 	struct	ipfr	*ipfr_next, **ipfr_prev;
237c478bd9Sstevel@tonic-gate 	void	*ipfr_data;
247c478bd9Sstevel@tonic-gate 	void	*ipfr_ifp;
257663b816Sml 	i6addr_t	ipfr_source;
267663b816Sml 	i6addr_t	ipfr_dest;
277c478bd9Sstevel@tonic-gate 	u_32_t	ipfr_optmsk;
287c478bd9Sstevel@tonic-gate 	u_short	ipfr_secmsk;
297c478bd9Sstevel@tonic-gate 	u_short	ipfr_auth;
307663b816Sml 	u_32_t	ipfr_id;
317c478bd9Sstevel@tonic-gate 	u_char	ipfr_p;
327c478bd9Sstevel@tonic-gate 	u_char	ipfr_tos;
337c478bd9Sstevel@tonic-gate 	u_32_t	ipfr_pass;
347c478bd9Sstevel@tonic-gate 	u_short	ipfr_off;
35*f4b3ec61Sdh 	u_long	ipfr_ttl;
367c478bd9Sstevel@tonic-gate 	u_char	ipfr_seen0;
377663b816Sml 	u_short ipfr_firstend;
387c478bd9Sstevel@tonic-gate 	frentry_t *ipfr_rule;
39*f4b3ec61Sdh 	int	ipfr_ref;
407c478bd9Sstevel@tonic-gate } ipfr_t;
417c478bd9Sstevel@tonic-gate 
42ab25eeb5Syz #define ipfr_src	ipfr_source.in4
43ab25eeb5Syz #define ipfr_dst	ipfr_dest.in4
447c478bd9Sstevel@tonic-gate 
457c478bd9Sstevel@tonic-gate typedef	struct	ipfrstat {
467c478bd9Sstevel@tonic-gate 	u_long	ifs_exists;	/* add & already exists */
477c478bd9Sstevel@tonic-gate 	u_long	ifs_nomem;
487c478bd9Sstevel@tonic-gate 	u_long	ifs_new;
497c478bd9Sstevel@tonic-gate 	u_long	ifs_hits;
507c478bd9Sstevel@tonic-gate 	u_long	ifs_expire;
517c478bd9Sstevel@tonic-gate 	u_long	ifs_inuse;
527c478bd9Sstevel@tonic-gate 	u_long	ifs_retrans0;
537c478bd9Sstevel@tonic-gate 	u_long	ifs_short;
547c478bd9Sstevel@tonic-gate 	struct	ipfr	**ifs_table;
557c478bd9Sstevel@tonic-gate 	struct	ipfr	**ifs_nattab;
567c478bd9Sstevel@tonic-gate } ipfrstat_t;
577c478bd9Sstevel@tonic-gate 
587663b816Sml #define	IPFR_CMPSZ	(offsetof(ipfr_t, ipfr_tos) - \
597c478bd9Sstevel@tonic-gate 			 offsetof(ipfr_t, ipfr_ifp))
607c478bd9Sstevel@tonic-gate 
61*f4b3ec61Sdh extern	int	fr_fraginit __P((ipf_stack_t *));
62*f4b3ec61Sdh extern	void	fr_fragunload __P((ipf_stack_t *));
63*f4b3ec61Sdh extern	ipfrstat_t	*fr_fragstats __P((ipf_stack_t *));
647c478bd9Sstevel@tonic-gate 
657c478bd9Sstevel@tonic-gate extern	int	fr_newfrag __P((fr_info_t *, u_32_t));
667c478bd9Sstevel@tonic-gate extern	frentry_t *fr_knownfrag __P((fr_info_t *, u_32_t *));
677c478bd9Sstevel@tonic-gate 
687c478bd9Sstevel@tonic-gate extern	int	fr_nat_newfrag __P((fr_info_t *, u_32_t, struct nat *));
697c478bd9Sstevel@tonic-gate extern	nat_t	*fr_nat_knownfrag __P((fr_info_t *));
707c478bd9Sstevel@tonic-gate 
717c478bd9Sstevel@tonic-gate extern	int	fr_ipid_newfrag __P((fr_info_t *, u_32_t));
727c478bd9Sstevel@tonic-gate extern	u_32_t	fr_ipid_knownfrag __P((fr_info_t *));
73*f4b3ec61Sdh extern  void    fr_fragderef __P((ipfr_t **, ipfrwlock_t *, ipf_stack_t *));
747c478bd9Sstevel@tonic-gate 
75*f4b3ec61Sdh extern	void	fr_forget __P((void *, ipf_stack_t *));
76*f4b3ec61Sdh extern	void	fr_forgetnat __P((void *, ipf_stack_t *));
77*f4b3ec61Sdh extern	void	fr_fragclear __P((ipf_stack_t *));
78*f4b3ec61Sdh extern	void	fr_fragexpire __P((ipf_stack_t *));
79*f4b3ec61Sdh extern	int	fr_nextfrag __P((ipftoken_t *, ipfgeniter_t *, ipfr_t **, \
80*f4b3ec61Sdh 				 ipfr_t ***, ipfrwlock_t *, ipf_stack_t *));
817c478bd9Sstevel@tonic-gate 
827c478bd9Sstevel@tonic-gate #if     defined(_KERNEL) && ((BSD >= 199306) || SOLARIS || defined(__sgi) \
83ab25eeb5Syz 	        || defined(__osf__) || (defined(__sgi) && (IRIX >= 60500)))
847c478bd9Sstevel@tonic-gate # if defined(SOLARIS2) && (SOLARIS2 < 7)
85*f4b3ec61Sdh extern	void	fr_slowtimer __P((void *));
867c478bd9Sstevel@tonic-gate # else
877c478bd9Sstevel@tonic-gate extern	void	fr_slowtimer __P((void *));
887c478bd9Sstevel@tonic-gate # endif
897c478bd9Sstevel@tonic-gate #else
90ab25eeb5Syz # if defined(linux) && defined(_KERNEL)
91ab25eeb5Syz extern	void	fr_slowtimer __P((long));
92ab25eeb5Syz # else
93*f4b3ec61Sdh extern	int	fr_slowtimer __P((void *));
94ab25eeb5Syz # endif
957c478bd9Sstevel@tonic-gate #endif
967c478bd9Sstevel@tonic-gate 
977663b816Sml #endif	/* __IP_FRAG_H__ */
98