SNMP Manager Programmer's Guide
Programming Examples
SNMP Manager Programmer’s Guide–134249
2-90
SNMPWALK
 if (snmpagt != 0)
 {
  strcpy(host_int.agent_name, snmpagt);
 }
 if (dest_port != SNMP_REQUEST_PORT)
 {
  host_int.dest.sin_port = htons(dest_port);
 }
 if (timeout != 5)
 {
  host_int.timeout = timeout * 100;
 }
 err2 = SNMP_Open_(&host_int, debug_level); <--6
 if (err2 != 0)
 {
  fprintf(stdout, "SNMP_OPEN_ returned error %i.\n", err2);
  exit(0); 
 }
 send_pkt = SNMP_Create_Request(GET_NEXT_REQUEST_PDU, VERSION_RFC1067, <--7
     strlen(community), community, (INT_32_T)requestid, 1);
 SNMP_Bind_Null(send_pkt, /*index to set */ 0, <--8
     base_oid.num_components, base_oid.component_list);
 /* Obtain buffer space for the packet */
 need = 2000;
 if ((buffp = (char *)SNMP_memory_alloc(need)) == 0)
  return (-1);
 EBufferSetup(BFL_IS_DYNAMIC, &ebuff, buffp, need);
 /* Send request and receive response */
 for (pktnum=1; pktnum <= distance; pktnum++) <--9
 {
  for (j = 0; j <= retrycnt; j++)
  {
   if (j == 0)
  {
    firstid = requestid;
  } else
  {
   fprintf(stdout, "\n---RESENDING PACKET---\n");
   /*
   * PDU request ID is reset to 1 by setting
   * requestid to 0 and then incrementing it
   */
Example 2-11. Contents of snmpwlkc (page 5 of 7)










