Interface SnmpHandler

  • All Known Implementing Classes:
    JoeSnmpWalker.JoeSnmpResponseHandler, SnmpResponseHandler

    public interface SnmpHandler

    The SnmpHandler interface is implemented by an object that wishes 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.

    Author:
    Brian Weaver , OpenNMS
    • Method Detail

      • snmpReceivedPdu

        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.

        Parameters:
        session - The SNMP session
        command - The PDU command
        pdu - The SNMP pdu
      • snmpInternalError

        void 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.

        Parameters:
        session - The SNMP session in question
        err - The error that occured
        pdu - The PDU object that caused the error
      • snmpTimeoutError

        void 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.

        Parameters:
        session - The SNMP Session
        pdu - The PDU object that timed out