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