On 1 October 2010 16:54, Leo Cacciari <leo.cacci...@gmail.com> wrote:
> I'm trying to understand a thing about  the "new" API. What does it
> means that
>
> A handler is netsnmp_create_handler() created and then
> netsnmp_register_handler() registered with the main agent at a given OID
> in the OID tree and gets called any time a request is made that it
> should respond to.
>
> Does the handler receive all the requests asking for an OID under the
> root OID at which the handler is registered?

Sort-of, yes.

That's the basic idea of registering a handler - it says
   "I'm willing to deal with anything within this subtree"

But there are two complications:

  -  If handler A registers one OID (say .1)
     and then handler B registers an OID within this subtree (say .1.3)
     then they are both laying claim to the same set of OID
       (i.e. everything under .1.3)
     Any requests received for OIDs within this disputed range
        are given to the more specific registration (i.e. handler B)

  - The registration is actually of a handler *chain*, rather
     than a single handler routine.   The incoming request is
     passed to the start of the chain - but may not necessarily
     make its way through to the final handler.

For example, if you write a handler to deal with a scalar MIB object
(say sysDescr), and register this using 'register_scalar_handler' - then
this handler chain will include a helper which knows about scalars.
In particular, it knows that the only valid instance for a scalar object
is .0
   So if the agent receives a request for sysDescr.1, this request will
be passed to the registered chain, where the scalar helper will say
"this can't possibly be valid", and return an error without ever calling
your sysDescr handler

Similar things may happen with table-based handler chains.

But the basic idea is that for any portion of the OID tree, there's
a handler (chain) which is ready to deal with requests for those OIDs.

OK?

Dave

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to