snmpSaHandlerWR( )

NAME

snmpSaHandlerWR( ) - provide snmpSaHandlerAsync( ) functionality synchronously

SYNOPSIS

INT_32_T snmpSaHandlerWR 
    ( 
    OCTET_T *      pMsg,     /* message from the master-agent */ 
    ALENGTH_T      msgl,     /* kength of message in octets   */ 
    EBUFFER_T *    pBuf,     /* buffer to hold reply packet   */ 
    SA_HEADER_T *  pHdr,     /* place for header structure    */ 
    VBL_T *        pVblist,  /* place for vblist              */ 
    PTR_T          root      /* root of mib tree              */ 
    )

DESCRIPTION

This routine puts a synchronous shell around snmpSaHandlerAsync( ). Like snmpSaHandlerAsync( ), this function can decode a message from the master agent. If the message is a query against a variable in the subagent's MIB tree, snmpSaHandlerWR( ) processes the request and generates a response. However, snmpSaHandlerWR( ) does not handle the completion processing for the message that would have been handled by the pIoComp, pErrComp, and pRegComp routines specified as input to snmpSaHandlerAsync( ).

Instead, it uses its returned function value to indicate that status of the message processing and uses pBuf, pHdr, and pVblist as output parameters if that status requires additional processing on your part. For example, if the message was a successfully processed query, the response data is included in pVblist and a header is included in pHdr, but that response is not yet encoded in a packet or transmitted back to the master agent. In snmpSaHandlerAsyn( ), all that would normally be handled in the pIoComp routine. Effectively, you must now call your pIoComp routine explicitly.

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

msgl
Expects the length of the message starting at pMsg.

pBuf
Expects a pointer to a previously allocate EBUFFER_T into which this function can write a response, if any. In some cases (if opcode1 is SA_QUERY_REQUEST), instead of indicating an error in the returned value of snmpSaHandlerWR( ), the error is encoded into this message. This is done for errors more appropriately handled by the SNMP manager.

pHdr
Expects a pointer to a previously allocated SA_HEADER_T structure into which this function can writer header block information, if necessary. If hdr_blk.sa_error is non-zero, other members might not contain valid data.

pVblist
Expects a pointer to a previously allocated VBL_T structure into which this function can write the list of nodes found in the original message from the master agent.

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

RETURNS

0 on success, or a positive value indicating an error. For return code values, see subagent.h. Using these values as a switch, you should call one of the functions you would have specified for pIoComp, pErrComp, or pRegComp in a call to snmpSaHandlerAsync( ).

SEE ALSO

subagentLib