| 1 | /* |
| 2 | * Copyright (C) 2012 by Darren Reed. |
| 3 | * |
| 4 | * See the IPFILTER.LICENCE file for details on licencing. |
| 5 | * |
| 6 | * $Id$ |
| 7 | */ |
| 8 | |
| 9 | #ifndef	__IP_POOL_H__ |
| 10 | #define	__IP_POOL_H__ |
| 11 | |
| 12 | #include "netinet/ip_lookup.h" |
| 13 | #include "radix_ipf.h" |
| 14 | |
| 15 | #define	IP_POOL_NOMATCH		0 |
| 16 | #define	IP_POOL_POSITIVE	1 |
| 17 | |
| 18 | typedef	struct ip_pool_node { |
| 19 | 	ipf_rdx_node_t		ipn_nodes[2]; |
| 20 | 	addrfamily_t		ipn_addr; |
| 21 | 	addrfamily_t		ipn_mask; |
| 22 | 	int			ipn_uid; |
| 23 | 	int			ipn_info; |
| 24 | 	int			ipn_ref; |
| 25 | 	char			ipn_name[FR_GROUPLEN]; |
| 26 | 	U_QUAD_T		ipn_hits; |
| 27 | 	U_QUAD_T		ipn_bytes; |
| 28 | 	u_long			ipn_die; |
| 29 | 	struct ip_pool_node	*ipn_next, **ipn_pnext; |
| 30 | 	struct ip_pool_node	*ipn_dnext, **ipn_pdnext; |
| 31 | 	struct ip_pool_s	*ipn_owner; |
| 32 | } ip_pool_node_t; |
| 33 | |
| 34 | |
| 35 | typedef	struct ip_pool_s { |
| 36 | 	struct ip_pool_s	*ipo_next; |
| 37 | 	struct ip_pool_s	**ipo_pnext; |
| 38 | 	ipf_rdx_head_t		*ipo_head; |
| 39 | 	ip_pool_node_t		*ipo_list; |
| 40 | 	ip_pool_node_t		**ipo_tail; |
| 41 | 	ip_pool_node_t		*ipo_nextaddr; |
| 42 | 	void			*ipo_radix; |
| 43 | 	u_long			ipo_hits; |
| 44 | 	int			ipo_unit; |
| 45 | 	int			ipo_flags; |
| 46 | 	int			ipo_ref; |
| 47 | 	char			ipo_name[FR_GROUPLEN]; |
| 48 | } ip_pool_t; |
| 49 | |
| 50 | #define	IPOOL_DELETE	0x01 |
| 51 | #define	IPOOL_ANON	0x02 |
| 52 | |
| 53 | |
| 54 | typedef	struct	ipf_pool_stat	{ |
| 55 | 	u_long			ipls_pools; |
| 56 | 	u_long			ipls_tables; |
| 57 | 	u_long			ipls_nodes; |
| 58 | 	ip_pool_t		*ipls_list[LOOKUP_POOL_SZ]; |
| 59 | } ipf_pool_stat_t; |
| 60 | |
| 61 | extern	ipf_lookup_t	ipf_pool_backend; |
| 62 | |
| 63 | #ifndef _KERNEL |
| 64 | extern	void	ipf_pool_dump(ipf_main_softc_t *, void *); |
| 65 | #endif |
| 66 | |
| 67 | #endif /* __IP_POOL_H__ */ |