public interface SnmpHandler
The SnmpHandler interface is implemented by an object that wishs to receive callbacks when a SNMP protocol data unit is received from an agent. In addition, if an internal error occurs or an agent fails to respond then the object must handle those error conditions.
For error conditions the pdu is recast to an SnmpSyntax object. This is mainly due to the fact that the SnmpPduTrap is not derived from SnmpPduPacket. Implementations of the handler class can use instanceof to determine the type of PDU involved in the error.
Modifier and Type | Method and Description |
---|---|
void |
snmpInternalError(SnmpSession session,
int err,
SnmpSyntax pdu)
This method is invoked when an internal error occurs
for the session.
|
void |
snmpReceivedPdu(SnmpSession session,
int command,
SnmpPduPacket pdu)
This method is invoked when a pdu is successfully
returned from the peer agent.
|
void |
snmpTimeoutError(SnmpSession session,
SnmpSyntax pdu)
This method is invoked when an agent fails to respond
in the required time.
|
void snmpReceivedPdu(SnmpSession session, int command, SnmpPduPacket pdu)
This method is invoked when a pdu is successfully returned from the peer agent. The command argument is recovered from the received pdu.
session
- The SNMP sessioncommand
- The PDU commandpdu
- The SNMP pduvoid snmpInternalError(SnmpSession session, int err, SnmpSyntax pdu)
This method is invoked when an internal error occurs for the session. To determine the exact error the err parameter should be compared with all the error conditions defined in the SnmpSession class.
session
- The SNMP session in questionerr
- The error that occuredpdu
- The PDU object that caused the errorvoid snmpTimeoutError(SnmpSession session, SnmpSyntax pdu)
This method is invoked when an agent fails to respond in the required time. This method will only be invoked if the total retries exceed the number defined by the session.
session
- The SNMP Sessionpdu
- The PDU object that timed outGenerated by iurt on 2015.