netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [libnftables PATCH 1/3] parsing: rework and generalize the build/parse system
Date: Thu, 9 Jan 2014 17:57:29 +0100	[thread overview]
Message-ID: <20140109165729.GA15460@localhost> (raw)
In-Reply-To: <20140109111906.32565.65222.stgit@nfdev.cica.es>

On Thu, Jan 09, 2014 at 12:19:06PM +0100, Arturo Borrero Gonzalez wrote:
> The intention behind this patch is to allow adding more input sources in the
> near future.

This looks more simple and easier to read which is what I needed,
thanks. Applied with minor glitches, see below.

> For this to happen without duplicating many code, we need to generalize
> the build/parse system.
> 
> The path flow is now as follow:
>  * API func: here we decide what kind of input we have.
> 	nft_table_parse()
> 
>  * Common function to decide what format to parse (JSON/XML).
> 	nft_table_do_parse()
> 
>  * Common function per format to order the build of the tree and launch the
>    parsing:
> 	nft_table_xml_parse()
> 	nft_table_json_parse()
> 
>  * Common function per format to build the tree (here more builders can be
>    easily implemented):
> 	nft_mxml_build_tree()
> 	nft_jansson_create_root()
> 
> Signed-off-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
> ---
>  0 files changed
> 
> diff --git a/src/chain.c b/src/chain.c
> index a4ddb06..a7a6d99 100644
> --- a/src/chain.c
> +++ b/src/chain.c
> @@ -591,14 +591,14 @@ err:
>  }
>  #endif
>  
> -static int nft_chain_json_parse(struct nft_chain *c, const char *json,
> -				struct nft_parse_err *err)
> +static int nft_chain_json_parse(struct nft_chain *c, const void *json,
> +				struct nft_parse_err *err, uint32_t buildsrc)

Comestical: I have added enum nft_parse_input, I think this improves
readability instead of buildsrc.

      parent reply	other threads:[~2014-01-09 16:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-09 11:19 [libnftables PATCH 1/3] parsing: rework and generalize the build/parse system Arturo Borrero Gonzalez
2014-01-09 11:19 ` [libnftables PATCH 2/3] parsing: add interface to parse from file Arturo Borrero Gonzalez
2014-01-09 16:58   ` Pablo Neira Ayuso
2014-01-09 11:19 ` [libnftables PATCH 3/3] tests: update tests with nft_*_parse_file() Arturo Borrero Gonzalez
2014-01-09 17:00   ` Pablo Neira Ayuso
2014-01-09 16:57 ` Pablo Neira Ayuso [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140109165729.GA15460@localhost \
    --to=pablo@netfilter.org \
    --cc=arturo.borrero.glez@gmail.com \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).