1145522Sdarrenr/* $FreeBSD$ */ 2145522Sdarrenr 353642Sguido/* 4255332Scy * Copyright (C) 2012 by Darren Reed. 553642Sguido * 680482Sdarrenr * See the IPFILTER.LICENCE file for details on licencing. 753642Sguido * 853642Sguido * @(#)ip_frag.h 1.5 3/24/96 957126Sguido * $FreeBSD$ 10145522Sdarrenr * Id: ip_frag.h,v 2.23.2.1 2004/03/29 16:21:56 darrenr Exp 1160865Speter */ 1253642Sguido 1353642Sguido#ifndef __IP_FRAG_H__ 1453642Sguido#define __IP_FRAG_H__ 1553642Sguido 1653642Sguido#define IPFT_SIZE 257 1753642Sguido 1853642Sguidotypedef struct ipfr { 19145522Sdarrenr struct ipfr *ipfr_hnext, **ipfr_hprev; 20145522Sdarrenr struct ipfr *ipfr_next, **ipfr_prev; 2153642Sguido void *ipfr_data; 22170268Sdarrenr frentry_t *ipfr_rule; 23170268Sdarrenr u_long ipfr_ttl; 24255332Scy u_int ipfr_pkts; 25255332Scy u_int ipfr_bytes; 26255332Scy u_int ipfr_badorder; 27170268Sdarrenr int ipfr_ref; 28170268Sdarrenr u_short ipfr_off; 29255332Scy u_short ipfr_firstend; 30255332Scy u_char ipfr_p; 31255332Scy u_char ipfr_seen0; 32170268Sdarrenr /* 33170268Sdarrenr * All of the fields, from ipfr_ifp to ipfr_pass, are compared 34170268Sdarrenr * using bcmp to see if an identical entry is present. It is 35170268Sdarrenr * therefore important for this set to remain together. 36170268Sdarrenr */ 37145522Sdarrenr void *ipfr_ifp; 38255332Scy i6addr_t ipfr_source; 39255332Scy i6addr_t ipfr_dest; 4080482Sdarrenr u_32_t ipfr_optmsk; 4180482Sdarrenr u_short ipfr_secmsk; 4280482Sdarrenr u_short ipfr_auth; 43255332Scy u_32_t ipfr_id; 44145522Sdarrenr u_32_t ipfr_pass; 45255332Scy int ipfr_v; 4653642Sguido} ipfr_t; 4753642Sguido 48255332Scy#define ipfr_src ipfr_source.in4 49255332Scy#define ipfr_dst ipfr_dest.in4 5053642Sguido 51255332Scy 5253642Sguidotypedef struct ipfrstat { 5353642Sguido u_long ifs_exists; /* add & already exists */ 5453642Sguido u_long ifs_nomem; 5553642Sguido u_long ifs_new; 5653642Sguido u_long ifs_hits; 5753642Sguido u_long ifs_expire; 5853642Sguido u_long ifs_inuse; 59145522Sdarrenr u_long ifs_retrans0; 60145522Sdarrenr u_long ifs_short; 61255332Scy u_long ifs_bad; 62255332Scy u_long ifs_overlap; 63255332Scy u_long ifs_unordered; 64255332Scy u_long ifs_strict; 65255332Scy u_long ifs_miss; 66255332Scy u_long ifs_maximum; 67255332Scy u_long ifs_newbad; 68255332Scy u_long ifs_newrestrictnot0; 6953642Sguido struct ipfr **ifs_table; 7053642Sguido struct ipfr **ifs_nattab; 7153642Sguido} ipfrstat_t; 7253642Sguido 73266829Scytypedef struct ipf_frag_softc_s { 74266829Scy ipfrwlock_t ipfr_ipidfrag; 75266829Scy ipfrwlock_t ipfr_frag; 76266829Scy ipfrwlock_t ipfr_natfrag; 77266829Scy int ipfr_size; 78266829Scy int ipfr_ttl; 79266829Scy int ipfr_lock; 80266829Scy int ipfr_inited; 81302015Scy ipftuneable_t *ipf_frag_tune; 82266829Scy ipfr_t *ipfr_list; 83266829Scy ipfr_t **ipfr_tail; 84266829Scy ipfr_t *ipfr_natlist; 85266829Scy ipfr_t **ipfr_nattail; 86266829Scy ipfr_t *ipfr_ipidlist; 87266829Scy ipfr_t **ipfr_ipidtail; 88266829Scy ipfr_t **ipfr_heads; 89266829Scy ipfr_t **ipfr_nattab; 90266829Scy ipfr_t **ipfr_ipidtab; 91266829Scy ipfrstat_t ipfr_stats; 92266829Scy} ipf_frag_softc_t; 93266829Scy 94145522Sdarrenr#define IPFR_CMPSZ (offsetof(ipfr_t, ipfr_pass) - \ 95145522Sdarrenr offsetof(ipfr_t, ipfr_ifp)) 9653642Sguido 97255332Scyextern void *ipf_frag_soft_create __P((ipf_main_softc_t *)); 98255332Scyextern int ipf_frag_soft_init __P((ipf_main_softc_t *, void *)); 99255332Scyextern int ipf_frag_soft_fini __P((ipf_main_softc_t *, void *)); 100255332Scyextern void ipf_frag_soft_destroy __P((ipf_main_softc_t *, void *)); 101255332Scyextern int ipf_frag_main_load __P((void)); 102255332Scyextern int ipf_frag_main_unload __P((void)); 103255332Scyextern int ipf_frag_load __P((void)); 104255332Scyextern void ipf_frag_clear __P((ipf_main_softc_t *)); 105255332Scyextern void ipf_frag_expire __P((ipf_main_softc_t *)); 106255332Scyextern void ipf_frag_forget __P((void *)); 107255332Scyextern int ipf_frag_init __P((void)); 108255332Scyextern u_32_t ipf_frag_ipidknown __P((fr_info_t *)); 109255332Scyextern int ipf_frag_ipidnew __P((fr_info_t *, u_32_t)); 110255332Scyextern frentry_t *ipf_frag_known __P((fr_info_t *, u_32_t *)); 111255332Scyextern void ipf_frag_natforget __P((ipf_main_softc_t *, void *)); 112255332Scyextern int ipf_frag_natnew __P((ipf_main_softc_t *, fr_info_t *, u_32_t, struct nat *)); 113255332Scyextern nat_t *ipf_frag_natknown __P((fr_info_t *)); 114255332Scyextern int ipf_frag_new __P((ipf_main_softc_t *, fr_info_t *, u_32_t)); 115255332Scyextern ipfrstat_t *ipf_frag_stats __P((void *)); 116255332Scyextern void ipf_frag_setlock __P((void *, int)); 117255332Scyextern void ipf_frag_pkt_deref __P((ipf_main_softc_t *, void *)); 118255332Scyextern int ipf_frag_pkt_next __P((ipf_main_softc_t *, ipftoken_t *, 119255332Scy ipfgeniter_t *)); 120255332Scyextern void ipf_frag_nat_deref __P((ipf_main_softc_t *, void *)); 121255332Scyextern int ipf_frag_nat_next __P((ipf_main_softc_t *, ipftoken_t *, 122255332Scy ipfgeniter_t *)); 123255332Scyextern void ipf_slowtimer __P((ipf_main_softc_t *)); 12453642Sguido 125145522Sdarrenr#endif /* __IP_FRAG_H__ */ 126