SNMP Manager Programmer's Guide

Programming Examples
SNMP Manager Programmer’s Guide–134249
2-137
SNMPHOST Source Code
} /* while (bMoreEntries) */
if (nCurrDevIndex == 0) {
printf ("No Host MIB data found.\n");
printf ("Check to see if this host supports the host MIB.\n");
}
SNMP_Free(pkt); <--35
return nCurrDevIndex;
} /* GetHostDevices */
short
GetAuxDeviceTbl (SNMP_HOST_INT_T* host_int, <--36
DEV_ENTRY_T* pDevTableEntry, char* community,
short retrycnt, int requestid)
{
short err1;
char hrDiskStorageCapacity[] = "1.3.6.1.2.1.25.3.6.1.4"; <--37
char hrPrinterStatus[] = "1.3.6.1.2.1.25.3.5.1.1";
char hrProcessorLoad[] = "1.3.6.1.2.1.25.3.3.1.2";
short i;
SNMP_PKT_T *pkt1 = 0;
SNMP_PKT_T *recv_pkt1 = 0;
VB_T *vbp1 = 0;
/* Set up a Get request for 1 auxiliary table variable */
pkt1 = SNMP_Create_Request(GET_REQUEST_PDU, VERSION_RFC1067, <--38
strlen(community), community, (INT_32_T)requestid, 1);
switch (pDevTableEntry->nDeviceType) { <--39
case 3: /* processors */
SetCpuLoad (pDevTableEntry, 0);
base_oid.num_components = oidstring2oid (hrProcessorLoad, <--40
base_oid.component_list, MAX_OID_COUNT);
if (base_oid.num_components == 0) {
fprintf(stdout, "Bad object identifier: %s\n", hrProcessorLoad);
exit(0);
}
break;
Example 2-18. Contents of snmphosc (page 12 of 23)