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;
9 struct iphtent_s *ipe_dnext, **ipe_pdnext;
10 struct iphtable_s *ipe_owner;
29 #define ipe_value ipe_un.ipeu_int
30 #define ipe_group ipe_un.ipeu_char
32 #define IPE_V4_HASH_FN(a, m, s) ((((m) ^ (a)) - 1 - ((a) >> 8)) % (s))
33 #define IPE_V6_HASH_FN(a, m, s) (((((m)[0] ^ (a)[0]) - ((a)[0] >> 8)) + \
34 (((m)[1] & (a)[1]) - ((a)[1] >> 8)) + \
35 (((m)[2] & (a)[2]) - ((a)[2] >> 8)) + \
36 (((m)[3] & (a)[3]) - ((a)[3] >> 8))) % (s))
38 typedef struct iphtable_s {
39 ipfrwlock_t iph_rwlock;
40 struct iphtable_s *iph_next, **iph_pnext;
41 struct iphtent_s **iph_table;
42 struct iphtent_s *iph_list;
43 struct iphtent_s **iph_tail;
45 ipf_v6_masktab_t iph_v6_masks;
47 ipf_v4_masktab_t iph_v4_masks;
48 size_t iph_size; /* size of hash table */
49 u_long iph_seed; /* hashing seed */
51 u_int iph_unit; /* IPL_LOG* */
53 u_int iph_type; /* lookup or group map - IPHASH_* */
54 u_int iph_maskset[4]; /* netmasks in use */
55 char iph_name[FR_GROUPLEN]; /* hash table number */
59 #define IPHASH_LOOKUP 0
60 #define IPHASH_GROUPMAP 1
61 #define IPHASH_DELETE 2
62 #define IPHASH_ANON 0x80000000
65 typedef struct iphtstat_s {
66 iphtable_t *iphs_tables;
67 u_long iphs_numtables;
74 extern void *ipf_iphmfindgroup __P((ipf_main_softc_t *, void *, void *));
75 extern iphtable_t *ipf_htable_find __P((void *, int, char *));
76 extern ipf_lookup_t ipf_htable_backend;
78 extern void ipf_htable_dump __P((ipf_main_softc_t *, void *));
81 #endif /* __IP_HTABLE_H__ */