SNMP Manager Programmer's Guide

Programming Examples
SNMP Manager Programmer’s Guide–134249
2-73
SNMPSET
short err2;
int firstid;
SNMP_HOST_INT_T host_int; /* host interface */
struct hostent *host3;
char *hostname;
int i;
u_long ipaddr;
int j;
int len;
int longform = 0;
int mibtype = 0;
int need;
int oidcnt;
char *oidstr[MAXOIDS];
short opt2;
struct namerec *p;
int peertype = 0; /* for both the ASN1 and PEER types */
SNMP_PKT_T *rcvd_pkt = 0;
int rcode;
int requestid = 1;
short retrycnt = 0;
SNMP_PKT_T *send_pkt = 0;
char *snmpagt = 0;
short timeout = 5;
char *typestr[MAXOIDS];
char *valstr[MAXOIDS];
char *whoami;
int dots = 0; /* to keep track of dots in IP address */
int byte; /* to hold the octet of IP address */
char *name;
char *ptr;
char id[20]; /* to hold part of IP address */
/* extract the command line arguments */
whoami = *argv++;
argc--;
while ((argc != 0) && (**argv == '-'))
{
opt = *(*argv + 1);
argv++,argc--;
if (argc == 0) /* reject incomplete command */
break;
switch (opt)
Example 2-9. Contents of snmpsetc (page 2 of 9)