Hi Dave,
Thanks for your continuous support on this...

I go through the example specified in "agent/mibgroup/testhandler.c"

>From the example what I got is,

1. netsnmp_register_handler(netsnmp_create_handler_re gistration
("myTest", my_test_handler, my_test_oid, 4,

2. my_test_handler(netsnmp_mib_handler *handler,
netsnmp_handler_registration *reginfo,
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests)

To register multiple instance of same MIB I have to call
"netsnmp_register_handler" function with different context. (Currently
there is no way to pass context to "netsnmp_create_handler_registration"
function in

"my_test_handler" function will be called to retrieve the data for any
request from manager with defined context. Also I can easily get the
context name from " netsnmp_agent_request_info *reqinfo" parameter.

May I know my above assumption is correct or not?

-----Original Message-----
From: dave.shield@googlemail.com [mailto:dave.shield@googlemail.com] On
Behalf Of Dave Shield
Sent: Wednesday, August 30, 2006 5:57 PM
To: Jayaprakasha Guddenahalli Naganna
Cc: net-snmp-coders@lists.sourceforge.net
Subject: Re: registering same oid twice with different context and
single (same)callback function (var_*) from one agentx subagent

On 30/08/06, Jayaprakasha Guddenahalli Naganna
> Regarding v5-API's I have just only one question,
> 1. Will v5-API's forward context to var_* function?

The v5-API is based around "handlers" (see assorted examples in the
current source distributions). The parameters to this include an
(indirect) pointer to the original PDU, thus providing access to the
context for that request. This is perhaps not as obvious as it might
be, but it is available.

Current Net-SNMP distributions also support the old 'var_xxx' function
approach, for compatability with earlier code. This retains the same
interface as the v4 UCD releases, so does not expose the context of
the original request.

So the answer to your question as posed above is No - the v5-API does
not forward context to the var_* function. (Because that function is
actually the v4-API). The v5 handler-based API *does* forward the
context to the MIB-specific code (but doesn't use the same 'var_*'

> Also because of I have only one subagent which has to control multiple
> instances of mib dynamically I can't define var_* functions on the fly
> while registering mib. I am desperately wanted context to be passed to
> var_* functions. If v5-API's supports this means I will definitely go

for it.

Delete "var_*" and insert "*_handler" - then yes. v5-API supports this.


Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
Net-snmp-coders mailing list