diff options
author | Arturo Borrero <arturo.borrero.glez@gmail.com> | 2013-10-29 23:44:25 +0100 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2013-11-03 22:11:56 +0100 |
commit | bd28075ee0bf121ef4fe50e34146efe14acee07b (patch) | |
tree | deb218fce40f0bdf877b249160145adb0de5b5f8 /src/set_elem.c | |
parent | dc4c1e1ded43875d082f0ef5ed794b5bf9eb8f58 (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 <arturo.borrero.glez@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/set_elem.c')
-rw-r--r-- | src/set_elem.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/set_elem.c b/src/set_elem.c index 5ef46f2..516905d 100644 --- a/src/set_elem.c +++ b/src/set_elem.c @@ -577,6 +577,19 @@ int nft_set_elem_snprintf(char *buf, size_t size, struct nft_set_elem *e, } EXPORT_SYMBOL(nft_set_elem_snprintf); +static inline int nft_set_elem_do_snprintf(char *buf, size_t size, void *e, + uint32_t type, uint32_t flags) +{ + return nft_set_elem_snprintf(buf, size, e, type, flags); +} + +int nft_set_elem_fprintf(FILE *fp, struct nft_set_elem *se, uint32_t type, + uint32_t flags) +{ + return nft_fprintf(fp, se, type, flags, nft_set_elem_do_snprintf); +} +EXPORT_SYMBOL(nft_set_elem_fprintf); + int nft_set_elem_foreach(struct nft_set *s, int (*cb)(struct nft_set_elem *e, void *data), void *data) |