Template:FAQ:Coding 11
Many of the MIB modules shipped with the Net-SNMP agent still
use the v4 "traditional" MIB module API, but an increasing number
use one of the newer v5 helper-based handlers. All of these can
be found under agent/mibgroup
The tdata
helper is used in the new DisMan Event,
Expression and Schedule MIB modules
(see disman/{event,expr,schedule}/*
).
The similar dataset
helper is used in the older DisMan Event
MIB implementation (see disman/mteEvent*
)
and the Notification Log MIB (see notification-log-mib/*
),
used by snmptrapd
to log incoming traps.
The basic iterator handler is used in a number of modules, such
as the TCP and UDP table implementations (mibII/tcpTable &
mibII/udpTable
), VACM context handling (mibII/vacm_context
) and
various tables relating to agent internals (agent/*
).
These show
a number of different approaches to using the iterator helper, so
it's worth comparing them.
The two examples/netSnmpHostsTable*
modules provide a
contrast between the iterator and iterator_access helpers.
There are an ever-increasing number of examples based on the
MfD framework (see {if,ip,tcp,udp}-mib/
). Much of this
code is not intended to be viewed directly, but individual files
are clearly commented to distinguish between internal implementation
and public code.
The Net-SNMP agent does not currently include any MIB modules
using the array-user
container-based helper. The best examples
of this are to be found in the net-policy project.
See http://net-policy.sourceforge.net/