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 */ )
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.