SNMP Manager Programmer's Guide
Programming Examples
SNMP Manager Programmer’s Guide–134249
2-16
Managers Supporting UDP and IPC
#pragma page
/***************************************************************************
NAME: check_host_name
PURPOSE: Validate hostname parameter
PARAMETERS: CHAR * Hostname string (hname)
RETURNS: defined value (1-6) for each type of host parameter
****************************************************************************/
short check_host_name (char *hname) <--7
{
short err3;
unsigned long host_addr1;
struct hostent *host;
struct hostent *host1;
long sysnum1;
long sysnum2;
char *t2;
char t3[MAXNAMEBUF];
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 */
/* Get the local system number */
NODENAME_TO_NODENUMBER_ (,, &sysnum1); <--8
if ((strlen(hname)) > MAXNAMEBUF)
{
fprintf(stdout, "%s is too long \n", hname);
return NAME_TOO_LONG;
}
Example 2-2. Contents of snmpfsc (page 3 of 19)