Hi,

After a good night sleep I found the (rather obvious) answer myself.
The initialisation code which depends on the myInteger token goes into
parse_myInteger(). The handler will get called before any gets/sets
are processed and also gets called on SIGHUP, just what I need. All
very obvious, I blame it on lack of sleep :-)

Thanks,

Holger

On 26 October 2012 13:26, Holger Klaas <holger.kl...@gmail.com> wrote:
> Hi,
>
> I am writing a MIB module and I want to pass an integer config token
> from the command line to the module. I need the token to be available
> in the module init function.
>
> I am using Net-SNMP v5.4.4 and I am starting the agent like this:
> snmpd --myInteger=2
>
> This is my module init function:
>
> static int myInteger = -1;
>
> void init_my_module(void)
> {
>     snmpd_register_config_handler("myInteger", parse_myInteger, NULL, NULL);
>
>     // <snipped> OID handler registrations
> }
>
> The myInteger variable will be read correctly, but only sometime after
> init_my_module() returns. But I need the variable during the module
> initialisation. Is there a way to make the config token available
> inside init_my_module()?
> If not, would it be possilble to register a callback handler which
> gets called after the config tokens are read but before the first
> gets/sets get processed?
>
> Thanks in advance,
>
> Holger

------------------------------------------------------------------------------
WINDOWS 8 is here. 
Millions of people.  Your app in 30 days.
Visit The Windows 8 Center at Sourceforge for all your go to resources.
http://windows8center.sourceforge.net/
join-generation-app-and-make-money-coding-fast/
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to