]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/contrib/ipfilter/netinet/ip_htable.h
This commit was generated by cvs2svn to compensate for changes in r168371,
[FreeBSD/FreeBSD.git] / sys / contrib / ipfilter / netinet / ip_htable.h
1 #ifndef __IP_HTABLE_H__
2 #define __IP_HTABLE_H__
3
4 #include "netinet/ip_lookup.h"
5
6 typedef struct  iphtent_s       {
7         struct  iphtent_s       *ipe_next, **ipe_pnext;
8         void            *ipe_ptr;
9         i6addr_t        ipe_addr;
10         i6addr_t        ipe_mask;
11         int             ipe_ref;
12         union   {
13                 char    ipeu_char[16];
14                 u_long  ipeu_long;
15                 u_int   ipeu_int;
16         }ipe_un;
17 } iphtent_t;
18
19 #define ipe_value       ipe_un.ipeu_int
20 #define ipe_group       ipe_un.ipeu_char
21
22 #define IPE_HASH_FN(a, m, s)    (((a) * (m)) % (s))
23
24
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 */
31         u_32_t  iph_flags;
32         u_int   iph_unit;               /* IPL_LOG* */
33         u_int   iph_ref;
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 */
37 } iphtable_t;
38
39 /* iph_type */
40 #define IPHASH_LOOKUP   0
41 #define IPHASH_GROUPMAP 1
42 #define IPHASH_ANON     0x80000000
43
44
45 typedef struct  iphtstat_s      {
46         iphtable_t      *iphs_tables;
47         u_long          iphs_numtables;
48         u_long          iphs_numnodes;
49         u_long          iphs_nomem;
50         u_long          iphs_pad[16];
51 } iphtstat_t;
52
53
54 extern iphtable_t *ipf_htables[IPL_LOGSIZE];
55
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 *));
68
69 #endif /* __IP_HTABLE_H__ */