Interface SnmpTrapHandler

  • All Known Implementing Classes:
    JoeSnmpTrapNotifier

    public interface SnmpTrapHandler

    The SnmpTrapHandler interface is implemented by an object that wishs to receive callbacks when a SNMP trap protocol data unit is received from an agent.

    Version:
    1.1.1.1 2001/11/11 17:27:22
    Author:
    OpenNMS , Brian Weaver
    • Method Detail

      • snmpReceivedTrap

        void snmpReceivedTrap​(SnmpTrapSession session,
                              java.net.InetAddress agent,
                              int port,
                              SnmpOctetString community,
                              SnmpPduPacket pdu)

        This method is defined to handle SNMPv2 traps that are received by the session. The parameters allow teh handler to determine the host, port, and community string of the received PDU

        Parameters:
        session - The SNMP session
        agent - The remote sender
        port - The remote senders port
        community - The community string
        pdu - The SNMP pdu
      • snmpReceivedTrap

        void snmpReceivedTrap​(SnmpTrapSession session,
                              java.net.InetAddress agent,
                              int port,
                              SnmpOctetString community,
                              SnmpPduTrap pdu)

        This method is define to handle SNMPv1 traps that are received by the session. The parameters allow the handler to determine the host, port, and community string of the received PDU.

        Parameters:
        session - The SNMP session
        agent - The Trap sender
        port - The port of the sender
        community - The community string
        pdu - The SNMP trap pdu
      • snmpTrapSessionError

        void snmpTrapSessionError​(SnmpTrapSession session,
                                  int error,
                                  java.lang.Object ref)

        This method is invoked if an error occurs in the trap session. The error code that represents the failure will be passed in the second parameter, 'error'. The error codes can be found in the class SnmpTrapSession class.

        If a particular PDU is part of the error condition it will be passed in the third parameter, 'pdu'. The pdu will be of the type SnmpPduRequest or SnmpPduTrap object. The handler should use the "instanceof" operator to determine which type the object is. Also, the object may be null if the error condition is not associated with a particular PDU.

        Parameters:
        session - The SNMP Trap Session
        error - The error condition value.
        ref - The PDU reference, or potentially null. It may also be an exception.