summaryrefslogtreecommitdiffstats
path: root/examples/nft-set-parse-add.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2015-09-01 20:19:56 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2015-09-07 19:24:19 +0200
commit760768890e60617acfd144dce875a4a3be14513c (patch)
tree14a3a4f53e81fd9b44c8481e123f2c0ceb6f2bff /examples/nft-set-parse-add.c
parentb7154e52fc417e927bef0bbfa5db6e7a71f28602 (diff)
src: rename existing functions to use the nftnl_ prefix
So we can use the nft_* prefix anytime soon for our upcoming higher level library. After this patch, the nft_* symbols become an alias of the nftnl_* symbols. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'examples/nft-set-parse-add.c')
-rw-r--r--examples/nft-set-parse-add.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/examples/nft-set-parse-add.c b/examples/nft-set-parse-add.c
index f21385f..57326ee 100644
--- a/examples/nft-set-parse-add.c
+++ b/examples/nft-set-parse-add.c
@@ -28,14 +28,14 @@
#include <libmnl/libmnl.h>
#include <libnftnl/set.h>
-static struct nft_set *set_parse_file(const char *file, uint16_t format)
+static struct nftnl_set *set_parse_file(const char *file, uint16_t format)
{
int fd;
- struct nft_set *s;
- struct nft_parse_err *err;
+ struct nftnl_set *s;
+ struct nftnl_parse_err *err;
char data[4096];
- s = nft_set_alloc();
+ s = nftnl_set_alloc();
if (s == NULL) {
perror("OOM");
return NULL;
@@ -54,21 +54,21 @@ static struct nft_set *set_parse_file(const char *file, uint16_t format)
}
close(fd);
- err = nft_parse_err_alloc();
+ err = nftnl_parse_err_alloc();
if (err == NULL) {
perror("error");
return NULL;
}
- if (nft_set_parse(s, format, data, err) < 0) {
- nft_parse_perror("Unable to parse file", err);
- nft_parse_err_free(err);
+ if (nftnl_set_parse(s, format, data, err) < 0) {
+ nftnl_parse_perror("Unable to parse file", err);
+ nftnl_parse_err_free(err);
return NULL;
}
- nft_parse_err_free(err);
+ nftnl_parse_err_free(err);
- nft_set_attr_set_u32(s, NFT_SET_ATTR_ID, 1);
+ nftnl_set_attr_set_u32(s, NFTNL_SET_ATTR_ID, 1);
return s;
}
@@ -79,7 +79,7 @@ int main(int argc, char *argv[])
char buf[MNL_SOCKET_BUFFER_SIZE];
struct nlmsghdr *nlh;
uint32_t portid, seq, set_seq;
- struct nft_set *s;
+ struct nftnl_set *s;
int ret, batching;
uint16_t family, format, outformat;
struct mnl_nlmsg_batch *batch;
@@ -90,11 +90,11 @@ int main(int argc, char *argv[])
}
if (strcmp(argv[1], "xml") == 0) {
- format = NFT_PARSE_XML;
- outformat = NFT_OUTPUT_XML;
+ format = NFTNL_PARSE_XML;
+ outformat = NFTNL_OUTPUT_XML;
} else if (strcmp(argv[1], "json") == 0) {
- format = NFT_PARSE_JSON;
- outformat = NFT_OUTPUT_JSON;
+ format = NFTNL_PARSE_JSON;
+ outformat = NFTNL_OUTPUT_JSON;
} else {
printf("Unknown format: xml, json\n");
exit(EXIT_FAILURE);
@@ -104,11 +104,11 @@ int main(int argc, char *argv[])
if (s == NULL)
exit(EXIT_FAILURE);
- nft_set_fprintf(stdout, s, outformat, 0);
+ nftnl_set_fprintf(stdout, s, outformat, 0);
fprintf(stdout, "\n");
seq = time(NULL);
- batching = nft_batch_is_supported();
+ batching = nftnl_batch_is_supported();
if (batching < 0) {
perror("cannot talk to nfnetlink");
exit(EXIT_FAILURE);
@@ -117,22 +117,22 @@ int main(int argc, char *argv[])
batch = mnl_nlmsg_batch_start(buf, sizeof(buf));
if (batching) {
- nft_batch_begin(mnl_nlmsg_batch_current(batch), seq++);
+ nftnl_batch_begin(mnl_nlmsg_batch_current(batch), seq++);
mnl_nlmsg_batch_next(batch);
}
- family = nft_set_attr_get_u32(s, NFT_SET_ATTR_FAMILY);
+ family = nftnl_set_attr_get_u32(s, NFTNL_SET_ATTR_FAMILY);
set_seq = seq;
- nlh = nft_set_nlmsg_build_hdr(mnl_nlmsg_batch_current(batch),
+ nlh = nftnl_set_nlmsg_build_hdr(mnl_nlmsg_batch_current(batch),
NFT_MSG_NEWSET, family,
NLM_F_CREATE|NLM_F_ACK, seq++);
- nft_set_nlmsg_build_payload(nlh, s);
- nft_set_free(s);
+ nftnl_set_nlmsg_build_payload(nlh, s);
+ nftnl_set_free(s);
mnl_nlmsg_batch_next(batch);
if (batching) {
- nft_batch_end(mnl_nlmsg_batch_current(batch), seq++);
+ nftnl_batch_end(mnl_nlmsg_batch_current(batch), seq++);
mnl_nlmsg_batch_next(batch);
}