SNMP Subagent Programmer's Guide

Writing Subagent Logic
SNMP Subagent Programmer’s Guide119728 4-11
Management Functions
mgmt_new_instance()
The mgmt_new_instance() function makes a collection of MIB objects manageable.
This function performs a process called “registration,” which lets the NonStop agent
know which MIB objects you are making available for management. You register the
entire MIB, then any group, table, or table entry within it that you want to make
accessible to managers.
When registering tables, you have two options:
Register every entry in the table. Use this approach when tables have few entries
that are not created or deleted often. The run-time library handles all the entry
access for you, so this technique simplifies subagent logic and reduces your
development time. When you register every entry in the table, do not provide next
or locator functions for finding entries; entry registration provides the run-time
library with the information it needs to find any entry.
Register the entire table. Use this approach when tables have a changeable
number of entries. This approach may also be warranted for enormous tables,
because registration time is much shorter. When you register an entire table, you
must provide next and locator functions for the run-time library to use when it needs
to find individual entries. Refer to “Callback Functions,” later in this section, for
how to encode next and locator functions.
More than one subagent can register objects described by a particular MIB. However,
when multiple subagents are using the same MIB, they cannot register the same groups
or tables concurrently with the same NonStop agent.
instance-handle
is a void pointer that identifies the object instance. You pass this handle as an
argument to mgmt_del_instance() to clean up memory used for management of the
objects associated with this instance. You pass the value of mgmt-env to terminate
registration of the objects, making them available for use by other subagents or
another process for the same subagent.
mgmt-env
is the void pointer returned from an earlier call to mgmt_init_env().
class
is a pointer to a class definition structure in the GDMOC output for the object you
want to make manageable. GDMOC names the class definition structure by adding
#include "mgmtpubh"
instance-handle = mgmt_new_instance(mgmt-env, class,
context);
void *
mgmt_new_instance(mgmt-env, class, context);
void *mgmt-env;
struct class_definition *class;
void *context;