SNMP Manager Programmer's Guide

Programming Examples
SNMP Manager Programmer’s Guide–134249
2-133
SNMPHOST Source Code
if (base_oid.num_components == 0) {
fprintf(stdout, "Bad object identifier: %s\n", hrDeviceStatus);
exit(0);
}
SNMP_Bind_Null(pkt, vbIndex++,
base_oid.num_components,
base_oid.component_list);
/* start of the loop getting the device info */
nCurrDevIndex = 0;
bMoreEntries = 1;
while (bMoreEntries) <--22
{
/* Send request and receive response */
for (i = 0; i <= retrycnt; i++) <--23
{
if (i == 0)
{
firstid = requestid;
} else
{
fprintf(stdout, "\n---RESENDING PACKET---\n");
/* resetting request ID */
/*
* PDU request ID is reset to 1 by setting
* requestid to 0 and then incrementing it
*/
if (requestid == MAX_REQID_VALUE)
requestid = 0;
pkt->pdu.std_pdu.request_id = ++requestid;
}
/* Send packet and receive response */
err1 = SNMP_WriteRead_ (host_int, pkt, &recv_pkt, &ebuff,
debug_level);
if (err1 != 0)
Example 2-18. Contents of snmphosc (page 8 of 23)