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;
8 struct iphtent_s *ipe_hnext, **ipe_phnext;
21 #define ipe_value ipe_un.ipeu_int
22 #define ipe_group ipe_un.ipeu_char
24 #define IPE_HASH_FN(a, m, s) (((a) * (m)) % (s))
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 struct iphtent_s *iph_list;
32 size_t iph_size; /* size of hash table */
33 u_long iph_seed; /* hashing seed */
35 u_int iph_unit; /* IPL_LOG* */
37 u_int iph_type; /* lookup or group map - IPHASH_* */
38 u_int iph_masks; /* IPv4 netmasks in use */
39 char iph_name[FR_GROUPLEN]; /* hash table number */
43 #define IPHASH_LOOKUP 0
44 #define IPHASH_GROUPMAP 1
45 #define IPHASH_DELETE 2
46 #define IPHASH_ANON 0x80000000
49 typedef struct iphtstat_s {
50 iphtable_t *iphs_tables;
51 u_long iphs_numtables;
58 extern iphtable_t *ipf_htables[IPL_LOGSIZE];
60 extern iphtable_t *fr_existshtable __P((int, char *));
61 extern int fr_clearhtable __P((iphtable_t *));
62 extern void fr_htable_unload __P((void));
63 extern int fr_newhtable __P((iplookupop_t *));
64 extern iphtable_t *fr_findhtable __P((int, char *));
65 extern int fr_removehtable __P((int, char *));
66 extern size_t fr_flushhtable __P((iplookupflush_t *));
67 extern int fr_addhtent __P((iphtable_t *, iphtent_t *));
68 extern int fr_delhtent __P((iphtable_t *, iphtent_t *));
69 extern int fr_derefhtable __P((iphtable_t *));
70 extern int fr_derefhtent __P((iphtent_t *));
71 extern int fr_delhtable __P((iphtable_t *));
72 extern void *fr_iphmfindgroup __P((void *, void *));
73 extern int fr_iphmfindip __P((void *, int, void *));
74 extern int fr_gethtablestat __P((iplookupop_t *));
75 extern int fr_htable_getnext __P((ipftoken_t *, ipflookupiter_t *));
76 extern void fr_htable_iterderef __P((u_int, int, void *));
78 #endif /* __IP_HTABLE_H__ */