snmpSaHandlerAsync( )

NAME

snmpSaHandlerAsync( ) - asynchronous message processing routine for the subagent

SYNOPSIS

void snmpSaHandlerAsync 
    ( 
    OCTET_T *            pMsg,       /* message from the master-agent */ 
    ALENGTH_T            msglength,  /* length of message in octets   */ 
    PTR_T                root,       /* root of mib tree              */ 
    SA_IO_COMPLETE_T *   pIoComp,    /* I/O completion routine         */ 
    SA_ERR_COMPLETE_T *  pErrComp,   /* error completion routine      */ 
    SA_REG_COMPLETE_T *  pRegComp,   /* registration complete routine */ 
    PTR_T                cookie      /* cookie                        */ 
    )

DESCRIPTION

It decodes the message in pMsg and responds appropriately, which can include testing, getting, and setting variables. After the message is processed, snmpSaHandlerAsync( ) then calls whichever completion routine is appropriate.

pMsg
Expects pointer to an octet string containing the message from the master agent.

msglength
Expects the length of the message.

root
Expects a pointer to the root of the subagent's MIB tree. If root is NULL, the default mib_root_node is used.

pIoComp
Expects a pointer to the function snmpSaHandlerAsync( ) should call after it has processed the message from the master agent. This routine should be able to send a response to the master agent, if necessary. This function must handle the building, encoding, transmission of the response to the master agent. This function must be of the form:

void SA_IO_COMPLETE_T(PTR_T pktp, SA_HEADER_T *hdr_blk, PTR_T cookie)
When the subagent calls this routine, it uses the pktp parameter to pass in a pointer to the data to be sent to the master agent. It uses the hdr_blk parameter to pass in a pointer to the header to be included with the packet. It uses the cookie parameter to pass in the cookie specified in the call to snmpSaHandlerAsync( ). You can use this cookie to carry information specific to your environment and application.

pErrComp
Expects a pointer to the function snmpSaHandlerAsync( ) should call if it cannot generate an appropriate response to a message from the master agent. This function must be of the form:

void SA_ERR_COMPLETE_T(int error_code, PTR_T cookie)
The error_code passes in one of the following error codes:

SA_GEN_ERROR
SA_UNKNOWN_VERSION
SA_UNKNOWN_OPCODE1
SA_UNKNOWN_OPCODE2
SA_UNKNOWN_ENCODING
SA_DECODE_FAILURE
SA_ENCODE_FAILURE
SA_UNKNOWN_NODE
SA_UNKNOWN_TAG
SA_UNKNOWN_GRP
SA_SHORT_MSG
SA_IPC_ERROR
SA_LOCK_ERROR
SA_NODE_ERROR
SA_MEMORY_ERROR
SA_UNSUPPORTED_TYPE
SA_NO_SAVED_PACKET

The cookie parameter passes in the cookie specified in the call to snmpSaHandlerAsync( ). You can use this cookie to carry information specific to your environment and application.

pRegComp
Expects a pointer to the function snmpSaHandlerAsync( ) should call in response to a registration completion message from the master agent. If successful, this message should contain a group ID for the MIB variables that the registration request added to the master agent's MIB tree. The subagent needs this ID when it comes time to deregister and remove those variables from the master agent's MIB tree. This function must be of the form:

void SA_REG_COMPLETE_T ( INT_32_T ecode, SA_HEADER_T *hdr_blk, 
                         VBL_T *vblp, PTR_T cookie )
This completion routine expects an error code in ecode, a header block in hdr_blk, a list of nodes at vblp, and the cookie passed into the snmpSaHandlerAsync( ).

cookie
Expects a pointer that you can use to pass data unchanged to the functions you specified in the pIoComp, pErrComp, and pRegComp functions.

RETURNS

N/A

SEE ALSO

subagentLib