Home | History | Annotate | Line # | Download | only in netinet
      1  1.3   darrenr /*	$NetBSD: ip_frag.h,v 1.3 2012/07/22 14:27:51 darrenr Exp $	*/
      2  1.1  christos 
      3  1.1  christos /*
      4  1.3   darrenr  * Copyright (C) 2012 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.3   darrenr  * Id: ip_frag.h,v 1.1.1.2 2012/07/22 13:45:17 darrenr Exp
     10  1.1  christos  */
     11  1.1  christos 
     12  1.2  christos #ifndef _NETINET_IP_FRAG_H_
     13  1.2  christos #define _NETINET_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.2  christos extern	void	*ipf_frag_soft_create(ipf_main_softc_t *);
     76  1.2  christos extern	int	ipf_frag_soft_init(ipf_main_softc_t *, void *);
     77  1.2  christos extern	int	ipf_frag_soft_fini(ipf_main_softc_t *, void *);
     78  1.2  christos extern	void	ipf_frag_soft_destroy(ipf_main_softc_t *, void *);
     79  1.2  christos extern	int	ipf_frag_main_load(void);
     80  1.2  christos extern	int	ipf_frag_main_unload(void);
     81  1.2  christos extern	int	ipf_frag_load(void);
     82  1.2  christos extern	void	ipf_frag_clear(ipf_main_softc_t *);
     83  1.2  christos extern	void	ipf_frag_expire(ipf_main_softc_t *);
     84  1.2  christos extern	void	ipf_frag_forget(void *);
     85  1.2  christos extern	int	ipf_frag_init(void);
     86  1.2  christos extern	u_32_t	ipf_frag_ipidknown(fr_info_t *);
     87  1.2  christos extern	int	ipf_frag_ipidnew(fr_info_t *, u_32_t);
     88  1.2  christos extern	frentry_t *ipf_frag_known(fr_info_t *, u_32_t *);
     89  1.2  christos extern	void	ipf_frag_natforget(ipf_main_softc_t *, void *);
     90  1.2  christos extern	int	ipf_frag_natnew(ipf_main_softc_t *, fr_info_t *, u_32_t, struct nat *);
     91  1.2  christos extern	nat_t	*ipf_frag_natknown(fr_info_t *);
     92  1.2  christos extern	int	ipf_frag_new(ipf_main_softc_t *, fr_info_t *, u_32_t);
     93  1.2  christos extern	ipfrstat_t	*ipf_frag_stats(void *);
     94  1.2  christos extern	void	ipf_frag_setlock(void *, int);
     95  1.2  christos extern	void	ipf_frag_pkt_deref(ipf_main_softc_t *, void *);
     96  1.2  christos extern	int	ipf_frag_pkt_next(ipf_main_softc_t *, ipftoken_t *,
     97  1.2  christos 				       ipfgeniter_t *);
     98  1.2  christos extern	void	ipf_frag_nat_deref(ipf_main_softc_t *, void *);
     99  1.2  christos extern	int	ipf_frag_nat_next(ipf_main_softc_t *, ipftoken_t *,
    100  1.2  christos 				       ipfgeniter_t *);
    101  1.2  christos extern	void	ipf_slowtimer(ipf_main_softc_t *);
    102  1.1  christos 
    103  1.2  christos #endif /* _NETINET_IP_FRAG_H_ */
    104