SNMP Manager Programmer's Guide

Sending and Receiving Packets
SNMP Manager Programmer’s Guide134249
7-2
Establishing Communication
Establishing Communication
The FILE_OPEN_() system call, made from the SNMP_Open_() function defined in
snmpfsc, establishes a communication path between the manager and NonStop agent
processes. In preparation for this call, the NonStop agent process name is assigned to
the variable named temp_file_name. The NonStop agent process name is a
concatenation of three values: the Expand name for the target system, including the
backslash; the target agent process name, including the $; and the string.#MGR. The
first two values are passed in through the host_int structure (defined in snmpfsh). The
.#MGR value is a constant that must be appended to all NonStop agent process names:
short SNMP_Open_ (SNMP_HOST_INT_T *host_int,
unsigned short debug_flag)
{
char temp_file_name[28];
...
memset(temp_file_name, NULL, sizeof(temp_file_name));
/* Check for an empty host_name */
if (strlen(host_int->host_name) != 0)
{
strcpy(temp_file_name, host_int->host_name);
strcat(temp_file_name, ".");
}
strcat(temp_file_name, host_int->agent_name);
strcat(temp_file_name, ".#MGR");
FILE_OPEN_() establishes a nowaited connection with the NonStop agent:
host_int->err_num = FILE_OPEN_ (temp_file_name,
(short)strlen(temp_file_name),
&host_int->file_num,,, 1);
The FILE_OPEN_() call contains four arguments:
The NonStop agent process name.
The number of bytes in the name.
The location to which to return a file number that identifies the connection for
subsequent system calls.
A nowait depth value of 1, indicating that only one nowait I/O operation can be in
progress using this connection at any time. Any value other than 0 is used to set up
nowaited I/O operations.