Merge commit 'b6c711cc370ad66a5c9391c71936f34bb8616e93'
[unleashed/lotheac.git] / include / netinet / ip_pool.h
blob23474295492c614c0270d1950d6cc60936c0030f
1 /*
2 * Copyright (C) 1993-2001, 2003 by Darren Reed.
4 * See the IPFILTER.LICENCE file for details on licencing.
6 * $Id: ip_pool.h,v 2.26.2.3 2005/06/12 07:18:27 darrenr Exp $
8 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
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)
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_QUAD_T ipn_hits;
43 U_QUAD_T ipn_bytes;
44 struct ip_pool_node *ipn_next, **ipn_pnext;
45 } ip_pool_node_t;
48 typedef struct ip_pool_s {
49 struct ip_pool_s *ipo_next;
50 struct ip_pool_s **ipo_pnext;
51 struct radix_node_head *ipo_head;
52 ip_pool_node_t *ipo_list;
53 U_QUAD_T ipo_hits;
54 int ipo_unit;
55 int ipo_flags;
56 int ipo_ref;
57 char ipo_name[FR_GROUPLEN];
58 } ip_pool_t;
60 #define IPOOL_ANON 0x80000000
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;
70 extern int ip_pool_search __P((void *, int, void *, fr_info_t *, ipf_stack_t *));
71 extern int ip_pool_init __P((ipf_stack_t *));
72 extern void ip_pool_fini __P((ipf_stack_t *));
73 extern int ip_pool_create __P((iplookupop_t *, ipf_stack_t *));
74 extern int ip_pool_insert __P((ip_pool_t *, addrfamily_t *,
75 addrfamily_t *, int, ipf_stack_t *));
76 extern int ip_pool_remove __P((ip_pool_t *, ip_pool_node_t *,
77 ipf_stack_t *));
78 extern int ip_pool_destroy __P((iplookupop_t *, ipf_stack_t *));
79 extern void ip_pool_free __P((ip_pool_t *, ipf_stack_t *));
80 extern void ip_pool_deref __P((ip_pool_t *, ipf_stack_t *));
81 extern void *ip_pool_find __P((int, char *, ipf_stack_t *));
82 extern ip_pool_node_t *ip_pool_findeq __P((ip_pool_t *,
83 addrfamily_t *, addrfamily_t *));
84 extern int ip_pool_flush __P((iplookupflush_t *, ipf_stack_t *));
85 extern int ip_pool_statistics __P((iplookupop_t *, ipf_stack_t *));
86 extern int ip_pool_getnext __P((ipftoken_t *, ipflookupiter_t *, ipf_stack_t *));
87 extern void ip_pool_iterderef __P((u_int, int, void *, ipf_stack_t *));
88 #endif /* __IP_POOL_H__ */