From 059b9bf6fb31b971f79f83a01d9794288ab88a6e Mon Sep 17 00:00:00 2001 From: Elise Lennion Date: Thu, 2 Mar 2017 15:34:13 -0300 Subject: src: Use nftnl_buf to export XML/JSON rules This completes the use of nftnl_buf and its auxiliary functions to export XML/JSON rules. Highly based on work from Shivani Bhardwaj . Signed-off-by: Elise Lennion Signed-off-by: Pablo Neira Ayuso --- include/buffer.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'include/buffer.h') diff --git a/include/buffer.h b/include/buffer.h index c571657..f556895 100644 --- a/include/buffer.h +++ b/include/buffer.h @@ -4,6 +4,8 @@ #include #include +struct nftnl_expr; + struct nftnl_buf { char *buf; size_t size; @@ -35,12 +37,18 @@ int nftnl_buf_u64(struct nftnl_buf *b, int type, uint64_t value, const char *tag int nftnl_buf_str(struct nftnl_buf *b, int type, const char *str, const char *tag); int nftnl_buf_reg(struct nftnl_buf *b, int type, union nftnl_data_reg *reg, int reg_type, const char *tag); +int nftnl_buf_expr_open(struct nftnl_buf *b, int type); +int nftnl_buf_expr_close(struct nftnl_buf *b, int type); +int nftnl_buf_expr(struct nftnl_buf *b, int type, uint32_t flags, + struct nftnl_expr *expr); #define BASE "base" #define BYTES "bytes" #define BURST "burst" #define CHAIN "chain" #define CODE "code" +#define COMPAT_FLAGS "compat_flags" +#define COMPAT_PROTO "compat_proto" #define CONSUMED "consumed" #define DATA "data" #define DEVICE "device" @@ -64,10 +72,12 @@ int nftnl_buf_reg(struct nftnl_buf *b, int type, union nftnl_data_reg *reg, #define PACKETS "packets" #define PKTS "pkts" #define POLICY "policy" +#define POSITION "position" #define PREFIX "prefix" #define PRIO "prio" #define QTHRESH "qthreshold" #define RATE "rate" +#define RULE "rule" #define SET "set" #define SET_NAME "set_name" #define SIZE "size" @@ -93,5 +103,6 @@ int nftnl_buf_reg(struct nftnl_buf *b, int type, union nftnl_data_reg *reg, #define FLUSH "flush" #define MODULUS "modulus" #define SEED "seed" +#define ID "id" #endif -- cgit v1.2.3