From 26e06d838d6471f5233c1da3fee012bf113564a5 Mon Sep 17 00:00:00 2001 From: Arturo Borrero Gonzalez Date: Fri, 8 Feb 2013 17:51:56 +0100 Subject: src: add XML output support Signed-off-by: Arturo Borrero Gonzalez Signed-off-by: Pablo Neira Ayuso --- src/expr/counter.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/expr/counter.c') diff --git a/src/expr/counter.c b/src/expr/counter.c index f0d7617..d2da9bf 100644 --- a/src/expr/counter.c +++ b/src/expr/counter.c @@ -18,6 +18,7 @@ #include "internal.h" #include #include +#include #include "expr_ops.h" struct nft_expr_counter { @@ -130,8 +131,17 @@ nft_rule_expr_counter_snprintf(char *buf, size_t len, uint32_t type, { struct nft_expr_counter *ctr = (struct nft_expr_counter *)e->data; - return snprintf(buf, len, "pkts=%lu bytes=%lu ", - ctr->pkts, ctr->bytes); + switch(type) { + case NFT_RULE_O_XML: + return snprintf(buf, len, "\t\t%lu %lu ", + ctr->pkts, ctr->bytes); + case NFT_RULE_O_DEFAULT: + return snprintf(buf, len, "pkts=%lu bytes=%lu ", + ctr->pkts, ctr->bytes); + default: + break; + } + return -1; } struct expr_ops expr_ops_counter = { -- cgit v1.2.3