SNMP Subagent Programmer's Guide

Callback Functions
4-32 119728—SNMP Subagent Programmer’s Guide
Writing Subagent Logic
Locator Functions
Locator functions are used to locate a particular table entry or to perform some operation
in your subagent before the run-time library processes an SNMP Get or Set request for a
particular object. The function accepts arguments that identify the MIB object, and
returns a pointer to its associated context. Always provide a locator function and a next
function when you do not register each entry in tables you make available for manager
access.
void *
is an output pointer to the context of the MIB object described by the index-list
argument. This value should be NULL if no such object exists. Typically, this
return value is the address of struct-name in the C-access-method clause of the MIB
definition for a table entry.
locator-function-name
is the name that appears in the MIB definition for the MIB object, typically a table
entry:
MIB-object-name OBJECT-TYPE
...
ACCESS {READ-ONLY|READ-WRITE|WRITE-ONLY}
C-access-method
[C_LOCATOR_FUNC locator-function-name]
...
parent-context
is an input pointer to the context of the MIB object. The value of parent-context is
the same as that passed to mgmt_new_instance in the context argument.
index-list
is an input pointer to an ordered array of pointers. For indexed MIB objects, each
pointer in the array points to an index value. For nonindexed MIB objects, this
argument is NULL.
op
describes the type of SNMP operation the run-time library is processing. As
specified in the include file named locatorh, possible values for this argument are:
#include "locatorh"
void
*locator-function-name(parent-context, index-list, op);
void *parent-context;
void **index-list;
int op;