From 7aa53c6c9bbe20631b63c6996bdaf0ce431b8d3e Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Mon, 23 Oct 2017 17:33:19 +0200 Subject: libnftables: Introduce getters and setters for everything This introduces getter/setter pairs for all parts in struct nft_ctx (and contained structs) which should be configurable. Most of them are simple ones, just allowing to get/set a given field: * nft_ctx_{get,set}_dry_run() -> ctx->check * nft_ctx_output_{get,set}_numeric() -> ctx->output.numeric * nft_ctx_output_{get,set}_stateless() -> ctx->output.stateless * nft_ctx_output_{get,set}_ip2name() -> ctx->output.ip2name * nft_ctx_output_{get,set}_debug() -> ctx->debug_mask * nft_ctx_output_{get,set}_handle() -> ctx->output.handle * nft_ctx_output_{get,set}_echo() -> ctx->output.echo A more complicated case is include paths handling: In order to keep the API simple, remove INCLUDE_PATHS_MAX restraint and dynamically allocate nft_ctx field include_paths instead. So there is: * nft_ctx_add_include_path() -> add an include path to the list * nft_ctx_clear_include_paths() -> flush the list of include paths Signed-off-by: Phil Sutter Signed-off-by: Pablo Neira Ayuso --- include/nftables.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'include/nftables.h') diff --git a/include/nftables.h b/include/nftables.h index 98d619a3..97a04366 100644 --- a/include/nftables.h +++ b/include/nftables.h @@ -6,8 +6,6 @@ #include #include -#define INCLUDE_PATHS_MAX 16 - struct output_ctx { unsigned int numeric; unsigned int stateless; @@ -27,7 +25,7 @@ struct mnl_socket; struct nft_ctx { struct mnl_socket *nf_sock; - const char *include_paths[INCLUDE_PATHS_MAX]; + char **include_paths; unsigned int num_include_paths; unsigned int parser_max_errors; unsigned int debug_mask; -- cgit v1.2.3