[bind10-dev] CCSession question

Michal 'vorner' Vaner michal.vaner at nic.cz
Thu Sep 27 06:55:09 UTC 2012


Hello

On Wed, Sep 26, 2012 at 07:51:30PM +0200, Tomek Mrugalski wrote:
> The problem occurs, when I stop and start bind10. As soon as I create
> ModuleCCSession(), it will call my config_handler, but will pass only
> part of the configuration (without any fields that have default values).
> In this particular example, I receive only:
> 
> { "subnet6": [ { "pool": [ "2001:db8:1::1 - 2001:db8:1::ffff" ],
> "subnet": "2001:db8:1::/64" } ] }
> 
> My parser does not know values of renew-timer, so I can't really
> configure subnets.

Reading all the above, I was wondering if you're aiming to this problem or some
other the whole time. I was right :-)).

What I usually do is ignore the parameter of the callback and request the whole
config by getFullConfig (I hope I remember the name of the function right) to
parse.

Other option is having the defaults hardcoded in the code and check if the value
is present, schematically like this:

int renew_timeout(1000);

void configHandler(config) {
  if (config->contains("renew_timeout")) {
    renew_timeout = config->get("renew_timeout")->intValue();
  }
}

I believe we have both styles in the code somewhere, I personally prefer the
first one, since the default value is at a single place, not two.

With regards

-- 
How many Lisp programmers does it take to change a light bulb?
(((H)mmm,) (I'm ((not) sure, better))) (find (out))...

Michal 'vorner' Vaner
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <https://lists.isc.org/pipermail/bind10-dev/attachments/20120927/45753179/attachment.bin>


More information about the bind10-dev mailing list