3 #ifndef __IP_HTABLE_H__
4 #define __IP_HTABLE_H__
6 #include "netinet/ip_lookup.h"
8 typedef struct iphtent_s
{
9 struct iphtent_s
*ipe_next
, **ipe_pnext
;
10 struct iphtent_s
*ipe_hnext
, **ipe_phnext
;
23 #define ipe_value ipe_un.ipeu_int
24 #define ipe_group ipe_un.ipeu_char
26 #define IPE_HASH_FN(a, m, s) (((a) * (m)) % (s))
29 typedef struct iphtable_s
{
30 ipfrwlock_t iph_rwlock
;
31 struct iphtable_s
*iph_next
, **iph_pnext
;
32 struct iphtent_s
**iph_table
;
33 struct iphtent_s
*iph_list
;
34 size_t iph_size
; /* size of hash table */
35 u_long iph_seed
; /* hashing seed */
37 u_int iph_unit
; /* IPL_LOG* */
39 u_int iph_type
; /* lookup or group map - IPHASH_* */
40 u_int iph_masks
; /* IPv4 netmasks in use */
41 char iph_name
[FR_GROUPLEN
]; /* hash table number */
45 #define IPHASH_LOOKUP 0
46 #define IPHASH_GROUPMAP 1
47 #define IPHASH_DELETE 2
48 #define IPHASH_ANON 0x80000000
51 typedef struct iphtstat_s
{
52 iphtable_t
*iphs_tables
;
53 u_long iphs_numtables
;
60 extern iphtable_t
*ipf_htables
[IPL_LOGSIZE
];
62 extern iphtable_t
*fr_existshtable
__P((int, char *));
63 extern int fr_clearhtable
__P((iphtable_t
*));
64 extern void fr_htable_unload
__P((void));
65 extern int fr_newhtable
__P((iplookupop_t
*));
66 extern iphtable_t
*fr_findhtable
__P((int, char *));
67 extern int fr_removehtable
__P((int, char *));
68 extern size_t fr_flushhtable
__P((iplookupflush_t
*));
69 extern int fr_addhtent
__P((iphtable_t
*, iphtent_t
*));
70 extern int fr_delhtent
__P((iphtable_t
*, iphtent_t
*));
71 extern int fr_derefhtable
__P((iphtable_t
*));
72 extern int fr_derefhtent
__P((iphtent_t
*));
73 extern int fr_delhtable
__P((iphtable_t
*));
74 extern void *fr_iphmfindgroup
__P((void *, void *));
75 extern int fr_iphmfindip
__P((void *, int, void *));
76 extern int fr_gethtablestat
__P((iplookupop_t
*));
77 extern int fr_htable_getnext
__P((ipftoken_t
*, ipflookupiter_t
*));
78 extern void fr_htable_iterderef
__P((u_int
, int, void *));
80 #endif /* __IP_HTABLE_H__ */