These are examples C codes of what you can achieve with libnftnl.
Basic functions are:
 * fetch the ruleset from the kernel.
 * update (add/delete) the ruleset.
 * Set-up a event listener environment.
 * Play with nftables sets infraestructure
 * Parse/print nftables objects in XML/JSON.

To test the examples, run:
 $ gcc -lmnl -lnftnl nft-rule-add.c -o nft-rule-add

If the example requires XML, link agains libmxml:
 $ gcc -lmnl -lnftnl -lmxml nft-rule-xml-add.c -o nft-rule-xml-add

If the example requires JSON, link agains libjansson:
 $ gcc -lmnl -lnftnl -ljansson nft-rule-json-add.c -o nft-rule-json-add

You will need the Linux kernel nf_tables.h header:
 * linux/netfilter/nf_tables.h

Then you can run:
 # ./nft-rule-add ip filter input
 # ./nft-rule-xml-add file.xml

Also, you can find examples XML and JSON files, both describing a ruleset.
 * example.xml
 * example.json
