netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phil Sutter <phil@nwl.cc>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [nft PATCH RFC] libnftables: Implement JSON output support
Date: Wed, 17 Jan 2018 20:24:36 +0100	[thread overview]
Message-ID: <20180117192436.GF25722@orbyte.nwl.cc> (raw)
In-Reply-To: <20180117185934.z3po4izqwsyc5vze@salvia>

On Wed, Jan 17, 2018 at 07:59:34PM +0100, Pablo Neira Ayuso wrote:
> On Wed, Jan 17, 2018 at 07:56:30PM +0100, Phil Sutter wrote:
> > On Wed, Jan 17, 2018 at 07:45:04PM +0100, Pablo Neira Ayuso wrote:
> > [...]
> > > > On Wed, Jan 17, 2018 at 01:50:26PM +0100, Pablo Neira Ayuso wrote:
> > > > > On Wed, Jan 17, 2018 at 01:44:06PM +0100, Pablo Neira Ayuso wrote:
> > > > > > On Wed, Jan 17, 2018 at 12:51:40PM +0100, Phil Sutter wrote:
> > > > > [...]
> > > > > > 
> > > > > > > * There is quite some code-duplication involved given that this
> > > > > > >   introduces an alternative function for almost any function in the
> > > > > > >   affected code path.
> > > > > > 
> > > > > > You mean, a new callback for each expr/datatype? We should not expose
> > > > > > bitwise/byteorder and such, it's too low level.
> > > > > 
> > > > > I'd rather see you map the abstract syntax tree that is represented
> > > > > through parser_bison.y to your json representation. I think this patch
> > > > > is mapping the tree that we obtain after the evaluation phase, which
> > > > > comes with low level expressions such as bitwise/byteorder.
> > > > 
> > > > I don't get your point here, either: Not sure what this has to do with
> > > > parser_bison.y - my patch handles output only for now, I didn't bother
> > > > with input yet. Or am I on the completely wrong track now?
> > > 
> > > Sorry, I was refering about the input support.
> > 
> > Ah, I see. For input, I did consider using bison BTW, but doubt it will
> > lead to less code than implementing everything with libjansson. And yes,
> > this will then be on the same level as parser_bison.y, so what is parsed
> > will then be fed to cmd_evaluate().
> 
> Not asking to build a json parser in bison. I mean, json layout should
> result in an abstract syntax tree, that is exactly what nft bison
> would generate.
> 
> Does this clarify?

Well, it was clear all the time. :)

We were talking about maybe using bison as code generator to keep the
layer that translates from JSON to the abstract syntax tree you are
talking about slim in matters of lines of code. Hence why I mentioned
it.

Cheers, Phil

      reply	other threads:[~2018-01-17 19:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-17 11:51 [nft PATCH RFC] libnftables: Implement JSON output support Phil Sutter
2018-01-17 12:44 ` Pablo Neira Ayuso
2018-01-17 12:50   ` Pablo Neira Ayuso
2018-01-17 17:52   ` Phil Sutter
2018-01-17 18:45     ` Pablo Neira Ayuso
2018-01-17 18:56       ` Phil Sutter
2018-01-17 18:59         ` Pablo Neira Ayuso
2018-01-17 19:24           ` Phil Sutter [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=20180117192436.GF25722@orbyte.nwl.cc \
    --to=phil@nwl.cc \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.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).