1 /* $FreeBSD: stable/9/sys/contrib/ipfilter/netinet/ip_frag.h 170268 2007-06-04 02:54:36Z darrenr $ */ 2 3 /* 4 * Copyright (C) 1993-2001 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: stable/9/sys/contrib/ipfilter/netinet/ip_frag.h 170268 2007-06-04 02:54:36Z darrenr $ 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 18 typedef 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 int ipfr_ref; 25 u_short ipfr_off; 26 u_short ipfr_seen0; 27 /* 28 * All of the fields, from ipfr_ifp to ipfr_pass, are compared 29 * using bcmp to see if an identical entry is present. It is 30 * therefore important for this set to remain together. 31 */ 32 void *ipfr_ifp; 33 struct in_addr ipfr_src; 34 struct in_addr ipfr_dst; 35 u_32_t ipfr_optmsk; 36 u_short ipfr_secmsk; 37 u_short ipfr_auth; 38 u_short ipfr_id; 39 u_char ipfr_p; 40 u_char ipfr_tos; 41 u_32_t ipfr_pass; 42 } ipfr_t; 43 44 45 typedef struct ipfrstat { 46 u_long ifs_exists; /* add & already exists */ 47 u_long ifs_nomem; 48 u_long ifs_new; 49 u_long ifs_hits; 50 u_long ifs_expire; 51 u_long ifs_inuse; 52 u_long ifs_retrans0; 53 u_long ifs_short; 54 struct ipfr **ifs_table; 55 struct ipfr **ifs_nattab; 56 } ipfrstat_t; 57 58 #define IPFR_CMPSZ (offsetof(ipfr_t, ipfr_pass) - \ 59 offsetof(ipfr_t, ipfr_ifp)) 60 61 extern ipfr_t *ipfr_list, **ipfr_tail; 62 extern ipfr_t *ipfr_natlist, **ipfr_nattail; 63 extern int ipfr_size; 64 extern int fr_ipfrttl; 65 extern int fr_frag_lock; 66 extern int fr_fraginit __P((void)); 67 extern void fr_fragunload __P((void)); 68 extern ipfrstat_t *fr_fragstats __P((void)); 69 70 extern int fr_newfrag __P((fr_info_t *, u_32_t)); 71 extern frentry_t *fr_knownfrag __P((fr_info_t *, u_32_t *)); 72 73 extern int fr_nat_newfrag __P((fr_info_t *, u_32_t, struct nat *)); 74 extern nat_t *fr_nat_knownfrag __P((fr_info_t *)); 75 76 extern int fr_ipid_newfrag __P((fr_info_t *, u_32_t)); 77 extern u_32_t fr_ipid_knownfrag __P((fr_info_t *)); 78 #ifdef USE_MUTEXES 79 extern void fr_fragderef __P((ipfr_t **, ipfrwlock_t *)); 80 extern int fr_nextfrag __P((ipftoken_t *, ipfgeniter_t *, ipfr_t **, \ 81 ipfr_t ***, ipfrwlock_t *)); 82 #else 83 extern void fr_fragderef __P((ipfr_t **)); 84 extern int fr_nextfrag __P((ipftoken_t *, ipfgeniter_t *, ipfr_t **, \ 85 ipfr_t ***)); 86 #endif 87 88 extern void fr_forget __P((void *)); 89 extern void fr_forgetnat __P((void *)); 90 extern void fr_fragclear __P((void)); 91 extern void fr_fragexpire __P((void)); 92 93 #if defined(_KERNEL) && ((BSD >= 199306) || SOLARIS || defined(__sgi) \ 94 || defined(__osf__) || (defined(__sgi) && (IRIX >= 60500))) 95 # if defined(SOLARIS2) && (SOLARIS2 < 7) 96 extern void fr_slowtimer __P((void)); 97 # else 98 extern void fr_slowtimer __P((void *)); 99 # endif 100 #else 101 # if defined(linux) && defined(_KERNEL) 102 extern void fr_slowtimer __P((long)); 103 # else 104 extern int fr_slowtimer __P((void)); 105 # endif 106 #endif 107 108 #endif /* __IP_FRAG_H__ */ 109