SNMP Subagent Programmer's Guide

Programming Tutorials
SNMP Subagent Programmer’s Guide119728 2-21
Nowaited Hello World Program
Main Control Block
This code manages the MIB objects and calls the management functions and Guardian
procedures:
3. These variables are needed for nowait processing of messages from the NonStop
agent:
4. A buffer is allocated for any message received from the NonStop agent. This
statement associates the buffer with the pointer (mgmt_env) returned from the
earlier call to mgmt_init_env().
5. The mgmt_read_nowait() function initiates a nowait operation with the NonStop
agent. It returns a file number in agent_fileno to identify the NonStop agent
connection. If the file number is -1, the call failed and the while loop terminates;
otherwise, the block named “wait” is executed.
6. The wait block detects when SNMP messages are available, then processes them.
7. The AWAITIOX procedure detects when an I/O operation has been completed.
Then it identifies the file used and describes the success of the operation. The
following parameters are used in this call:
agent_fileno The file number identifying a connection with the NonStop agent,
returned by mgmt_read_nowait()
event_fileno The file number returned by AWAITIOX, identifying the file on
which an I/O operation completed
status The condition code returned by AWAITIOX, describing the results
of the call
error The error number returned by FILE_GETINFO_, describing the
outcome of the operation
status A description of the outcome of the call. A value of CCE
indicates than an I/O operation completed without error.
event_fileno The input value is set to -1 in the previous statement, to
indicate that the call applies to any file rather than to a
specific file. The procedure sets the value to a file number
when I/O is completed. The file number identifies a
particular I/O operation.
count_xferd An output value indicating the number of bytes transferred
during the I/O operation.
100*helloPrintFreq The maximum amount of time the subagent will wait for I/
O completion, in centiseconds. This subagent sets this
value to 100 times the value of helloPrintFreq: initially 15
seconds. A timeout occurs when the specified amount of
time has elapsed and no I/O operation has completed. The
timeout is detected by the subsequent call to
FILE_GETINFO_.