1 #ifndef __IP_HTABLE_H__ 2 #define __IP_HTABLE_H__ 3 4 #if SOLARIS2 >= 10 5 #include "ip_lookup.h" 6 #else 7 #include "netinet/ip_lookup.h" 8 #endif 9 10 typedef struct iphtent_s { 11 struct iphtent_s *ipe_next, **ipe_pnext; 12 void *ipe_ptr; 13 i6addr_t ipe_addr; 14 i6addr_t ipe_mask; 15 int ipe_ref; 16 union { 17 char ipeu_char[16]; 18 u_long ipeu_long; 19 u_int ipeu_int; 20 }ipe_un; 21 } iphtent_t; 22 23 #define ipe_value ipe_un.ipeu_int 24 #define ipe_group ipe_un.ipeu_char 25 26 #define IPE_HASH_FN(a, m, s) (((a) * (m)) % (s)) 27 28 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 size_t iph_size; /* size of hash table */ 34 u_long iph_seed; /* hashing seed */ 35 u_32_t iph_flags; 36 u_int iph_unit; /* IPL_LOG* */ 37 u_int iph_ref; 38 u_int iph_type; /* lookup or group map - IPHASH_* */ 39 u_int iph_masks; /* IPv4 netmasks in use */ 40 char iph_name[FR_GROUPLEN]; /* hash table number */ 41 } iphtable_t; 42 43 /* iph_type */ 44 #define IPHASH_LOOKUP 0 45 #define IPHASH_GROUPMAP 1 46 #define IPHASH_ANON 0x80000000 47 48 extern iphtable_t *ipf_htables[IPL_LOGSIZE]; 49 50 extern void fr_htable_unload __P((void)); 51 extern int fr_newhtable __P((iplookupop_t *)); 52 extern iphtable_t *fr_findhtable __P((int, char *)); 53 extern int fr_removehtable __P((iplookupop_t *)); 54 extern size_t fr_flushhtable __P((iplookupflush_t *)); 55 extern int fr_addhtent __P((iphtable_t *, iphtent_t *)); 56 extern int fr_delhtent __P((iphtable_t *, iphtent_t *)); 57 extern void fr_derefhtable __P((iphtable_t *)); 58 extern void fr_delhtable __P((iphtable_t *)); 59 extern void *fr_iphmfindgroup __P((void *, void *)); 60 extern int fr_iphmfindip __P((void *, int, void *)); 61 62 #endif /* __IP_HTABLE_H__ */ 63