snmpSaInit( )

NAME

snmpSaInit( ) - initialize the subagent

SYNOPSIS

PTR_T snmpSaInit 
    ( 
    PTR_T              saId,      /* ipchandle for socket/queue    */ 
    PTR_T              sa_root,   /* pointer to mib root node      */ 
    SA_REG_COMPLETE_T  saRegComp  /* registration complete routine */ 
    )

DESCRIPTION

Call this routine to initialize an SNMP subagent. Internally, this routine creates an IPC mechanism for receiving messages from the master agent and then spawns a task to run snmpSaMonitor( ), a function that monitors the IPC mechanism created by snmpSaInit( ). As input, snmpSaInit( ) takes the parameters: saId, sa_root, and saRegComp.

saId
Expects a null. In most functions in this library, an saId parameter is a pointer to the IPC mechanism used to pass messages to the subagent. However, the IPC mechanism is first created internally to this function. Thus, this saId parameter is not actually used for input nor is it an output parameter. It is included for parallelism with other functions in this library.

sa_root
This parameter provides a pointer to the MIB tree for this subagent.

saRegComp
Use this routine to pass in a pointer to the function that snmpSaHandlerAsync( ) should execute in response to a registration status message from the master agent. If the registration was successful, the response contains a group ID for the MIB variables registered with the master agent. You will need this group ID when it comes time to deregister this SNMP subagent, or when you need to register instances of the object just registered.

Although this function sets up the IPC mechanism and spawns the task that is effectively the SNMP subagent, this routine does not actually register the subagent with the master agent. The details of how and when one does that are entirely dependent upon the nature of the system you are designing. Thus, no generic registration utility is provided. For more information on sending a registration request to the master agent, see the description of hdrBlkBuild( ).

RETURNS

A pointer to the IPC mechanism created within this function, or NULL on failure.

SEE ALSO

saIoLib