1 /* 2 * Copyright (C) 1993-2001 by Darren Reed. 3 * 4 * See the IPFILTER.LICENCE file for details on licencing. 5 * 6 * @(#)ip_frag.h 1.5 3/24/96 7 * $Id: ip_frag.h,v 2.23.2.2 2005/06/10 18:02:37 darrenr Exp $ 8 * 9 * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 10 * Use is subject to license terms. 11 */ 12 13 #pragma ident "%Z%%M% %I% %E% SMI" 14 15 #ifndef __IP_FRAG_H__ 16 #define __IP_FRAG_H__ 17 18 #define IPFT_SIZE 257 19 20 typedef struct ipfr { 21 struct ipfr *ipfr_hnext, **ipfr_hprev; 22 struct ipfr *ipfr_next, **ipfr_prev; 23 void *ipfr_data; 24 void *ipfr_ifp; 25 i6addr_t ipfr_source; 26 i6addr_t ipfr_dest; 27 u_32_t ipfr_optmsk; 28 u_short ipfr_secmsk; 29 u_short ipfr_auth; 30 u_32_t ipfr_id; 31 u_char ipfr_p; 32 u_char ipfr_tos; 33 u_32_t ipfr_pass; 34 u_short ipfr_off; 35 u_long ipfr_ttl; 36 u_char ipfr_seen0; 37 u_short ipfr_firstend; 38 frentry_t *ipfr_rule; 39 int ipfr_ref; 40 } ipfr_t; 41 42 #define ipfr_src ipfr_source.in4 43 #define ipfr_dst ipfr_dest.in4 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_tos) - \ 59 offsetof(ipfr_t, ipfr_ifp)) 60 61 extern int fr_fraginit __P((ipf_stack_t *)); 62 extern void fr_fragunload __P((ipf_stack_t *)); 63 extern ipfrstat_t *fr_fragstats __P((ipf_stack_t *)); 64 65 extern int fr_newfrag __P((fr_info_t *, u_32_t)); 66 extern frentry_t *fr_knownfrag __P((fr_info_t *, u_32_t *)); 67 68 extern int fr_nat_newfrag __P((fr_info_t *, u_32_t, struct nat *)); 69 extern nat_t *fr_nat_knownfrag __P((fr_info_t *)); 70 71 extern int fr_ipid_newfrag __P((fr_info_t *, u_32_t)); 72 extern u_32_t fr_ipid_knownfrag __P((fr_info_t *)); 73 extern void fr_fragderef __P((ipfr_t **, ipfrwlock_t *, ipf_stack_t *)); 74 75 extern void fr_forget __P((void *, ipf_stack_t *)); 76 extern void fr_forgetnat __P((void *, ipf_stack_t *)); 77 extern void fr_fragclear __P((ipf_stack_t *)); 78 extern void fr_fragexpire __P((ipf_stack_t *)); 79 extern int fr_nextfrag __P((ipftoken_t *, ipfgeniter_t *, ipfr_t **, \ 80 ipfr_t ***, ipfrwlock_t *, ipf_stack_t *)); 81 82 #if defined(_KERNEL) && ((BSD >= 199306) || SOLARIS || defined(__sgi) \ 83 || defined(__osf__) || (defined(__sgi) && (IRIX >= 60500))) 84 # if defined(SOLARIS2) && (SOLARIS2 < 7) 85 extern void fr_slowtimer __P((void *)); 86 # else 87 extern void fr_slowtimer __P((void *)); 88 # endif 89 #else 90 # if defined(linux) && defined(_KERNEL) 91 extern void fr_slowtimer __P((long)); 92 # else 93 extern int fr_slowtimer __P((void *)); 94 # endif 95 #endif 96 97 #endif /* __IP_FRAG_H__ */ 98