linux/include/net/netfilter/nf_conntrack_count.h
<<
>>
Prefs
   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,     /* list add was ok */
  10        NF_CONNCOUNT_ERR,       /* -ENOMEM, must drop skb */
  11        NF_CONNCOUNT_SKIP,      /* list is already reclaimed by gc */
  12};
  13
  14struct nf_conncount_list {
  15        spinlock_t list_lock;
  16        struct list_head head;  /* connections with the same filtering key */
  17        unsigned int count;     /* length of list */
  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