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.
Modifier and Type | Method and Description |
---|---|
void |
snmpReceivedTrap(SnmpTrapSession session,
InetAddress agent,
int port,
SnmpOctetString community,
SnmpPduPacket pdu)
This method is defined to handle SNMPv2 traps that are received by the
session.
|
void |
snmpReceivedTrap(SnmpTrapSession session,
InetAddress agent,
int port,
SnmpOctetString community,
SnmpPduTrap pdu)
This method is define to handle SNMPv1 traps that are received by the
session.
|
void |
snmpTrapSessionError(SnmpTrapSession session,
int error,
Object ref)
This method is invoked if an error occurs in the trap session.
|
void snmpReceivedTrap(SnmpTrapSession session, 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
session
- The SNMP sessionagent
- The remote senderport
- The remote senders portcommunity
- The community stringpdu
- The SNMP pduvoid snmpReceivedTrap(SnmpTrapSession session, 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.
session
- The SNMP sessionagent
- The Trap senderport
- The port of the sendercommunity
- The community stringpdu
- The SNMP trap pduvoid snmpTrapSessionError(SnmpTrapSession session, int error, 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.
session
- The SNMP Trap Sessionerror
- The error condition value.ref
- The PDU reference, or potentially null. It may also be an
exception.Copyright © 2021. All rights reserved.