| 1 | /* $NetBSD: ip_dstlist.h,v 1.3 2012/07/22 14:27:51 darrenr Exp $ */ |
| 2 | |
| 3 | /* |
| 4 | * Copyright (C) 2012 by Darren Reed. |
| 5 | * |
| 6 | * See the IPFILTER.LICENCE file for details on licencing. |
| 7 | * |
| 8 | * Id: ip_dstlist.h,v 1.1.1.2 2012/07/22 13:45:11 darrenr Exp |
| 9 | */ |
| 10 | |
| 11 | #ifndef __IP_DSTLIST_H__ |
| 12 | #define __IP_DSTLIST_H__ |
| 13 | |
| 14 | typedef struct ipf_dstnode { |
| 15 | struct ipf_dstnode *ipfd_next; |
| 16 | struct ipf_dstnode **ipfd_pnext; |
| 17 | ipfmutex_t ipfd_lock; |
| 18 | frdest_t ipfd_dest; |
| 19 | u_long ipfd_syncat; |
| 20 | int ipfd_flags; |
| 21 | int ipfd_size; |
| 22 | int ipfd_states; |
| 23 | int ipfd_ref; |
| 24 | int ipfd_uid; |
| 25 | char ipfd_names[1]; |
| 26 | } ipf_dstnode_t; |
| 27 | |
| 28 | typedef enum ippool_policy_e { |
| 29 | IPLDP_NONE = 0, |
| 30 | IPLDP_ROUNDROBIN, |
| 31 | IPLDP_CONNECTION, |
| 32 | IPLDP_RANDOM, |
| 33 | IPLDP_HASHED, |
| 34 | IPLDP_SRCHASH, |
| 35 | IPLDP_DSTHASH |
| 36 | } ippool_policy_t; |
| 37 | |
| 38 | typedef struct ippool_dst { |
| 39 | struct ippool_dst *ipld_next; |
| 40 | struct ippool_dst **ipld_pnext; |
| 41 | ipfmutex_t ipld_lock; |
| 42 | int ipld_seed; |
| 43 | int ipld_unit; |
| 44 | int ipld_ref; |
| 45 | int ipld_flags; |
| 46 | int ipld_nodes; |
| 47 | int ipld_maxnodes; |
| 48 | ippool_policy_t ipld_policy; |
| 49 | ipf_dstnode_t **ipld_dests; |
| 50 | ipf_dstnode_t *ipld_selected; |
| 51 | char ipld_name[FR_GROUPLEN]; |
| 52 | } ippool_dst_t; |
| 53 | |
| 54 | #define IPDST_DELETE 0x01 |
| 55 | |
| 56 | typedef struct dstlist_stat_s { |
| 57 | void *ipls_list[LOOKUP_POOL_SZ]; |
| 58 | int ipls_numlists; |
| 59 | u_long ipls_nomem; |
| 60 | int ipls_numnodes; |
| 61 | int ipls_numdereflists; |
| 62 | int ipls_numderefnodes; |
| 63 | } ipf_dstl_stat_t; |
| 64 | |
| 65 | extern ipf_lookup_t ipf_dstlist_backend; |
| 66 | |
| 67 | extern int ipf_dstlist_select_node(fr_info_t *, void *, u_32_t *, frdest_t *); |
| 68 | |
| 69 | #endif /* __IP_DSTLIST_H__ */ |
| 70 | |