diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/cache.h | 23 | ||||
-rw-r--r-- | include/nftables.h | 8 | ||||
-rw-r--r-- | include/rule.h | 6 |
3 files changed, 18 insertions, 19 deletions
diff --git a/include/cache.h b/include/cache.h index 00092767..987b122b 100644 --- a/include/cache.h +++ b/include/cache.h @@ -1,6 +1,8 @@ #ifndef _NFT_CACHE_H_ #define _NFT_CACHE_H_ +#include <string.h> + enum cache_level_bits { NFT_CACHE_TABLE_BIT = (1 << 0), NFT_CACHE_CHAIN_BIT = (1 << 1), @@ -35,6 +37,21 @@ enum cache_level_flags { NFT_CACHE_FLUSHED = (1 << 31), }; +struct nft_cache { + uint32_t genid; + struct list_head list; + uint32_t seqnum; + uint32_t flags; +}; + +enum cmd_ops; + +unsigned int nft_cache_evaluate(struct nft_ctx *nft, struct list_head *cmds); +int nft_cache_update(struct nft_ctx *ctx, enum cmd_ops cmd, + struct list_head *msgs); +bool nft_cache_needs_update(struct nft_cache *cache); +void nft_cache_release(struct nft_cache *cache); + static inline uint32_t djb_hash(const char *key) { uint32_t i, hash = 5381; @@ -47,14 +64,8 @@ static inline uint32_t djb_hash(const char *key) #define NFT_CACHE_HSIZE 8192 -struct netlink_ctx; struct table; struct chain; -struct handle; - -int cache_init(struct netlink_ctx *ctx, unsigned int flags); -int cache_update(struct nft_ctx *nft, unsigned int flags, struct list_head *msgs); -void cache_release(struct nft_cache *cache); void chain_cache_add(struct chain *chain, struct table *table); struct chain *chain_cache_find(const struct table *table, const char *name); diff --git a/include/nftables.h b/include/nftables.h index 9095ff3d..f239fcf0 100644 --- a/include/nftables.h +++ b/include/nftables.h @@ -5,6 +5,7 @@ #include <stdarg.h> #include <limits.h> #include <utils.h> +#include <cache.h> #include <nftables/libnftables.h> struct cookie { @@ -95,13 +96,6 @@ static inline bool nft_output_terse(const struct output_ctx *octx) return octx->flags & NFT_CTX_OUTPUT_TERSE; } -struct nft_cache { - uint32_t genid; - struct list_head list; - uint32_t seqnum; - uint32_t flags; -}; - struct mnl_socket; struct parser_state; struct scope; diff --git a/include/rule.h b/include/rule.h index 90c01e90..7896eafe 100644 --- a/include/rule.h +++ b/include/rule.h @@ -771,12 +771,6 @@ extern struct error_record *rule_postprocess(struct rule *rule); struct netlink_ctx; extern int do_command(struct netlink_ctx *ctx, struct cmd *cmd); -extern unsigned int cache_evaluate(struct nft_ctx *nft, struct list_head *cmds); -extern int cache_update(struct nft_ctx *ctx, enum cmd_ops cmd, - struct list_head *msgs); -extern bool cache_needs_update(struct nft_cache *cache); -extern void cache_release(struct nft_cache *cache); - struct timeout_protocol { uint32_t array_size; const char *const *state_to_name; |