Question about args parsing .consume()
Markku Savela <[email protected]>
| Newsgroups | gmane.network.routing.click |
|---|---|
| Message-ID | <[email protected]> |
I don't fully understand the working of consume, I
have the following fragment..
click_chatter("conf size=%u", conf.size());
if (Args(conf, this, errh)
.read_mp("IPSEC", ElementCastArg("IPsec"), _ipsec)
.consume() < 0)
return -1;
click_chatter("conf size=%u", conf.size());
And for
km::IPsecKM(ipsec, SELECTOR vpn, SA sa);
it outputs:
conf size=3
conf size=3
I thought the .consume() was supposed to remove the
parsed argument, e.g. expected latter output to be
conf size=2? If size is not modified, then how do
I parse the remaining arguments, of which there
can be many?
Related, ARPQuerier is using consume to parse first
a lot of options, and then later makes a test
conf.size() == 1 to do something. I cannot figure
out why that would work if you specified any of the
arguments in the first parse call? (This caused
me to assume conf.size() was modified...)