On 28 March 2011 08:29, Manjit <manjit.si...@globaledgesoft.com> wrote:
>  > How the handlers are registered for a particular oid.

This basically uses 'netsnmp_register_handler()'
   (either directly, or via another helper registration call,
which typically sets up the helper and handler chain information
and then calls 'netsnmp_register_handler()')


> What data structure net-snmp using to implement this.

netsnmp_register_handler()   [see agent/agent_handler.c]
   takes a netsnmp_handler_registration pointer,
   and calls netsnmp_register_mib()  [agent/agent_registry.c]
This converts the registration structure information into a
  netsnmp_subtree structure  [defined in <net-snmp/agent/var_struct.h>]

These are linked into a list, ordered by OID.
The one unusual aspect of this is that each node is actually
the head of another *list* of registration entries (via the
'children' field) - all sharing the same OID range - with
the most specific registration coming first.


>  > How the tree is searched whenever a request arrives for a particular oid.

The agent searches this list to find the subtree entry that
contains the specified OID (i.e. lying within start_a and end_a).
It takes this entry (the top one in the list of registrations with
the same range), and calls the corresponding handler chain to
process the request varbind.

   (There's actually a lookup cache which speeds up this search,
so the code looks rather more complicated than this brief
description implies,  but that doesn't affect the underlying behaviour)


I've skipped over a lot of the detail - but hopefully that's enough
to get you started.

Dave

------------------------------------------------------------------------------
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
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to