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 73145522Sdarrenr#define IPFR_CMPSZ (offsetof(ipfr_t, ipfr_pass) - \ 74145522Sdarrenr offsetof(ipfr_t, ipfr_ifp)) 7553642Sguido 76255332Scyextern void *ipf_frag_soft_create __P((ipf_main_softc_t *)); 77255332Scyextern int ipf_frag_soft_init __P((ipf_main_softc_t *, void *)); 78255332Scyextern int ipf_frag_soft_fini __P((ipf_main_softc_t *, void *)); 79255332Scyextern void ipf_frag_soft_destroy __P((ipf_main_softc_t *, void *)); 80255332Scyextern int ipf_frag_main_load __P((void)); 81255332Scyextern int ipf_frag_main_unload __P((void)); 82255332Scyextern int ipf_frag_load __P((void)); 83255332Scyextern void ipf_frag_clear __P((ipf_main_softc_t *)); 84255332Scyextern void ipf_frag_expire __P((ipf_main_softc_t *)); 85255332Scyextern void ipf_frag_forget __P((void *)); 86255332Scyextern int ipf_frag_init __P((void)); 87255332Scyextern u_32_t ipf_frag_ipidknown __P((fr_info_t *)); 88255332Scyextern int ipf_frag_ipidnew __P((fr_info_t *, u_32_t)); 89255332Scyextern frentry_t *ipf_frag_known __P((fr_info_t *, u_32_t *)); 90255332Scyextern void ipf_frag_natforget __P((ipf_main_softc_t *, void *)); 91255332Scyextern int ipf_frag_natnew __P((ipf_main_softc_t *, fr_info_t *, u_32_t, struct nat *)); 92255332Scyextern nat_t *ipf_frag_natknown __P((fr_info_t *)); 93255332Scyextern int ipf_frag_new __P((ipf_main_softc_t *, fr_info_t *, u_32_t)); 94255332Scyextern ipfrstat_t *ipf_frag_stats __P((void *)); 95255332Scyextern void ipf_frag_setlock __P((void *, int)); 96255332Scyextern void ipf_frag_pkt_deref __P((ipf_main_softc_t *, void *)); 97255332Scyextern int ipf_frag_pkt_next __P((ipf_main_softc_t *, ipftoken_t *, 98255332Scy ipfgeniter_t *)); 99255332Scyextern void ipf_frag_nat_deref __P((ipf_main_softc_t *, void *)); 100255332Scyextern int ipf_frag_nat_next __P((ipf_main_softc_t *, ipftoken_t *, 101255332Scy ipfgeniter_t *)); 102255332Scyextern void ipf_slowtimer __P((ipf_main_softc_t *)); 10353642Sguido 104145522Sdarrenr#endif /* __IP_FRAG_H__ */ 105