1 #ifndef _NF_CONNTRACK_COUNT_H
2 #define _NF_CONNTRACK_COUNT_H
3 
4 #include <linux/list.h>
5 
6 struct nf_conncount_data;
7 
8 struct nf_conncount_list {
9 	spinlock_t list_lock;
10 	struct list_head head;	/* connections with the same filtering key */
11 	unsigned int count;	/* length of list */
12 };
13 
14 struct nf_conncount_data *nf_conncount_init(struct net *net, unsigned int family,
15 					    unsigned int keylen);
16 void nf_conncount_destroy(struct net *net, unsigned int family,
17 			  struct nf_conncount_data *data);
18 
19 unsigned int nf_conncount_count(struct net *net,
20 				struct nf_conncount_data *data,
21 				const u32 *key,
22 				const struct nf_conntrack_tuple *tuple,
23 				const struct nf_conntrack_zone *zone);
24 
25 int nf_conncount_add(struct net *net, struct nf_conncount_list *list,
26 		     const struct nf_conntrack_tuple *tuple,
27 		     const struct nf_conntrack_zone *zone);
28 
29 void nf_conncount_list_init(struct nf_conncount_list *list);
30 
31 bool nf_conncount_gc_list(struct net *net,
32 			  struct nf_conncount_list *list);
33 
34 void nf_conncount_cache_free(struct nf_conncount_list *list);
35 
36 #endif
37