[Click] Configuration parsing with Args: variable argument list with minimum size?

Bart Braem bart.braem at ua.ac.be
Fri Jan 20 04:39:06 EST 2012


Hi Eddie,

That makes perfect sense. I'm impressed by the elegance of the new Args class, it's really a great implementation!
I'll see if I can polish up my code so I can commit this rather trivial but useful element.
On a related topic: is there an EtherPrint or EthernetPrint element, similar to IPPrint? Otherwise I'll implement and contribute one too.

best regards,
Bart

On 19 Jan 2012, at 17:51, Eddie Kohler wrote:

> Hi Bart,
> 
> What I would do is use Args for the mandatory & optional arguments, but rather than end with .complete(), end with .consume(). Then process the leftovers however best makes sense.
> 
> For an example, see UDPRewriter, which strips off a bunch of keywords with Args(this, errh).bind(conf).read........consume().
> 
> Make sense?
> Eddie
> 
> 
> On 1/19/12 10:57 AM, Bart Braem wrote:
>> Hi all,
>> 
>> I'm creating a new element which would be something like HostEtherFilter but with multiple ethernet addresses and less focused on host based functionality. To do this, I'm trying to parse a configuration consisting of
>> - some mandatory arguments
>> - some optional keywords
>> - and then a variable size argument list with a minimum size
>> What would be the cleanest way to implement this with the recent Args argument parsing code? Especially the last part, the variable size argument list, seems tricky to do properly. I've looked into the regular Classifier etc, but these elements do not seem to use the Args code.
>> 
>> best regards,
>> Bart

-- 
Bart Braem
PATS research group - IBBT
Dept. of Mathematics and Computer Science
University of Antwerp
Campus Middelheim, G3.26
Middelheimlaan 1
B-2020 Antwerpen, Belgium
Phone: +32 (0)3 265.38.64
Fax: +32 (0)3 265.37.77
Web: www.pats.ua.ac.be




More information about the click mailing list