SNMP Manager Programmer's Guide

Programming Examples
SNMP Manager Programmer’s Guide–134249
2-118
SNMPHOST Header File
SNMPHOST Header File
Example 2-17 shows the contents of snmphosh. Numbers in the example correspond to
numbers in the observations made between here and the example.
1. This structure holds information for each device for which information is retrieved:
2. NUM_DEV_ENTRIES is a define for the default number of devices for which to
retrieve information.
3. These functions construct, parse, and format information in request and response
packets:
nDeviceIndex The value of hrDeviceIndex for the device
nDeviceType The final digit of the hrDeviceType value:
3 (for processors)
5 (for printers)
6 (for disks)
nDevDescrLen The number of bytes in hrDeviceDescr minus the terminating
null byte
pDevDescr The value of hrDeviceDescr padded with a null byte
nDeviceStatus The value of hrDeviceStatus
nCpuLoad The value of hrProcessorLoad if the device is a processor
nPrinterStatus The value of hrPrinterStatus if the device is a printer
nDiskCapacity The value of hrDiskStorageCapacity if the device is a disk
GetHostDevices() Retrieves information from the hrDeviceTable
GetAuxDeviceTbl() Retrieves information from the hrProcessorTable, the
hrPrinterTable, and the hrDiskStorageTable
DisplayHostDevices() Prints information for each device
InitDevTable() Allocates memory for an array of pointers to memory for
structures of type DEV_ENTRY_T
AllocateDevEntry() Allocates memory for structures of type
DEV_ENTRY_T
SetCpuLoad() Writes the value of hrProcessorLoad to a structure of
type DEV_ENTRY_T
SetPrinterStatus() Writes the value of hrPrinterStatus to a structure of type
DEV_ENTRY_T
SetDiskCapacity() Writes the value of hrDiskStorageCapacity to a structure
of type DEV_ENTRY_T
GetCpuLoad() Retrieves the value of hrProcessorLoad from a structure
of type DEV_ENTRY_T