diff options
author | Arturo Borrero Gonzalez <arturo@netfilter.org> | 2018-05-01 19:33:45 +0200 |
---|---|---|
committer | Florian Westphal <fw@strlen.de> | 2018-05-02 14:37:15 +0200 |
commit | a502ba00e44a03cbce9b5769274e1b604d3f08ad (patch) | |
tree | 13164767206ecba1e2c0b1b92f1dbc8eb470610e /include/nftables/libnftables.h | |
parent | 64983d7cb595e773b13d8f3b656b30623d9fe430 (diff) |
libnftables: fix header export
Instruct Make to actually install the header to the system, otherwise
users won't see the header in their system after running 'make install'.
Also, export main libnftables header with a proper name, since we have another
private header called 'nftables.h' (i.e, let's be concrete with the naming).
Signed-off-by: Arturo Borrero Gonzalez <arturo@netfilter.org>
Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'include/nftables/libnftables.h')
-rw-r--r-- | include/nftables/libnftables.h | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/include/nftables/libnftables.h b/include/nftables/libnftables.h new file mode 100644 index 00000000..652e0ca9 --- /dev/null +++ b/include/nftables/libnftables.h @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2017 Eric Leblond <eric@regit.org> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + */ +#ifndef LIB_NFTABLES_H +#define LIB_NFTABLES_H + +#define _GNU_SOURCE +#include <stdint.h> +#include <stdio.h> +#include <stdbool.h> + +struct nft_ctx; + +enum nft_debug_level { + NFT_DEBUG_SCANNER = 0x1, + NFT_DEBUG_PARSER = 0x2, + NFT_DEBUG_EVALUATION = 0x4, + NFT_DEBUG_NETLINK = 0x8, + NFT_DEBUG_MNL = 0x10, + NFT_DEBUG_PROTO_CTX = 0x20, + NFT_DEBUG_SEGTREE = 0x40, +}; + +enum nft_numeric_level { + NFT_NUMERIC_NONE, + NFT_NUMERIC_ADDR, + NFT_NUMERIC_PORT, + NFT_NUMERIC_ALL, +}; + +/** + * Possible flags to pass to nft_ctx_new() + */ +#define NFT_CTX_DEFAULT 0 + +struct nft_ctx *nft_ctx_new(uint32_t flags); +void nft_ctx_free(struct nft_ctx *ctx); + +bool nft_ctx_get_dry_run(struct nft_ctx *ctx); +void nft_ctx_set_dry_run(struct nft_ctx *ctx, bool dry); +enum nft_numeric_level nft_ctx_output_get_numeric(struct nft_ctx *ctx); +void nft_ctx_output_set_numeric(struct nft_ctx *ctx, enum nft_numeric_level level); +bool nft_ctx_output_get_stateless(struct nft_ctx *ctx); +void nft_ctx_output_set_stateless(struct nft_ctx *ctx, bool val); +bool nft_ctx_output_get_ip2name(struct nft_ctx *ctx); +void nft_ctx_output_set_ip2name(struct nft_ctx *ctx, bool val); +unsigned int nft_ctx_output_get_debug(struct nft_ctx *ctx); +void nft_ctx_output_set_debug(struct nft_ctx *ctx, unsigned int mask); +bool nft_ctx_output_get_handle(struct nft_ctx *ctx); +void nft_ctx_output_set_handle(struct nft_ctx *ctx, bool val); +bool nft_ctx_output_get_echo(struct nft_ctx *ctx); +void nft_ctx_output_set_echo(struct nft_ctx *ctx, bool val); + +FILE *nft_ctx_set_output(struct nft_ctx *ctx, FILE *fp); +int nft_ctx_buffer_output(struct nft_ctx *ctx); +int nft_ctx_unbuffer_output(struct nft_ctx *ctx); +const char *nft_ctx_get_output_buffer(struct nft_ctx *ctx); + +FILE *nft_ctx_set_error(struct nft_ctx *ctx, FILE *fp); +int nft_ctx_buffer_error(struct nft_ctx *ctx); +int nft_ctx_unbuffer_error(struct nft_ctx *ctx); +const char *nft_ctx_get_error_buffer(struct nft_ctx *ctx); + +int nft_ctx_add_include_path(struct nft_ctx *ctx, const char *path); +void nft_ctx_clear_include_paths(struct nft_ctx *ctx); + +int nft_run_cmd_from_buffer(struct nft_ctx *nft, char *buf, size_t buflen); +int nft_run_cmd_from_filename(struct nft_ctx *nft, const char *filename); + +#endif /* LIB_NFTABLES_H */ |