1 /* $NetBSD: ip_htable.h,v 1.1.1.1 2004/03/28 08:56:43 martti Exp $ */
2
3 #ifndef __IP_HTABLE_H__
4 #define __IP_HTABLE_H__
5
6 #include "netinet/ip_lookup.h"
7
8 typedef struct iphtent_s {
9 struct iphtent_s *ipe_next, **ipe_pnext;
10 void *ipe_ptr;
11 i6addr_t ipe_addr;
12 i6addr_t ipe_mask;
13 int ipe_ref;
14 union {
15 char ipeu_char[16];
16 u_long ipeu_long;
17 u_int ipeu_int;
18 }ipe_un;
19 } iphtent_t;
20
21 #define ipe_value ipe_un.ipeu_int
22 #define ipe_group ipe_un.ipeu_char
23
24 #define IPE_HASH_FN(a, m, s) (((a) * (m)) % (s))
25
26
27 typedef struct iphtable_s {
28 ipfrwlock_t iph_rwlock;
29 struct iphtable_s *iph_next, **iph_pnext;
30 struct iphtent_s **iph_table;
31 size_t iph_size; /* size of hash table */
32 u_long iph_seed; /* hashing seed */
33 u_32_t iph_flags;
34 u_int iph_unit; /* IPL_LOG* */
35 u_int iph_ref;
36 u_int iph_type; /* lookup or group map - IPHASH_* */
37 u_int iph_masks; /* IPv4 netmasks in use */
38 char iph_name[FR_GROUPLEN]; /* hash table number */
39 } iphtable_t;
40
41 /* iph_type */
42 #define IPHASH_LOOKUP 0
43 #define IPHASH_GROUPMAP 1
44 #define IPHASH_ANON 0x80000000
45
46
47 typedef struct iphtstat_s {
48 iphtable_t *iphs_tables;
49 u_long iphs_numtables;
50 u_long iphs_numnodes;
51 u_long iphs_nomem;
52 u_long iphs_pad[16];
53 } iphtstat_t;
54
55
56 extern iphtable_t *ipf_htables[IPL_LOGSIZE];
57
58 extern void fr_htable_unload __P((void));
59 extern int fr_newhtable __P((iplookupop_t *));
60 extern iphtable_t *fr_findhtable __P((int, char *));
61 extern int fr_removehtable __P((iplookupop_t *));
62 extern size_t fr_flushhtable __P((iplookupflush_t *));
63 extern int fr_addhtent __P((iphtable_t *, iphtent_t *));
64 extern int fr_delhtent __P((iphtable_t *, iphtent_t *));
65 extern void fr_derefhtable __P((iphtable_t *));
66 extern void fr_delhtable __P((iphtable_t *));
67 extern void *fr_iphmfindgroup __P((void *, void *));
68 extern int fr_iphmfindip __P((void *, int, void *));
69 extern int fr_gethtablestat __P((iplookupop_t *));
70
71 #endif /* __IP_HTABLE_H__ */
Cache object: 812fd9cb36ded117f41f52a69231098c
|