summaryrefslogtreecommitdiffstats
path: root/src/ruleset.c
diff options
context:
space:
mode:
authorÁlvaro Neira Ayuso <alvaroneay@gmail.com>2013-11-11 21:09:35 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2013-11-14 00:38:38 +0100
commit989b793a3bf689757b2b8f08a1c264743d75fa0f (patch)
tree8a932779feb9b906282cc929ad0cab30799c8176 /src/ruleset.c
parent838ae8f60f43061778ce1b7f08cb08fc60fd21f9 (diff)
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 <alvaroneay@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/ruleset.c')
-rw-r--r--src/ruleset.c24
1 files changed, 12 insertions, 12 deletions
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 "<nftables>";
- 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 "</nftables>";
- 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;