SNMP Manager Programmer's Guide
Programming Examples
SNMP Manager Programmer’s Guide–134249
2-138
SNMPHOST Source Code
case 5: /* printers */
SetPrinterStatus (pDevTableEntry, 0);
base_oid.num_components = oidstring2oid (hrPrinterStatus,
base_oid.component_list, MAX_OID_COUNT);
if (base_oid.num_components == 0) {
fprintf(stdout, "Bad object identifier: %s\n", hrPrinterStatus);
exit(0);
}
break;
case 6: /* disks */
SetDiskCapacity (pDevTableEntry, 0);
base_oid.num_components = oidstring2oid (hrDiskStorageCapacity,
base_oid.component_list, MAX_OID_COUNT);
if (base_oid.num_components == 0) {
fprintf(stdout, "Bad object identifier: %s\n",
hrDiskStorageCapacity);
exit(0);
}
break;
default:
return (0); /* not a device we're interested in */
break;
} /* switch */
/* add one OID digit for the table index */ <--41
base_oid.component_list[base_oid.num_components++] =
pDevTableEntry->nDeviceIndex;
SNMP_Bind_Null(pkt1, 0 /* index 0 */, <--42
base_oid.num_components,
base_oid.component_list);
Example 2-18. Contents of snmphosc (page 13 of 23)