summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorElise Lennion <elise.lennion@gmail.com>2017-03-02 15:34:13 -0300
committerPablo Neira Ayuso <pablo@netfilter.org>2017-03-03 10:56:26 +0100
commit059b9bf6fb31b971f79f83a01d9794288ab88a6e (patch)
tree6e26652096b4c01d09827b7d9804091386d3ed30 /include
parent1ef9ba3ecb4323a200015cfb5f91c6eb9972d32e (diff)
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 <shivanib134@gmail.com>. Signed-off-by: Elise Lennion <elise.lennion@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'include')
-rw-r--r--include/buffer.h11
1 files changed, 11 insertions, 0 deletions
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 <stdint.h>
#include <stdbool.h>
+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