SNMP Manager Programmer's Guide
Programming Examples
SNMP Manager Programmer’s Guide–134249
2-11
Managers Supporting UDP and IPC
22. The SNMP_FS_ErrMsg_() function accepts error numbers returned by the other
functions in snmpfsc and returns a character pointer to a buffer containing an
explanation of the failure. The value of defines associated with err_num is used to
determine which message to return. The value of det_err_num, if any, is embedded
in the returned message where appropriate.
23. The SNMP_Init_() function determines whether to use UDP or IPC
communication. It accepts a pointer to SNMP_HOST_INT_T, the size of this
structure, and the device name or IP address with which communication is to be
established. It returns 1 (defined as LOCAL_HOSTNAME) for IPC communication
or 0 (defined as REMOTE_HOSTNAME) for UDP communication.
24. The fields in SNMP_HOST_INT_T are initialized.
25. The check_host_name() function is called. The returned value determines further
processing:
If CK_REMOTE_NAME or CK_REMOTE_IP is returned, information needed
for UDP communication is initialized.
If CK_LOCAL_NAME, CK_REMOTE_NAME_NOBSL_EXPAND,
CK_REMOTE_NAME_BSL_EXPAND, or CK_REMOTE_IP_EXPAND is
returned, information needed for IPC communication is initialized. Information
needed for UDP communication is also initialized so it is available if IPC
communication cannot be established.
26. The return_remote block assigns socket information to the three fields in the
destination sockaddr_in structure in SNMP_HOST_INT_T: sin_family, sin_port,
and sin_addr.
27. The return_local block makes similar assignments for use if IPC communication
fails, and assigns the default agent process name, $ZSNMP, to agent_name.
28. The SNMP_Open_() function obtains a socket for UDP communication or opens a
file for communication with a NonStop agent process using IPC communication. It
accepts a pointer to SNMP_HOST_INT_T and an integer describing the kind of
output messages to generate. It returns an integer describing the outcome of its
operations.
29. A TCP/IP socket_nw() call creates a socket for nowaited UDP communication.
30. For IPC communication, the name of a NonStop agent process, with a suffix of
.#MGR, is concatenated to the name of the target host.
31. A file is opened for communication with the agent. If the FILE_OPEN_() call fails,
an attempt to establish communication using sockets is made.
Note. For IPC communication, the NonStop agent process name must be appended with
the string .#MGR.