SNMP Subagent Programmer's Guide

Management Functions
4-20 119728—SNMP Subagent Programmer’s Guide
Writing Subagent Logic
successive colons. The total manager station community string can contain 0
through 255 bytes.
address
is a pointer to a 4-byte buffer in which the NonStop agent stores the IP address of
the manager station from which the request has been received. If an error occurs,
the IP address is set to 0.0.0.0.
Entry Condition
The value of mgmt-env must be valid.
Errors
If an error occurs, the NonStop agent sets the IP address to 0.0.0.0 and the community
string to NULL. One of the following integers, defined in mgmtpubh, is returned in
status. Positive values indicate programming problems; negative values indicate
protocol problems.
Example
The following example is taken from the Security Checker subagent. This subagent uses
several global variables to handle authentication; the first four are used for values
returned by mgmt_security(), and the next two are used by an authentication function
and access functions provided by the subagent:
short status;
static char communitytext[256];
static OCTETSTRING community = {0, (ubyte *) communitytext};
static NetworkAddress hostaddr;
static char password[256];
short authenticated;
-1 MGMT_SECURITY_NOTNTPDU The manager station community string
and IP address do not appear in the
request PDU.
-2 MGMT_SECURITY_BADPDU The PDU received is corrupted.
21 MGMT_SECURITY_BADLEN community does not point to a 256-byte
buffer or address does not point to a 4-
byte buffer.
22 MGMT_SECURITY_BADADDR The address of community or address is
invalid.