summaryrefslogtreecommitdiffstats
path: root/include/libnftables
diff options
context:
space:
mode:
Diffstat (limited to 'include/libnftables')
-rw-r--r--include/libnftables/Makefile.am3
-rw-r--r--include/libnftables/chain.h17
-rw-r--r--include/libnftables/common.h16
-rw-r--r--include/libnftables/rule.h17
-rw-r--r--include/libnftables/ruleset.h17
-rw-r--r--include/libnftables/set.h19
-rw-r--r--include/libnftables/table.h17
7 files changed, 34 insertions, 72 deletions
diff --git a/include/libnftables/Makefile.am b/include/libnftables/Makefile.am
index e243f32..a0841d2 100644
--- a/include/libnftables/Makefile.am
+++ b/include/libnftables/Makefile.am
@@ -3,4 +3,5 @@ pkginclude_HEADERS = table.h \
rule.h \
expr.h \
set.h \
- ruleset.h
+ ruleset.h \
+ common.h
diff --git a/include/libnftables/chain.h b/include/libnftables/chain.h
index 5de7318..c26b348 100644
--- a/include/libnftables/chain.h
+++ b/include/libnftables/chain.h
@@ -6,6 +6,8 @@
#include <stdbool.h>
#include <sys/types.h>
+#include <libnftables/common.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -47,20 +49,7 @@ struct nlmsghdr;
void nft_chain_nlmsg_build_payload(struct nlmsghdr *nlh, const struct nft_chain *t);
-enum {
- NFT_CHAIN_O_DEFAULT = 0,
- NFT_CHAIN_O_XML,
- NFT_CHAIN_O_JSON,
-};
-
-enum nft_chain_parse_type {
- NFT_CHAIN_PARSE_NONE = 0,
- NFT_CHAIN_PARSE_XML,
- NFT_CHAIN_PARSE_JSON,
- NFT_CHAIN_PARSE_MAX
-};
-
-int nft_chain_parse(struct nft_chain *c, enum nft_chain_parse_type type, const char *data);
+int nft_chain_parse(struct nft_chain *c, enum nft_parse_type type, const char *data);
int nft_chain_snprintf(char *buf, size_t size, struct nft_chain *t, uint32_t type, uint32_t flags);
int nft_chain_fprintf(FILE *fp, struct nft_chain *c, uint32_t type, uint32_t flags);
diff --git a/include/libnftables/common.h b/include/libnftables/common.h
new file mode 100644
index 0000000..d19a84b
--- /dev/null
+++ b/include/libnftables/common.h
@@ -0,0 +1,16 @@
+#ifndef _COMMON_H_
+#define _COMMON_H_
+
+enum nft_output_type {
+ NFT_OUTPUT_DEFAULT = 0,
+ NFT_OUTPUT_XML,
+ NFT_OUTPUT_JSON,
+};
+
+enum nft_parse_type {
+ NFT_PARSE_NONE = 0,
+ NFT_PARSE_XML,
+ NFT_PARSE_JSON,
+ NFT_PARSE_MAX,
+};
+#endif
diff --git a/include/libnftables/rule.h b/include/libnftables/rule.h
index b61afb0..4957a2a 100644
--- a/include/libnftables/rule.h
+++ b/include/libnftables/rule.h
@@ -6,6 +6,8 @@
#include <stdbool.h>
#include <sys/types.h>
+#include <libnftables/common.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -45,20 +47,7 @@ struct nlmsghdr;
void nft_rule_nlmsg_build_payload(struct nlmsghdr *nlh, struct nft_rule *t);
-enum {
- NFT_RULE_O_DEFAULT = 0,
- NFT_RULE_O_XML,
- NFT_RULE_O_JSON,
-};
-
-enum nft_rule_parse_type {
- NFT_RULE_PARSE_NONE = 0,
- NFT_RULE_PARSE_XML,
- NFT_RULE_PARSE_JSON,
- NFT_RULE_PARSE_MAX,
-};
-
-int nft_rule_parse(struct nft_rule *r, enum nft_rule_parse_type type, const char *data);
+int nft_rule_parse(struct nft_rule *r, enum nft_parse_type type, const char *data);
int nft_rule_snprintf(char *buf, size_t size, struct nft_rule *t, uint32_t type, uint32_t flags);
int nft_rule_fprintf(FILE *fp, struct nft_rule *r, uint32_t type, uint32_t flags);
diff --git a/include/libnftables/ruleset.h b/include/libnftables/ruleset.h
index 3b20bfa..71ef3b1 100644
--- a/include/libnftables/ruleset.h
+++ b/include/libnftables/ruleset.h
@@ -7,6 +7,8 @@
#include <stdint.h>
#include <sys/types.h>
+#include <libnftables/common.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -28,20 +30,7 @@ void nft_ruleset_attr_unset(struct nft_ruleset *r, uint16_t attr);
void nft_ruleset_attr_set(struct nft_ruleset *r, uint16_t attr, void *data);
const void *nft_ruleset_attr_get(const struct nft_ruleset *r, uint16_t attr);
-enum {
- NFT_RULESET_O_DEFAULT = 0,
- NFT_RULESET_O_XML,
- NFT_RULESET_O_JSON,
-};
-
-enum nft_ruleset_parse_type {
- NFT_RULESET_PARSE_NONE = 0,
- NFT_RULESET_PARSE_XML,
- NFT_RULESET_PARSE_JSON,
- NFT_RULESET_PARSE_MAX,
-};
-
-int nft_ruleset_parse(struct nft_ruleset *rs, enum nft_ruleset_parse_type type, const char *data);
+int nft_ruleset_parse(struct nft_ruleset *rs, enum nft_parse_type type, const char *data);
int nft_ruleset_snprintf(char *buf, size_t size, const struct nft_ruleset *rs, uint32_t type, uint32_t flags);
int nft_ruleset_fprintf(FILE *fp, const struct nft_ruleset *rs, uint32_t type, uint32_t flags);
diff --git a/include/libnftables/set.h b/include/libnftables/set.h
index cf63b9b..d378049 100644
--- a/include/libnftables/set.h
+++ b/include/libnftables/set.h
@@ -6,6 +6,8 @@
#include <stdbool.h>
#include <sys/types.h>
+#include <libnftables/common.h>
+
enum {
NFT_SET_ATTR_TABLE,
NFT_SET_ATTR_NAME,
@@ -58,14 +60,7 @@ struct nft_set *nft_set_list_iter_cur(struct nft_set_list_iter *iter);
struct nft_set *nft_set_list_iter_next(struct nft_set_list_iter *iter);
void nft_set_list_iter_destroy(struct nft_set_list_iter *iter);
-enum nft_set_parse_type {
- NFT_SET_PARSE_NONE = 0,
- NFT_SET_PARSE_XML,
- NFT_SET_PARSE_JSON,
- NFT_SET_PARSE_MAX,
-};
-
-int nft_set_parse(struct nft_set *s, enum nft_set_parse_type type, const char *data);
+int nft_set_parse(struct nft_set *s, enum nft_parse_type type, const char *data);
/*
* Set elements
@@ -79,12 +74,6 @@ enum {
NFT_SET_ELEM_ATTR_DATA,
};
-enum {
- NFT_SET_O_DEFAULT = 0,
- NFT_SET_O_XML,
- NFT_SET_O_JSON,
-};
-
struct nft_set_elem;
struct nft_set_elem *nft_set_elem_alloc(void);
@@ -109,7 +98,7 @@ void nft_set_elem_nlmsg_build_payload(struct nlmsghdr *nlh, struct nft_set_elem
int nft_set_elem_nlmsg_parse(const struct nlmsghdr *nlh, struct nft_set_elem *s);
-int nft_set_elem_parse(struct nft_set_elem *e, enum nft_set_parse_type type, const char *data);
+int nft_set_elem_parse(struct nft_set_elem *e, enum nft_parse_type type, const char *data);
int nft_set_elem_snprintf(char *buf, size_t size, struct nft_set_elem *s, uint32_t type, uint32_t flags);
int nft_set_elem_fprintf(FILE *fp, struct nft_set_elem *se, uint32_t type, uint32_t flags);
diff --git a/include/libnftables/table.h b/include/libnftables/table.h
index e3b4888..4902a1d 100644
--- a/include/libnftables/table.h
+++ b/include/libnftables/table.h
@@ -6,6 +6,8 @@
#include <stdbool.h>
#include <sys/types.h>
+#include <libnftables/common.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -35,20 +37,7 @@ struct nlmsghdr;
void nft_table_nlmsg_build_payload(struct nlmsghdr *nlh, const struct nft_table *t);
-enum {
- NFT_TABLE_O_DEFAULT = 0,
- NFT_TABLE_O_XML,
- NFT_TABLE_O_JSON,
-};
-
-enum nft_table_parse_type {
- NFT_TABLE_PARSE_NONE = 0,
- NFT_TABLE_PARSE_XML,
- NFT_TABLE_PARSE_JSON,
- NFT_TABLE_PARSE_MAX,
-};
-
-int nft_table_parse(struct nft_table *t, enum nft_table_parse_type type, const char *data);
+int nft_table_parse(struct nft_table *t, enum nft_parse_type type, const char *data);
int nft_table_snprintf(char *buf, size_t size, struct nft_table *t, uint32_t type, uint32_t flags);
int nft_table_fprintf(FILE *fp, struct nft_table *t, uint32_t type, uint32_t flags);