diff options
author | Arturo Borrero <arturo.borrero.glez@gmail.com> | 2014-01-09 12:19:06 +0100 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2014-01-09 17:17:37 +0100 |
commit | fc423ae81487e906141f700c7b3515328ff62b7c (patch) | |
tree | d55537396d2ccca278df628853f4febf8ed4e697 /src/internal.h | |
parent | 2c21b41889abf93ff816b82b59e6bf2d4a084a61 (diff) |
src: rework and generalize the build/parse system
The intention behind this patch is to prepare the introduction of
the new API that will allow us to parse files that contain the rule-sets
expressed in XML/JSON format. This adds the NFT_PARSE_BUFFER that
indicates that the input is provided in a buffer, which is what we
currently support.
Signed-off-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/internal.h')
-rw-r--r-- | src/internal.h | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/internal.h b/src/internal.h index 5fef6d6..fa092cf 100644 --- a/src/internal.h +++ b/src/internal.h @@ -38,12 +38,16 @@ struct nft_parse_err { const char *node_name; }; +enum nft_parse_input { + NFT_PARSE_BUFFER, +}; + #ifdef XML_PARSING #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_parse_err *err); +mxml_node_t *nft_mxml_build_tree(const void *data, const char *treename, + struct nft_parse_err *err, enum nft_parse_input input); struct nft_rule_expr *nft_mxml_expr_parse(mxml_node_t *node, struct nft_parse_err *err); int nft_mxml_reg_parse(mxml_node_t *tree, const char *reg_name, uint32_t flags, @@ -88,8 +92,8 @@ int nft_jansson_parse_val(json_t *root, const char *node_name, int type, const char *nft_jansson_parse_str(json_t *root, const char *node_name, struct nft_parse_err *err); bool nft_jansson_node_exist(json_t *root, const char *node_name); -json_t *nft_jansson_create_root(const char *json, json_error_t *error, - struct nft_parse_err *err); +json_t *nft_jansson_create_root(const void *json, json_error_t *error, + struct nft_parse_err *err, enum nft_parse_input input); json_t *nft_jansson_get_node(json_t *root, const char *node_name, struct nft_parse_err *err); void nft_jansson_free_root(json_t *root); |