1#ifndef _NF_CONNTRACK_COUNT_H
2#define _NF_CONNTRACK_COUNT_H
3
4#include <linux/list.h>
5
6struct nf_conncount_data;
7
8enum nf_conncount_list_add {
9 NF_CONNCOUNT_ADDED,
10 NF_CONNCOUNT_ERR,
11 NF_CONNCOUNT_SKIP,
12};
13
14struct nf_conncount_list {
15 spinlock_t list_lock;
16 struct list_head head;
17 unsigned int count;
18 bool dead;
19};
20
21struct nf_conncount_data *nf_conncount_init(struct net *net, unsigned int family,
22 unsigned int keylen);
23void nf_conncount_destroy(struct net *net, unsigned int family,
24 struct nf_conncount_data *data);
25
26unsigned int nf_conncount_count(struct net *net,
27 struct nf_conncount_data *data,
28 const u32 *key,
29 const struct nf_conntrack_tuple *tuple,
30 const struct nf_conntrack_zone *zone);
31
32void nf_conncount_lookup(struct net *net, struct nf_conncount_list *list,
33 const struct nf_conntrack_tuple *tuple,
34 const struct nf_conntrack_zone *zone,
35 bool *addit);
36
37void nf_conncount_list_init(struct nf_conncount_list *list);
38
39enum nf_conncount_list_add
40nf_conncount_add(struct nf_conncount_list *list,
41 const struct nf_conntrack_tuple *tuple,
42 const struct nf_conntrack_zone *zone);
43
44bool nf_conncount_gc_list(struct net *net,
45 struct nf_conncount_list *list);
46
47void nf_conncount_cache_free(struct nf_conncount_list *list);
48
49#endif
50