Expand PMF_FN_* macros.
[netbsd-mini2440.git] / dist / ipf / ip_pool.h
blob13eec7cc4384ea0b7c90da672d8b3c706d4a4a4d
1 /* $NetBSD$ */
3 /*
4 * Copyright (C) 1993-2001, 2003 by Darren Reed.
6 * See the IPFILTER.LICENCE file for details on licencing.
8 * Id: ip_pool.h,v 2.26.2.6 2007/10/10 09:51:43 darrenr Exp
9 */
11 #ifndef __IP_POOL_H__
12 #define __IP_POOL_H__
14 #if defined(_KERNEL) && !defined(__osf__) && !defined(__hpux) && \
15 !defined(linux) && !defined(sun) && !defined(AIX)
16 # include <net/radix.h>
17 extern void rn_freehead __P((struct radix_node_head *));
18 # define FreeS(p, z) KFREES(p, z)
19 extern int max_keylen;
20 #else
21 # if defined(__osf__) || defined(__hpux) || defined(sun)
22 # include "radix_ipf_local.h"
23 # define radix_mask ipf_radix_mask
24 # define radix_node ipf_radix_node
25 # define radix_node_head ipf_radix_node_head
26 # else
27 # include "radix_ipf.h"
28 # endif
29 #endif
30 #include "netinet/ip_lookup.h"
32 #define IP_POOL_NOMATCH 0
33 #define IP_POOL_POSITIVE 1
35 typedef struct ip_pool_node {
36 struct radix_node ipn_nodes[2];
37 addrfamily_t ipn_addr;
38 addrfamily_t ipn_mask;
39 int ipn_info;
40 int ipn_ref;
41 char ipn_name[FR_GROUPLEN];
42 u_long ipn_hits;
43 struct ip_pool_node *ipn_next, **ipn_pnext;
44 } ip_pool_node_t;
47 typedef struct ip_pool_s {
48 struct ip_pool_s *ipo_next;
49 struct ip_pool_s **ipo_pnext;
50 struct radix_node_head *ipo_head;
51 ip_pool_node_t *ipo_list;
52 u_long ipo_hits;
53 int ipo_unit;
54 int ipo_flags;
55 int ipo_ref;
56 char ipo_name[FR_GROUPLEN];
57 } ip_pool_t;
59 #define IPOOL_DELETE 0x01
60 #define IPOOL_ANON 0x02
63 typedef struct ip_pool_stat {
64 u_long ipls_pools;
65 u_long ipls_tables;
66 u_long ipls_nodes;
67 ip_pool_t *ipls_list[IPL_LOGSIZE];
68 } ip_pool_stat_t;
71 extern ip_pool_stat_t ipoolstat;
72 extern ip_pool_t *ip_pool_list[IPL_LOGSIZE];
74 extern int ip_pool_search __P((void *, int, void *));
75 extern int ip_pool_init __P((void));
76 extern void ip_pool_fini __P((void));
77 extern int ip_pool_create __P((iplookupop_t *));
78 extern int ip_pool_insert __P((ip_pool_t *, i6addr_t *, i6addr_t *, int));
79 extern int ip_pool_remove __P((ip_pool_t *, ip_pool_node_t *));
80 extern int ip_pool_destroy __P((int, char *));
81 extern void ip_pool_free __P((ip_pool_t *));
82 extern void ip_pool_deref __P((ip_pool_t *));
83 extern void ip_pool_node_deref __P((ip_pool_node_t *));
84 extern void *ip_pool_find __P((int, char *));
85 extern ip_pool_node_t *ip_pool_findeq __P((ip_pool_t *,
86 addrfamily_t *, addrfamily_t *));
87 extern int ip_pool_flush __P((iplookupflush_t *));
88 extern int ip_pool_statistics __P((iplookupop_t *));
89 extern int ip_pool_getnext __P((ipftoken_t *, ipflookupiter_t *));
90 extern void ip_pool_iterderef __P((u_int, int, void *));
92 #endif /* __IP_POOL_H__ */