SNMP Subagent Programmer's Guide

Callback Functions
4-30 119728SNMP Subagent Programmer’s Guide
Writing Subagent Logic
access-function-name
is the name that appears in the MIB definition for the MIB object:
MIB-object-name OBJECT-TYPE
...
ACCESS {READ-ONLY|READ-WRITE|WRITE-ONLY}
C_ACCESS_FUNC access-function-name
[ C_LOCATOR_FUNC locator-function-name ]
...
context
is an input value returned from a call to a locator function, if one is associated with
the MIB object. Otherwise, context is the context pointer passed to
mgmt_new_instance() when management of this object was initiated.
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.
value
is an output pointer to a value having the same syntax as specified in the MIB
definition for the MIB object; refer to the header file named smitypeh for more
information on syntax. If this function performs a Get operation, value points to a
data structure that this function fills in. If this function performs a Set or Test
operation, value points to a data structure that this function should copy into local
storage if it needs to be saved.
Example
The following example is taken from the sample subagent named System Time
Manager. This subagent provides access functions for a MIB object named
systemTimeString:
systemTimeString OBJECT-TYPE
SYNTAX DisplayString (SIZE (19))
ACCESS read-write
C_ACCESS_FUNC systemTimeString
STATUS mandatory
DESCRIPTION
"The system’s local time. GET means get current
system time; SET means set system time. GET
will always work, but subagent process must
run as SUPER group member for SET to work.
Format of time string is: ''YYYY/MM/DD HH:MM:SS''.
SET time must be in the range 1975 Jan 01
00:00:00 to 4000 Dec 31 23:59:59.999999."
::= { systime 1 }