SNMP Subagent Programmer's Guide
Callback Functions
4-26 119728—SNMP Subagent Programmer’s Guide
Writing Subagent Logic
MIB Extensions
You let the run-time library know about callback functions by encoding extensions in 
MIB object definitions for objects on which the functions operate.
Locator Functions
Locator functions are identified in the ACCESS clause for a MIB object. The following 
MIB definition, taken from the MIB used by the Indexed Trap Generator sample 
program, identifies a locator function named locate_entry.  This function is called when 
the run-time library needs to find entries that have a particular value for cardNumber, 
one of three objects constituting a table entry:
 TableEntry ::=
 SEQUENCE {
 cardNumber INTEGER,
 portNumber INTEGER,
 ratio DisplayString
 }
 cardNumber OBJECT-TYPE
 SYNTAX INTEGER (1..1000)
 ACCESS read-only
 C_STRUCT mytable, FIELD card
 C_LOCATOR_FUNC locate_entry
 STATUS mandatory
 DESCRIPTION
 "The card number index of the table"
 ::= { tblTrapTableEntry 1 }
Table 4-4. When to Use Callback Functions
Condition Functions Description
Request preprocessing Locator function The subagent needs to perform some 
operation before a Get or Set operation on a 
particular MIB object.
Dynamic table handling Next function
Locator function
A tabular MIB object contains entries that 
are added or deleted during subagent 
execution or a cache must be checked and 
sometimes refreshed before a variable is 
accessed. To process GetNext requests, the 
run-time library calls the next function, the 
locator function, then the Get access 
function. To process Get and Set requests, 
it calls the locator function, then the Get or 
Set access function.
Unique operations Get access function
Test access function
Set access function
The access functions generated by GDMOC 
are not able to handle the request processing 
required. To process read-only objects, the 
Get function is called. To process Set 
requests, the Test function is called before 
the Set function.










