eSNMP API Routines
esnmp_init
esnmp_init
Initializes the Extensible SNMP (eSNMP) subagent and initiates communication
with the master agent.
Format
int esnmp_init (int *socket,
char *subagent_identifier ) ;
Arguments
socket
The address of the integer that receives the socket descriptor used by eSNMP.
subagent_identifier
The address of a null-terminated string that uniquely identifies this subagent
(usually a program name).
Description
Call this routine during program initialization or to restart the eSNMP protocol.
If you are restarting, the
esnmp_init
routine clears all registrations so each
subtree must be registered again.
You should attempt to create a unique subagent identifier, perhaps using the
program name
argv[0]
and additional descriptive text. The master agent does
not open communications with a subagent whose subagent identifier is already in
use.
This routine does not block waiting for a response from the master agent. After
calling the
esnmp_init
routine, call the
esnmp_register
routine for each subtree
that is to be handled by the subagent.
Return Values
ESNMP_LIB_NO_
CONNECTION
Could not initialize or communicate with the
master agent. Try again after a delay.
ESNMP_LIB_OK
The
esnmp_init
routine has completed
successfully.
ESNMP_LIB_NOTOK
Could not allocate memory for the subagent.
Example
#include <esnmp_h>
int socket;
status = esnmp_init(&socket, "gated");
5–2 eSNMP API Routines