summaryrefslogtreecommitdiffstats
path: root/include/cache.h
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2019-06-17 12:03:08 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2019-06-17 19:54:57 +0200
commit01e5c6f0ed0315046537612f5a80e506d37a7f8e (patch)
tree5e6dc94860d876f6851808812c59d83935c6c689 /include/cache.h
parenta331eca90d25a1bc519a5a3a53d72a982cedb029 (diff)
src: add cache level flags
The score approach based on command type is confusing. This patch introduces cache level flags, each flag specifies what kind of object type is needed. These flags are set on/off depending on the list of commands coming in this batch. cache_is_complete() now checks if the cache contains the objects that are needed through these new flags. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'include/cache.h')
-rw-r--r--include/cache.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/include/cache.h b/include/cache.h
new file mode 100644
index 00000000..d3502a8a
--- /dev/null
+++ b/include/cache.h
@@ -0,0 +1,35 @@
+#ifndef _NFT_CACHE_H_
+#define _NFT_CACHE_H_
+
+enum cache_level_bits {
+ NFT_CACHE_TABLE_BIT = (1 << 0),
+ NFT_CACHE_CHAIN_BIT = (1 << 1),
+ NFT_CACHE_SET_BIT = (1 << 2),
+ NFT_CACHE_FLOWTABLE_BIT = (1 << 3),
+ NFT_CACHE_OBJECT_BIT = (1 << 4),
+ NFT_CACHE_SETELEM_BIT = (1 << 5),
+ NFT_CACHE_RULE_BIT = (1 << 6),
+ __NFT_CACHE_MAX_BIT = (1 << 7),
+};
+
+enum cache_level_flags {
+ NFT_CACHE_EMPTY = 0,
+ NFT_CACHE_TABLE = NFT_CACHE_TABLE_BIT,
+ NFT_CACHE_CHAIN = NFT_CACHE_TABLE_BIT |
+ NFT_CACHE_CHAIN_BIT,
+ NFT_CACHE_SET = NFT_CACHE_TABLE_BIT |
+ NFT_CACHE_SET_BIT,
+ NFT_CACHE_FLOWTABLE = NFT_CACHE_TABLE_BIT |
+ NFT_CACHE_FLOWTABLE_BIT,
+ NFT_CACHE_OBJECT = NFT_CACHE_TABLE_BIT |
+ NFT_CACHE_OBJECT_BIT,
+ NFT_CACHE_SETELEM = NFT_CACHE_TABLE_BIT |
+ NFT_CACHE_SET_BIT |
+ NFT_CACHE_SETELEM_BIT,
+ NFT_CACHE_RULE = NFT_CACHE_TABLE_BIT |
+ NFT_CACHE_CHAIN_BIT |
+ NFT_CACHE_RULE_BIT,
+ NFT_CACHE_FULL = __NFT_CACHE_MAX_BIT - 1,
+};
+
+#endif /* _NFT_CACHE_H_ */