________________________________
From: Dave Shield <[email protected]>
To: sujata patra <[email protected]>
Cc: net-snmp-coders <[email protected]>
Sent: Wed, March 23, 2011 4:57:34 PM
Subject: Re: register_premib_handler ?

On 23 March 2011 10:20, sujata patra <[email protected]> wrote:
> "agentxsocket" directive is working fine .
>
> But The other config parameters are not getting initialized before the call
>      init_nstAgentSubagentObject();

Correct - the 'init_xxx' routines are all called *before* the config
files are processed.   (both pre- and post- MIB)
   That's inherent in the framework of the agent, since the init_xxx
routines are where these config handlers are actually registered.

If the agent tried to process the config files before the init routines,
then there's be no config handlers registered to do the processing.



> I want few config tokens to be read before the module initialization.
> Module initialization needs them.

Can't be done.
Or at least, not that way.

If there is initialisation that depends on the configuration settings,
then this should either be done in the config handlers, or (if this
isn't appropriate), by registering a "post-config" callback, to be
run after the config files have been handled.

Sorry I am not very clear on this . 

> let 's say in the init_nstAgentSubagentObject() I want to  register a table
> with cache_expiry interval
> I do not want to give any fixed value but like to have it in the config  file.

The natural way to handle this would be to have a default cache expiry
time (set when you register the table),  and then have the config handler
change this value.
   That would also handle the situation where the administrator didn't
set a value in the config file.

Dave
Let's say the tableis registered as below .
initialize_xxxx {
netsnmp_inject_handler_before(reg, 
        netsnmp_get_cache_handler(timeout_default_value,
                                 xxx_load,xxx_free,
                                 xxx_oid,xxx_oid_len),
            TABLE_ITERATOR_NAME);
struct config_line * cl = register_app_prenetsnmp_mib_handler("cacheTimeout",
              getTimeout, NULL, NULL);
}

 getTimeout(const char *token, char *line)
 {
        int cacheTimeOut_ = 0;
         
         line = read_config_read_data(ASN_INTEGER,   line,
                                 &cacheTimeOut_, NULL);
+    netsnmp_cache * cache =  netsnmp_cache_find_by_oid(xxx_oid,xxx_oid_len);
+     cache->timeout= cacheTimeOut_

}

Do you mean to say this ?  


      
------------------------------------------------------------------------------
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software 
be a part of the solution? Download the Intel(R) Manageability Checker 
today! http://p.sf.net/sfu/intel-dev2devmar
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to