1 /* 2 * Copyright (C) 1993-2001, 2003 by Darren Reed. 3 * 4 * See the IPFILTER.LICENCE file for details on licencing. 5 * 6 * $Id: ip_pool.h,v 2.26.2.3 2005/06/12 07:18:27 darrenr Exp $ 7 * 8 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 9 * Use is subject to license terms. 10 */ 11 12 #pragma ident "%Z%%M% %I% %E% SMI" 13 14 #ifndef __IP_POOL_H__ 15 #define __IP_POOL_H__ 16 17 #if defined(_KERNEL) && !defined(__osf__) && !defined(__hpux) && \ 18 !defined(linux) && !defined(sun) && !defined(AIX) 19 # include <net/radix.h> 20 extern void rn_freehead __P((struct radix_node_head *)); 21 # define FreeS(p, z) KFREES(p, z) 22 extern int max_keylen; 23 #else 24 # if defined(__osf__) || defined(__hpux) 25 # include "radix_ipf_local.h" 26 # define radix_mask ipf_radix_mask 27 # define radix_node ipf_radix_node 28 # define radix_node_head ipf_radix_node_head 29 # else 30 # include "radix_ipf.h" 31 # endif 32 #endif 33 #include "netinet/ip_lookup.h" 34 35 #define IP_POOL_NOMATCH 0 36 #define IP_POOL_POSITIVE 1 37 38 typedef struct ip_pool_node { 39 struct radix_node ipn_nodes[2]; 40 addrfamily_t ipn_addr; 41 addrfamily_t ipn_mask; 42 int ipn_info; 43 char ipn_name[FR_GROUPLEN]; 44 u_long ipn_hits; 45 struct ip_pool_node *ipn_next, **ipn_pnext; 46 } ip_pool_node_t; 47 48 49 typedef struct ip_pool_s { 50 struct ip_pool_s *ipo_next; 51 struct ip_pool_s **ipo_pnext; 52 struct radix_node_head *ipo_head; 53 ip_pool_node_t *ipo_list; 54 u_long ipo_hits; 55 int ipo_unit; 56 int ipo_flags; 57 int ipo_ref; 58 char ipo_name[FR_GROUPLEN]; 59 } ip_pool_t; 60 61 #define IPOOL_ANON 0x80000000 62 63 64 typedef struct ip_pool_stat { 65 u_long ipls_pools; 66 u_long ipls_tables; 67 u_long ipls_nodes; 68 ip_pool_t *ipls_list[IPL_LOGSIZE]; 69 } ip_pool_stat_t; 70 71 72 extern ip_pool_stat_t ipoolstat; 73 extern ip_pool_t *ip_pool_list[IPL_LOGSIZE]; 74 75 extern int ip_pool_search __P((void *, int, void *)); 76 extern int ip_pool_init __P((void)); 77 extern void ip_pool_fini __P((void)); 78 extern int ip_pool_create __P((iplookupop_t *)); 79 extern int ip_pool_insert __P((ip_pool_t *, addrfamily_t *, 80 addrfamily_t *, int)); 81 extern int ip_pool_remove __P((ip_pool_t *, ip_pool_node_t *)); 82 extern int ip_pool_destroy __P((iplookupop_t *)); 83 extern void ip_pool_free __P((ip_pool_t *)); 84 extern void ip_pool_deref __P((ip_pool_t *)); 85 extern void *ip_pool_find __P((int, char *)); 86 extern ip_pool_node_t *ip_pool_findeq __P((ip_pool_t *, 87 addrfamily_t *, addrfamily_t *)); 88 extern int ip_pool_flush __P((iplookupflush_t *)); 89 extern int ip_pool_statistics __P((iplookupop_t *)); 90 91 #endif /* __IP_POOL_H__ */ 92