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/ruleset.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include/libnftables/ruleset.h') diff --git a/include/libnftables/ruleset.h b/include/libnftables/ruleset.h index a4a1279..35e4d71 100644 --- a/include/libnftables/ruleset.h +++ b/include/libnftables/ruleset.h @@ -1,6 +1,8 @@ #ifndef _RULESET_H_ #define _RULESET_H_ +#include + #ifdef __cplusplus extern "C" { #endif @@ -37,6 +39,7 @@ enum nft_ruleset_parse_type { int nft_ruleset_parse(struct nft_ruleset *rs, enum nft_ruleset_parse_type type, const char *data); int nft_ruleset_snprintf(char *buf, size_t size, const struct nft_ruleset *rs, uint32_t type, uint32_t flags); +int nft_ruleset_fprintf(FILE *fp, const struct nft_ruleset *rs, uint32_t type, uint32_t flags); #ifdef __cplusplus } /* extern "C" */ -- cgit v1.2.3