SNMP Subagent Programmer's Guide

Management Functions
4-14 119728SNMP Subagent Programmer’s Guide
Writing Subagent Logic
mgmt_poll()
The mgmt_poll() function accepts an SNMP request from the NonStop agent, then
processes it and sends a response back to the agent. If you call mgmt_read_nowait()
before calling mgmt_poll(), mgmt_poll() reads the request from a buffer you allocate
before the call to mgmt_read_nowait(). Otherwise, mgmt_poll() initiates a waited read
to the NonStop agent, blocking further processing until an SNMP message is received.
The functions the run-time library calls to process requests depends on the kind of
operation requested:
To perform a Get operation, the library calls a Get access function. If you provide
your own access functions for the target object, the library calls your Get function;
otherwise, it calls the Get function generated by GDMOC.
When the object is a table entry, the run-time library calls a locator function before
calling the Get function:
If you register each entry in the table, the library uses its own locator function.
If you register the entire table rather than all its entries, you must provide a
locator function for the library to call.
To perform a GetNext operation, the library acts as described for Get operations on
tables, but calls a next function before calling the locator function:
If you register each entry in the table, the library uses its own next function.
If you register the entire table rather than all its entries, you must provide a next
function for the library to call.
To perform a Set operation, the library calls a Test access function associated with
the target object. If the Test function succeeds, it calls the associated Set access
function; if the Test function fails, the Set function is not called. If you provide your
own access functions for the object, the library uses the Test and Set functions you
provide; otherwise, it calls the Test and Set functions generated by GDMOC.
When the NonStop agent receives a Set request containing variable bindings for
different subagents, the appropriate Test functions for each subagent are called.
Only if they all succeed is the Set request completed.
More information on writing your own next, locator, and access functions is described
later in this section, under “Callback Functions.
Note. The first time mgmt_poll() is called, the response the caller receives (rc = 0) indicates
that the NonStop agent has completed operations related to object registration. Subsequent
executions process SNMP requests from managers.