SNMP Subagent Programmer's Guide
Management Functions
4-22 119728—SNMP Subagent Programmer’s Guide
Writing Subagent Logic
mgmt_term_env()
The mgmt_term_env() function terminates communication with the NonStop agent,
releasing resources and deregistering objects still registered. Another subagent
communicating with the agent can now register the objects.
mgmt-env
is a void pointer returned from an earlier call to mgmt_init_env(). After this
function completes, mgmt-env is no longer usable, although it is not changed to
NULL.
Entry Conditions
The value of mgmt-env must not be NULL.
Exit Condition
The mgmt_term_env() function does not change the value of mgmt_env, but a run-time
error occurs if this argument is used again without issuing a mgmt_init_env() call first.
Example
The following example is taken from the Hello World sample program. If the program
encounters an unrecoverable condition, it calls mgmt_term_env() to terminate
management of objects registered earlier and to terminate the communication it set up
earlier with a call to mgmt_init_env().
if ((mgmt_env = mgmt_init_env(argv[1],
(ObjId_t *) &GI_hello
"Hello World Example",
(Octets_t *)NULL,
(void_function) NULL))==NULL)
...
if (mgmt_env)
{
if (mgmt_hello_handle)
{
mgmt_del_instance(mgmt_env, mgmt_hello_handle);
mgmt_hello_handle = NULL;
}
mgmt_term_env (mgmt_env);
mgmt_env = NULL;
}
return (0);
#include "mgmtpubh"
mgmt_term_env(mgmt-env);
void
mgmt_term_env (mgmt-env);
void *mgmt-env;