diff options
author | Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com> | 2013-09-16 20:24:51 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2013-09-16 22:42:43 +0200 |
commit | 210adc4063a7557b3bc0ffd69bd992c0bec4bacc (patch) | |
tree | 784228ac8183c4f4da0f696954040e214dfa760b /src/internal.h | |
parent | 2f5a7c560ab5e20111f6196181a603e1bd3f8791 (diff) |
src: xml: refactor XML parsing code
This patch refactors nft_*_xml_parse to provide a new intermediate function
nft_mxml_parse_* which will allow us to navigate an entire XML tree
containing a ruleset without xml2text2xml conversions.
While at it, I added a helper to build the XML tree and validate the top node
name.
Signed-off-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
Diffstat (limited to 'src/internal.h')
-rw-r--r-- | src/internal.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/internal.h b/src/internal.h index 3d749b3..df64dd8 100644 --- a/src/internal.h +++ b/src/internal.h @@ -32,6 +32,7 @@ enum nft_type { #include <mxml.h> #define NFT_XML_MAND 0 #define NFT_XML_OPT (1 << 0) +mxml_node_t *nft_mxml_build_tree(const char *xml, const char *treename); struct nft_rule_expr *nft_mxml_expr_parse(mxml_node_t *node); int nft_mxml_reg_parse(mxml_node_t *tree, const char *reg_name, uint32_t flags); union nft_data_reg; @@ -42,6 +43,14 @@ int nft_mxml_family_parse(mxml_node_t *tree, const char *node_name, uint32_t mxm struct nft_set_elem; int nft_mxml_set_elem_parse(mxml_node_t *node, struct nft_set_elem *e); +struct nft_table; +int nft_mxml_table_parse(mxml_node_t *tree, struct nft_table *t); +struct nft_chain; +int nft_mxml_chain_parse(mxml_node_t *tree, struct nft_chain *c); +struct nft_rule; +int nft_mxml_rule_parse(mxml_node_t *tree, struct nft_rule *r); +struct nft_set; +int nft_mxml_set_parse(mxml_node_t *tree, struct nft_set *s); #endif #ifdef JSON_PARSING |