Home | History | Annotate | Line # | Download | only in netinet
ip_frag.h revision 1.1
      1  1.1  christos /*	$NetBSD: ip_frag.h,v 1.1 2012/03/23 20:36:56 christos Exp $	*/
      2  1.1  christos 
      3  1.1  christos /*
      4  1.1  christos  * Copyright (C) 2011 by Darren Reed.
      5  1.1  christos  *
      6  1.1  christos  * See the IPFILTER.LICENCE file for details on licencing.
      7  1.1  christos  *
      8  1.1  christos  * @(#)ip_frag.h	1.5 3/24/96
      9  1.1  christos  * Id
     10  1.1  christos  */
     11  1.1  christos 
     12  1.1  christos #ifndef	__IP_FRAG_H__
     13  1.1  christos #define	__IP_FRAG_H__
     14  1.1  christos 
     15  1.1  christos #define	IPFT_SIZE	257
     16  1.1  christos 
     17  1.1  christos typedef	struct	ipfr	{
     18  1.1  christos 	struct	ipfr	*ipfr_hnext, **ipfr_hprev;
     19  1.1  christos 	struct	ipfr	*ipfr_next, **ipfr_prev;
     20  1.1  christos 	void	*ipfr_data;
     21  1.1  christos 	frentry_t *ipfr_rule;
     22  1.1  christos 	u_long	ipfr_ttl;
     23  1.1  christos 	u_int	ipfr_pkts;
     24  1.1  christos 	u_int	ipfr_bytes;
     25  1.1  christos 	u_int	ipfr_badorder;
     26  1.1  christos 	int	ipfr_ref;
     27  1.1  christos 	u_short	ipfr_off;
     28  1.1  christos 	u_short	ipfr_firstend;
     29  1.1  christos 	u_char	ipfr_p;
     30  1.1  christos 	u_char	ipfr_seen0;
     31  1.1  christos 	/*
     32  1.1  christos 	 * All of the fields, from ipfr_ifp to ipfr_pass, are compared
     33  1.1  christos 	 * using bcmp to see if an identical entry is present.  It is
     34  1.1  christos 	 * therefore important for this set to remain together.
     35  1.1  christos 	 */
     36  1.1  christos 	void	*ipfr_ifp;
     37  1.1  christos 	i6addr_t	ipfr_source;
     38  1.1  christos 	i6addr_t	ipfr_dest;
     39  1.1  christos 	u_32_t	ipfr_optmsk;
     40  1.1  christos 	u_short	ipfr_secmsk;
     41  1.1  christos 	u_short	ipfr_auth;
     42  1.1  christos 	u_32_t	ipfr_id;
     43  1.1  christos 	u_32_t	ipfr_pass;
     44  1.1  christos 	int	ipfr_v;
     45  1.1  christos } ipfr_t;
     46  1.1  christos 
     47  1.1  christos #define	ipfr_src	ipfr_source.in4
     48  1.1  christos #define	ipfr_dst	ipfr_dest.in4
     49  1.1  christos 
     50  1.1  christos 
     51  1.1  christos typedef	struct	ipfrstat {
     52  1.1  christos 	u_long	ifs_exists;	/* add & already exists */
     53  1.1  christos 	u_long	ifs_nomem;
     54  1.1  christos 	u_long	ifs_new;
     55  1.1  christos 	u_long	ifs_hits;
     56  1.1  christos 	u_long	ifs_expire;
     57  1.1  christos 	u_long	ifs_inuse;
     58  1.1  christos 	u_long	ifs_retrans0;
     59  1.1  christos 	u_long	ifs_short;
     60  1.1  christos 	u_long	ifs_bad;
     61  1.1  christos 	u_long	ifs_overlap;
     62  1.1  christos 	u_long	ifs_unordered;
     63  1.1  christos 	u_long	ifs_strict;
     64  1.1  christos 	u_long	ifs_miss;
     65  1.1  christos 	u_long	ifs_maximum;
     66  1.1  christos 	u_long	ifs_newbad;
     67  1.1  christos 	u_long	ifs_newrestrictnot0;
     68  1.1  christos 	struct	ipfr	**ifs_table;
     69  1.1  christos 	struct	ipfr	**ifs_nattab;
     70  1.1  christos } ipfrstat_t;
     71  1.1  christos 
     72  1.1  christos #define	IPFR_CMPSZ	(offsetof(ipfr_t, ipfr_pass) - \
     73  1.1  christos 			 offsetof(ipfr_t, ipfr_ifp))
     74  1.1  christos 
     75  1.1  christos extern	void	*ipf_frag_soft_create __P((ipf_main_softc_t *));
     76  1.1  christos extern	int	ipf_frag_soft_init __P((ipf_main_softc_t *, void *));
     77  1.1  christos extern	int	ipf_frag_soft_fini __P((ipf_main_softc_t *, void *));
     78  1.1  christos extern	void	ipf_frag_soft_destroy __P((ipf_main_softc_t *, void *));
     79  1.1  christos extern	int	ipf_frag_main_load __P((void));
     80  1.1  christos extern	int	ipf_frag_main_unload __P((void));
     81  1.1  christos extern	int	ipf_frag_load __P((void));
     82  1.1  christos extern	void	ipf_frag_clear __P((ipf_main_softc_t *));
     83  1.1  christos extern	void	ipf_frag_expire __P((ipf_main_softc_t *));
     84  1.1  christos extern	void	ipf_frag_forget __P((void *));
     85  1.1  christos extern	int	ipf_frag_init __P((void));
     86  1.1  christos extern	u_32_t	ipf_frag_ipidknown __P((fr_info_t *));
     87  1.1  christos extern	int	ipf_frag_ipidnew __P((fr_info_t *, u_32_t));
     88  1.1  christos extern	frentry_t *ipf_frag_known __P((fr_info_t *, u_32_t *));
     89  1.1  christos extern	void	ipf_frag_natforget __P((ipf_main_softc_t *, void *));
     90  1.1  christos extern	int	ipf_frag_natnew __P((ipf_main_softc_t *, fr_info_t *, u_32_t, struct nat *));
     91  1.1  christos extern	nat_t	*ipf_frag_natknown __P((fr_info_t *));
     92  1.1  christos extern	int	ipf_frag_new __P((ipf_main_softc_t *, fr_info_t *, u_32_t));
     93  1.1  christos extern	ipfrstat_t	*ipf_frag_stats __P((void *));
     94  1.1  christos extern	void	ipf_frag_setlock __P((void *, int));
     95  1.1  christos extern	void	ipf_frag_pkt_deref __P((ipf_main_softc_t *, void *));
     96  1.1  christos extern	int	ipf_frag_pkt_next __P((ipf_main_softc_t *, ipftoken_t *,
     97  1.1  christos 				       ipfgeniter_t *));
     98  1.1  christos extern	void	ipf_frag_nat_deref __P((ipf_main_softc_t *, void *));
     99  1.1  christos extern	int	ipf_frag_nat_next __P((ipf_main_softc_t *, ipftoken_t *,
    100  1.1  christos 				       ipfgeniter_t *));
    101  1.1  christos extern	void	ipf_slowtimer __P((ipf_main_softc_t *));
    102  1.1  christos 
    103  1.1  christos #endif	/* __IP_FRAG_H__ */
    104