SNMP Subagent Programmer's Guide
Writing Subagent Logic
SNMP Subagent Programmer’s Guide—119728 4-19
Management Functions
mgmt_security()
The mgmt_security() function makes the community string and IP address of a manager
station from which a request is received available to subagents. Based on the values of
these objects, a subagent can determine whether to process the request.
The mgmt_security() function can be used with either waited or nowaited request
processing, When doing nowaited request processing, call mgmt_security() after
AWAITIO[X] completes; you can call mgmt_security() from a callback function, which
the run-time library invokes when you call mgmt_poll(), or you can call it before calling
mgmt_poll(). When doing waited request processing, you must call mgmt_security()
from a callback function. Whenever you call mgmt_security() from a callback function,
ensure that mgmt-env is a global structure.
The first time mgmt_security executes, the NonStop agent returns a registration
acknowledgment, but subsequent executions return the community string and IP address.
status
is an integer describing the outcome of the call. A value of 0
(MGMT_SECURITY_OK) indicates that the community string and address have
been successfully retrieved. Any other value indicates an error occurred.
mgmt-env
is the void pointer returned by an earlier call to mgmt_init_env().
community
is a pointer to an OCTETSTRING structure, which must have a value pointer set to
a 256-byte buffer. The NonStop agent places the community string into the buffer,
formatting it as follows:
agent-community-string[::subagent-password]
The mgmt_security() function sets the length of the structure, and null terminates
the community string value. If an error occurs, the community string is set to
NULL.
The agent community string must appear in one of the NonStop agent’s
authentication table entries. The agent community string, a double colon, and the
subagent password must appear in the manager station’s configuration. The agent
community string can contain from 0 to 50 printable bytes, and cannot contain
#include "mgmtpubh"
status = mgmt_security(mgmt-env, community, address);
short
mgmt_security (mgmt-env, community, address);
void *mgmt-env;
OCTETSTRING *community;
NetworkAddress *address;