SNMP Manager Programmer's Guide
Programming Examples
SNMP Manager Programmer’s Guide–134249
2-123
SNMPHOST Source Code
11. The function SetCpuLoad() saves the value of hrProcessorLoad in the
auxInfo.nCpuLoad field of a DEV_ENTRY_T structure for subsequent printing.
The next function, GetCpuLoad() returns the value saved previously.
12. The function SetPrinterStatus() saves the value of hrPrinterStatus in the
auxInfo.nPrinterStatus field of a DEV_ENTRY_T structure for subsequent printing.
The next function, GetPrinterStatus() returns the value saved previously.
13. The function SetDiskCapacity() saves the value of hrDiskStorageCapacity in the
auxInfo.nDiskCapacity field of a DEV_ENTRY_T structure for subsequent printing.
The next function, GetDiskCapacity() returns the value saved previously.
14. GetHostDevices() retrieves device information and stores it in DEV_ENTRY_T
structures. It accepts a pointer to the host interface structure
(SNMP_HOST_INT_T) defined in snmpfsh, pptable, the number of devices for
which information is desired, and invocation argument values for community name,
retry count, and request ID. It returns an integer indicating how many structures of
type DEV_ENTRY_T contain device information to display.
15. Interesting local variables are:
16. A GetNext packet for four hrDeviceTable objects is initialized.
17. The oidstring2oid() function returns the number of components in the OID of
hrDeviceIndex, initialized earlier, and converts the string value of the hrDeviceIndex
OID to an array of longs in base_component_list.
18. The OID of hrDeviceIndex is saved in devIndexObj, then bound to the packet using
a call to SNMP_Bind_Null(). Note that no entry index value exists at this point, so
when the request is processed, an entry index value of 0 is presumed. In this fashion
the GetNext request is able to retrieve the first value of hrDeviceIndex, which is
always greater than 0.
bMoreEntries A flag that governs how many times the loop that creates
request packets gets executed
devIndexObj The instance identifier of the current hrDeviceIndex
hrDeviceDescr[]
hrDeviceIndex[]
hrDeviceStatus[]
hrDeviceType[]
OIDs for the four hrDeviceTable objects retrieved
nCurrDevIndex An index into pptable
objp A pointer to a structure describing an OID
pCurrOutputEntry A pointer to the current DEV_ENTRY_T structure
pkt A pointer to the packet containing a GetNext PDU
recv_pkt A pointer to the packet containing a Response PDU
vbIndex An index into the list of variable bindings
vbp A pointer to a structure that defines a variable binding