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