path: root/include/libnftables/rule.h
diff options
authorArturo Borrero <>2013-10-29 23:44:25 +0100
committerPablo Neira Ayuso <>2013-11-03 22:11:56 +0100
commitbd28075ee0bf121ef4fe50e34146efe14acee07b (patch)
treedeb218fce40f0bdf877b249160145adb0de5b5f8 /include/libnftables/rule.h
parentdc4c1e1ded43875d082f0ef5ed794b5bf9eb8f58 (diff)
src: add fprintf API functions
Now it's possible to print directly from libnftables to a file or other stream. The caller must explicitly print the trailing '\n' in this call. The error reporting of fprintf (< 0) is respected. However, we have already print some information in case that the default (plain text) output is used, that output is mostly intended for debugging so it should not be a problem. Signed-off-by: Arturo Borrero Gonzalez <> Signed-off-by: Pablo Neira Ayuso <>
Diffstat (limited to 'include/libnftables/rule.h')
1 files changed, 2 insertions, 0 deletions
diff --git a/include/libnftables/rule.h b/include/libnftables/rule.h
index a501d2d..cdbd8d2 100644
--- a/include/libnftables/rule.h
+++ b/include/libnftables/rule.h
@@ -1,6 +1,7 @@
#ifndef _RULE_H_
#define _RULE_H_
+#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
@@ -58,6 +59,7 @@ enum nft_rule_parse_type {
int nft_rule_parse(struct nft_rule *r, enum nft_rule_parse_type type, const char *data);
int nft_rule_snprintf(char *buf, size_t size, struct nft_rule *t, uint32_t type, uint32_t flags);
+int nft_rule_fprintf(FILE *fp, struct nft_rule *r, uint32_t type, uint32_t flags);
struct nlmsghdr *nft_rule_nlmsg_build_hdr(char *buf, uint16_t cmd, uint16_t family, uint16_t type, uint32_t seq);
int nft_rule_nlmsg_parse(const struct nlmsghdr *nlh, struct nft_rule *t);