void masterIpcComp ( OCTET_T opcode, /* this specifies what needs to be done */ EBUFFER_T * pBuf, /* reply message to be sent */ VBL_T * pVblist, /* list of varbinds that the message contained */ PTR_T ipchandle /* subagent address */ )
If the SNMP master agent uses snmpMasterHandlerAsync( ) to process a subagent's unsolicited control message (such as a registration request), it uses masterIpcComp( ) to complete processing for the message. In the current implementation, this means telling the subagent the completion status of a registration or deregistration request. However, you can rewrite this function to implement a broader range of responses (such as forwarding traps to the SNMP manager).
When the master agent calls this routine, it uses opcode to indicate the processing status of the message. If the status indicates an error, masterIpcComp( ) drops the packet. If the status indicates success, the master agent uses the pBuf parameter to pass in a message for the subagent at ipchandle. Internally, masterIpcComp( ) calls masterIoWrite( ) to forward the message to the specified subagent. If this message is the response to a successful registration request, it contains the group ID for the MIB variables just added to the master agent's MIB tree. The subagent needs this group ID for any deregistration request it might send later. It also uses this ID to register instances of the object just registered.
If the opcode is a value of 1 or greater (up to and including 127), the master agent uses the pVblist parameter to pass in a varbind list that it extracted from the control message. In the current implementation, the masterIpcComp( ) routine does nothing with the message and returns. However, you could modify masterIpcComp( ) to process the message according to the value specified by opcode. For example, if opcode indicates a trap, you could forward the information at pVblist to the SNMP manager.
Currently, subagent.h defines symbolic constants for opcodes 1 through 12 (with opcode 11, SA_TRAP_REQUEST, reserved for trap requests). You are free to use the remaining opcodes for message types specific to your implementation.