SNMP Subagent Programmer's Guide
System Time Manager
2-74 119728—SNMP Subagent Programmer’s Guide
Programming Tutorials
Global Declarations
The global declarations include definitions for several variables and a statement that
includes the file containing the access functions:
1. The MIB object (systemTimeString) and a variable (juliantime) passed by the Test
function to the Set function are declared.
2. The file containing the access functions, accessfc, is included.
Main Control Block
This logic calls the necessary management functions:
3. The management environment is initialized.
4. The MIB is registered.
5. An infinite loop for handling incoming SNMP requests is established.
6. When a request arrives, it is processed, using the access functions in accessfc.
7. If the connection between the subagent and the NonStop agent is lost, MIB object
management terminates.
8. All resources associated with communications with the NonStop agent are released
before the subagent stops.
Access Functions
The file named accessfc contains the logic for hosting SNMP requests. Like all access
functions, those encoded by this subagent have the following form:
access-function-name (void *ctxt,
void **indices,
void *attr_ref)
The first two parameters are values from the run-time library. The third parameter
returns a value to the run-time library. While you can assign these parameters any name
you want, this subagent uses the names GDMOC uses when it generates access
functions: ctxt, indices, and attr_ref. Refer to Section 4, “Writing Subagent Logic,” for
complete information on access functions.
9. These include files are needed by the C library functions and Guardian procedures
used in the access functions:
timeh Contains declarations for the C library functions used by the Get
function (time(), localtime(), and strftime())
talh Contains definitions of the condition codes used by Guardian
procedures
cextdecs Contains declarations that provide access to the Guardian procedures
used by the Test and Set access functions (COMPUTETIMESTAMP,
CONVERTTIMESTAMP, and SETSYSTEMCLOCK)