From 989b793a3bf689757b2b8f08a1c264743d75fa0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Neira=20Ayuso?= Date: Mon, 11 Nov 2013 21:09:35 +0100 Subject: src: unify parse and output types Unify parse and output types that are redundant to all existing nftables objects. Thus, all NFT_*_O_[XML|JSON|DEFAULT] are merged into NFT_OUTPUT_[JSON|XML] and NFT_PARSE_[JSON|XML]. Signed-off-by: Alvaro Neira Ayuso Signed-off-by: Pablo Neira Ayuso --- src/ruleset.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src/ruleset.c') diff --git a/src/ruleset.c b/src/ruleset.c index ee2c60a..f591382 100644 --- a/src/ruleset.c +++ b/src/ruleset.c @@ -557,16 +557,16 @@ err: #endif } -int nft_ruleset_parse(struct nft_ruleset *r, enum nft_ruleset_parse_type type, +int nft_ruleset_parse(struct nft_ruleset *r, enum nft_parse_type type, const char *data) { int ret; switch (type) { - case NFT_RULESET_PARSE_XML: + case NFT_PARSE_XML: ret = nft_ruleset_xml_parse(r, data); break; - case NFT_RULESET_PARSE_JSON: + case NFT_PARSE_JSON: ret = nft_ruleset_json_parse(r, data); break; default: @@ -582,9 +582,9 @@ EXPORT_SYMBOL(nft_ruleset_parse); static const char *nft_ruleset_o_opentag(uint32_t type) { switch (type) { - case NFT_RULESET_O_XML: + case NFT_OUTPUT_XML: return ""; - case NFT_RULESET_O_JSON: + case NFT_OUTPUT_JSON: return "{\"nftables\":["; default: return ""; @@ -597,9 +597,9 @@ static const char *nft_ruleset_o_separator(void *obj, uint32_t type) return ""; switch (type) { - case NFT_RULESET_O_JSON: + case NFT_OUTPUT_JSON: return ","; - case NFT_RULESET_O_DEFAULT: + case NFT_OUTPUT_DEFAULT: return "\n"; default: return ""; @@ -609,9 +609,9 @@ static const char *nft_ruleset_o_separator(void *obj, uint32_t type) static const char *nft_ruleset_o_closetag(uint32_t type) { switch (type) { - case NFT_RULESET_O_XML: + case NFT_OUTPUT_XML: return ""; - case NFT_RULESET_O_JSON: + case NFT_OUTPUT_JSON: return "]}"; default: return ""; @@ -803,9 +803,9 @@ int nft_ruleset_snprintf(char *buf, size_t size, const struct nft_ruleset *r, uint32_t type, uint32_t flags) { switch (type) { - case NFT_RULESET_O_DEFAULT: - case NFT_RULESET_O_XML: - case NFT_RULESET_O_JSON: + case NFT_OUTPUT_DEFAULT: + case NFT_OUTPUT_XML: + case NFT_OUTPUT_JSON: return nft_ruleset_do_snprintf(buf, size, r, type, flags); default: errno = EOPNOTSUPP; -- cgit v1.2.3