17c478bd9Sstevel@tonic-gate /* 2ab25eeb5Syz * Copyright (C) 1993-2001, 2003 by Darren Reed. 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * See the IPFILTER.LICENCE file for details on licencing. 57c478bd9Sstevel@tonic-gate * 6ab25eeb5Syz * $Id: ip_pool.h,v 2.26.2.3 2005/06/12 07:18:27 darrenr Exp $ 77663b816Sml * 8*f4b3ec61Sdh * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 97663b816Sml * Use is subject to license terms. 107c478bd9Sstevel@tonic-gate */ 117c478bd9Sstevel@tonic-gate 127663b816Sml #pragma ident "%Z%%M% %I% %E% SMI" 137663b816Sml 147c478bd9Sstevel@tonic-gate #ifndef __IP_POOL_H__ 157c478bd9Sstevel@tonic-gate #define __IP_POOL_H__ 167c478bd9Sstevel@tonic-gate 17ab25eeb5Syz #if defined(_KERNEL) && !defined(__osf__) && !defined(__hpux) && \ 18ab25eeb5Syz !defined(linux) && !defined(sun) && !defined(AIX) 197c478bd9Sstevel@tonic-gate # include <net/radix.h> 20ab25eeb5Syz extern void rn_freehead __P((struct radix_node_head *)); 21ab25eeb5Syz # define FreeS(p, z) KFREES(p, z) 22ab25eeb5Syz extern int max_keylen; 237c478bd9Sstevel@tonic-gate #else 24ab25eeb5Syz # if defined(__osf__) || defined(__hpux) 25ab25eeb5Syz # include "radix_ipf_local.h" 26ab25eeb5Syz # define radix_mask ipf_radix_mask 27ab25eeb5Syz # define radix_node ipf_radix_node 28ab25eeb5Syz # define radix_node_head ipf_radix_node_head 29ab25eeb5Syz # else 30ab25eeb5Syz # include "radix_ipf.h" 31ab25eeb5Syz # endif 327c478bd9Sstevel@tonic-gate #endif 337c478bd9Sstevel@tonic-gate #include "netinet/ip_lookup.h" 347c478bd9Sstevel@tonic-gate 357c478bd9Sstevel@tonic-gate #define IP_POOL_NOMATCH 0 367c478bd9Sstevel@tonic-gate #define IP_POOL_POSITIVE 1 377c478bd9Sstevel@tonic-gate 387c478bd9Sstevel@tonic-gate typedef struct ip_pool_node { 397c478bd9Sstevel@tonic-gate struct radix_node ipn_nodes[2]; 407c478bd9Sstevel@tonic-gate addrfamily_t ipn_addr; 417c478bd9Sstevel@tonic-gate addrfamily_t ipn_mask; 427c478bd9Sstevel@tonic-gate int ipn_info; 43*f4b3ec61Sdh int ipn_ref; 447c478bd9Sstevel@tonic-gate char ipn_name[FR_GROUPLEN]; 457c478bd9Sstevel@tonic-gate u_long ipn_hits; 467c478bd9Sstevel@tonic-gate struct ip_pool_node *ipn_next, **ipn_pnext; 477c478bd9Sstevel@tonic-gate } ip_pool_node_t; 487c478bd9Sstevel@tonic-gate 497c478bd9Sstevel@tonic-gate 507c478bd9Sstevel@tonic-gate typedef struct ip_pool_s { 517c478bd9Sstevel@tonic-gate struct ip_pool_s *ipo_next; 527c478bd9Sstevel@tonic-gate struct ip_pool_s **ipo_pnext; 537c478bd9Sstevel@tonic-gate struct radix_node_head *ipo_head; 547c478bd9Sstevel@tonic-gate ip_pool_node_t *ipo_list; 557c478bd9Sstevel@tonic-gate u_long ipo_hits; 567c478bd9Sstevel@tonic-gate int ipo_unit; 577c478bd9Sstevel@tonic-gate int ipo_flags; 587c478bd9Sstevel@tonic-gate int ipo_ref; 597c478bd9Sstevel@tonic-gate char ipo_name[FR_GROUPLEN]; 607c478bd9Sstevel@tonic-gate } ip_pool_t; 617c478bd9Sstevel@tonic-gate 627c478bd9Sstevel@tonic-gate #define IPOOL_ANON 0x80000000 637c478bd9Sstevel@tonic-gate 647c478bd9Sstevel@tonic-gate 657c478bd9Sstevel@tonic-gate typedef struct ip_pool_stat { 667c478bd9Sstevel@tonic-gate u_long ipls_pools; 67ab25eeb5Syz u_long ipls_tables; 687c478bd9Sstevel@tonic-gate u_long ipls_nodes; 697c478bd9Sstevel@tonic-gate ip_pool_t *ipls_list[IPL_LOGSIZE]; 707c478bd9Sstevel@tonic-gate } ip_pool_stat_t; 717c478bd9Sstevel@tonic-gate 72*f4b3ec61Sdh extern int ip_pool_search __P((void *, int, void *, ipf_stack_t *)); 73*f4b3ec61Sdh extern int ip_pool_init __P((ipf_stack_t *)); 74*f4b3ec61Sdh extern void ip_pool_fini __P((ipf_stack_t *)); 75*f4b3ec61Sdh extern int ip_pool_create __P((iplookupop_t *, ipf_stack_t *)); 767663b816Sml extern int ip_pool_insert __P((ip_pool_t *, addrfamily_t *, 77*f4b3ec61Sdh addrfamily_t *, int, ipf_stack_t *)); 78*f4b3ec61Sdh extern int ip_pool_remove __P((ip_pool_t *, ip_pool_node_t *, 79*f4b3ec61Sdh ipf_stack_t *)); 80*f4b3ec61Sdh extern int ip_pool_destroy __P((iplookupop_t *, ipf_stack_t *)); 81*f4b3ec61Sdh extern void ip_pool_free __P((ip_pool_t *, ipf_stack_t *)); 82*f4b3ec61Sdh extern void ip_pool_deref __P((ip_pool_t *, ipf_stack_t *)); 83*f4b3ec61Sdh extern void *ip_pool_find __P((int, char *, ipf_stack_t *)); 847c478bd9Sstevel@tonic-gate extern ip_pool_node_t *ip_pool_findeq __P((ip_pool_t *, 85ab25eeb5Syz addrfamily_t *, addrfamily_t *)); 86*f4b3ec61Sdh extern int ip_pool_flush __P((iplookupflush_t *, ipf_stack_t *)); 87*f4b3ec61Sdh extern int ip_pool_statistics __P((iplookupop_t *, ipf_stack_t *)); 88*f4b3ec61Sdh extern int ip_pool_getnext __P((ipftoken_t *, ipflookupiter_t *, ipf_stack_t *)); 89*f4b3ec61Sdh extern void ip_pool_iterderef __P((u_int, int, void *, ipf_stack_t *)); 907c478bd9Sstevel@tonic-gate #endif /* __IP_POOL_H__ */ 91