SNMP Manager Programmer's Guide
Programming Examples
SNMP Manager Programmer’s Guide–134249
2-22
Managers Supporting UDP and IPC
/* Reset the SNMP_HOST_INT_T structure */
host_int->version = 1; <--24
host_int->local_flag = REMOTE_HOSTNAME; /* Default is remote */
memset(host_int->host_name, NULL, sizeof(host_int->host_name));
memset(host_int->agent_name, NULL, sizeof(host_int->agent_name));
host_int->host_addr = 0;
memset((char *)&host_int->dest, NULL, sizeof(host_int->dest));
memset((char *)&host_int->from, NULL, sizeof(host_int->from));
host_int->file_num = -1; /* No open file */
host_int->err_num = 0; /* No error */
host_int->count_written = 0; /* No data written */
host_int->count_read = 0; /* No data read */
host_int->timeout = 500; /* 5 seconds */
val = check_host_name(in_name); <--25
switch (val)
{
case CK_REMOTE_NAME: /* 1 */
/* in_name is not defined in the Tandem network */
host = gethostbyname(in_name);
host_int->host_addr = *(u_long *)(host->h_addr);
goto return_remote;
case CK_LOCAL_NAME: /* 2 */
/* in_name or IP address matches the local in_name */
/* Real local host: use no hostname */
goto return_local;
case CK_REMOTE_NAME_NOBSL_EXPAND: /* 3 */
case CK_REMOTE_NAME_BSL_EXPAND: /* 4 */
/* An EXPAND system name with/without a '\' */
if (val == CK_REMOTE_NAME_NOBSL_EXPAND)
strcpy(host_int->host_name, "\\");
if (strlen(in_name) > MAXHOSTNAME)
return HOSTNAME_ERROR;
strcat(host_int->host_name, in_name);
goto return_local;
case CK_REMOTE_IP: /* 5 */
/* remote IP address and name is not defined in host file */
host_int->host_addr = inet_addr(in_name);
Example 2-2. Contents of snmpfsc (page 9 of 19)