1 #ifndef __IP_HTABLE_H__
2 #define __IP_HTABLE_H__
4 #include "netinet/ip_lookup.h"
6 typedef struct iphtent_s {
7 struct iphtent_s *ipe_next, **ipe_pnext;
19 #define ipe_value ipe_un.ipeu_int
20 #define ipe_group ipe_un.ipeu_char
22 #define IPE_HASH_FN(a, m, s) (((a) * (m)) % (s))
25 typedef struct iphtable_s {
26 ipfrwlock_t iph_rwlock;
27 struct iphtable_s *iph_next, **iph_pnext;
28 struct iphtent_s **iph_table;
29 size_t iph_size; /* size of hash table */
30 u_long iph_seed; /* hashing seed */
32 u_int iph_unit; /* IPL_LOG* */
34 u_int iph_type; /* lookup or group map - IPHASH_* */
35 u_int iph_masks; /* IPv4 netmasks in use */
36 char iph_name[FR_GROUPLEN]; /* hash table number */
40 #define IPHASH_LOOKUP 0
41 #define IPHASH_GROUPMAP 1
42 #define IPHASH_ANON 0x80000000
45 typedef struct iphtstat_s {
46 iphtable_t *iphs_tables;
47 u_long iphs_numtables;
54 extern iphtable_t *ipf_htables[IPL_LOGSIZE];
56 extern void fr_htable_unload __P((void));
57 extern int fr_newhtable __P((iplookupop_t *));
58 extern iphtable_t *fr_findhtable __P((int, char *));
59 extern int fr_removehtable __P((iplookupop_t *));
60 extern size_t fr_flushhtable __P((iplookupflush_t *));
61 extern int fr_addhtent __P((iphtable_t *, iphtent_t *));
62 extern int fr_delhtent __P((iphtable_t *, iphtent_t *));
63 extern void fr_derefhtable __P((iphtable_t *));
64 extern void fr_delhtable __P((iphtable_t *));
65 extern void *fr_iphmfindgroup __P((void *, void *));
66 extern int fr_iphmfindip __P((void *, int, void *));
67 extern int fr_gethtablestat __P((iplookupop_t *));
69 #endif /* __IP_HTABLE_H__ */