From bd28075ee0bf121ef4fe50e34146efe14acee07b Mon Sep 17 00:00:00 2001 From: Arturo Borrero Date: Tue, 29 Oct 2013 23:44:25 +0100 Subject: 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 --- include/libnftables/rule.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/libnftables/rule.h') 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 #include #include @@ -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); -- cgit v1.2.3