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/chain.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/libnftables/chain.h') diff --git a/include/libnftables/chain.h b/include/libnftables/chain.h index d85a2a2..66f19c0 100644 --- a/include/libnftables/chain.h +++ b/include/libnftables/chain.h @@ -1,6 +1,7 @@ #ifndef _CHAIN_H_ #define _CHAIN_H_ +#include #include #include @@ -60,6 +61,7 @@ enum nft_chain_parse_type { int nft_chain_parse(struct nft_chain *c, enum nft_chain_parse_type type, const char *data); int nft_chain_snprintf(char *buf, size_t size, struct nft_chain *t, uint32_t type, uint32_t flags); +int nft_chain_fprintf(FILE *fp, struct nft_chain *c, uint32_t type, uint32_t flags); struct nlmsghdr *nft_chain_nlmsg_build_hdr(char *buf, uint16_t cmd, uint16_t family, uint16_t type, uint32_t seq); int nft_chain_nlmsg_parse(const struct nlmsghdr *nlh, struct nft_chain *t); -- cgit v1.2.3