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