SNMP Subagent Programmer's Guide
Nowaited Hello World Program
2-20 119728—SNMP Subagent Programmer’s Guide
Programming Tutorials
The mgmt_read_nowait() management function is used in conjunction with other
function and procedure calls as follows:
1. The mgmt_init_env() function establishes communication with the NonStop agent.
2. The mgmt_new_instance() function initiates management of MIB objects.
3. The mgmt_read_nowait() function sets up a nowaited read from the NonStop
agent.
4. The AWA IT I O X procedure determines whether any external message or file is
ready to process.
5. The FILE_GETINFO_ procedure obtains information about incomplete I/O
operations. If a timeout has occurred, the current value of helloOutputText is
printed.
6. When AWAITIOX indicates that an I/O operation is complete, the mgmt_poll()
function is called if a message was received from the NonStop agent.
7. When an SNMP message requests a Set operation on helloPrintFreq, mgmt_trap()
generates a trap.
8. If connection with the NonStop agent is lost, mgmt_del_instance() de-registers,
from the run-time library, previously registered MIB objects.
9. The mgmt_term_env() function terminates connection with the NonStop agent.
Source Code
The Nowaited Hello World source code is shown in Example 2-3. Numbers in the
example correspond to comments in the discussions located between here and the
example.
Global Declarations
This subagent has several global declarations not needed by Hello World:
1. The header file named mgmtenvH defines the structures needed for a message buffer
to hold a message from the NonStop agent. The header file named snmpvblh
contains the define (SNMP_MSG_MAX) used later when memory for a buffer is
allocated.
2. The header file named talh lets the subagent read the contents of cextdecs, necessary
for the calls to AWAITIOX and FILE_GETINFO_. Both these files are C library
header files.