Package org.opennms.netmgt.snmp.snmp4j
Class Snmp4JTrapNotifier.Snmp4JV2V3TrapInformation
- java.lang.Object
-
- org.opennms.netmgt.snmp.TrapInformation
-
- org.opennms.netmgt.snmp.snmp4j.Snmp4JTrapNotifier.Snmp4JV2V3TrapInformation
-
- Enclosing class:
- Snmp4JTrapNotifier
public static class Snmp4JTrapNotifier.Snmp4JV2V3TrapInformation extends TrapInformation
-
-
Constructor Summary
Constructors Constructor Description Snmp4JV2V3TrapInformation(java.net.InetAddress agent, java.lang.String community, org.snmp4j.PDU pdu)
Constructs a new trap information instance that contains the sending agent, the community string, and the Protocol Data Unit.Snmp4JV2V3TrapInformation(java.net.InetAddress agent, java.lang.String community, org.snmp4j.PDU pdu, int version)
Constructs a new trap information instance that contains the sending agent, the community string, and the Protocol Data Unit.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.snmp4j.PDU
getPdu()
Returns the Protocol Data Unit that was encapsulated within the SNMP Trap messageint
getPduLength()
protected java.lang.Integer
getRequestId()
SnmpVarBindDTO
getSnmpVarBindDTO(int i)
long
getTimeStamp()
Get the SNMP TimeTicks value for the sysUpTime of the agent that generated the trap.java.net.InetAddress
getTrapAddress()
For SNMPv2 traps, this returns the same value asTrapInformation.getAgentAddress()
.TrapIdentity
getTrapIdentity()
protected org.snmp4j.smi.VariableBinding
getVarBindAt(int index)
java.lang.String
getVersion()
java.lang.String
toString()
void
validate()
Validate the trap.-
Methods inherited from class org.opennms.netmgt.snmp.TrapInformation
getAgentAddress, getCommunity, getCreationTime, getLocation, getSystemId, setCreationTime, setLocation, setSystemId
-
-
-
-
Constructor Detail
-
Snmp4JV2V3TrapInformation
public Snmp4JV2V3TrapInformation(java.net.InetAddress agent, java.lang.String community, org.snmp4j.PDU pdu)
Constructs a new trap information instance that contains the sending agent, the community string, and the Protocol Data Unit.- Parameters:
agent
- The sending agent's addresscommunity
- The community string from the SNMP packet.pdu
- The encapsulated Protocol Data Unit.
-
Snmp4JV2V3TrapInformation
public Snmp4JV2V3TrapInformation(java.net.InetAddress agent, java.lang.String community, org.snmp4j.PDU pdu, int version)
Constructs a new trap information instance that contains the sending agent, the community string, and the Protocol Data Unit.- Parameters:
agent
- The sending agent's addresscommunity
- The community string from the SNMP packet.pdu
- The encapsulated Protocol Data Unit.version
- The SNMP version, 2 or 3
-
-
Method Detail
-
getPdu
public org.snmp4j.PDU getPdu()
Returns the Protocol Data Unit that was encapsulated within the SNMP Trap message
-
getPduLength
public int getPduLength()
- Specified by:
getPduLength
in classTrapInformation
-
getTimeStamp
public long getTimeStamp()
Description copied from class:TrapInformation
Get the SNMP TimeTicks value for the sysUpTime of the agent that generated the trap. Note that the units for this value are 1/100ths of a second instead of milliseconds.- Specified by:
getTimeStamp
in classTrapInformation
-
getTrapIdentity
public TrapIdentity getTrapIdentity()
- Specified by:
getTrapIdentity
in classTrapInformation
-
getTrapAddress
public java.net.InetAddress getTrapAddress()
For SNMPv2 traps, this returns the same value asTrapInformation.getAgentAddress()
.- Specified by:
getTrapAddress
in classTrapInformation
- Returns:
- The source IP address of the trap. For SNMPv2 traps, this value
is always the same as the value of
TrapInformation.getAgentAddress()
but for SNMPv1 traps, the value can be different if the trap has been forwarded. It then represents the true source IP address of the trap event.
-
getVarBindAt
protected org.snmp4j.smi.VariableBinding getVarBindAt(int index)
-
getVersion
public java.lang.String getVersion()
- Specified by:
getVersion
in classTrapInformation
-
validate
public void validate() throws SnmpException
Description copied from class:TrapInformation
Validate the trap.- Overrides:
validate
in classTrapInformation
- Throws:
SnmpException
- on validation error.
-
getSnmpVarBindDTO
public SnmpVarBindDTO getSnmpVarBindDTO(int i)
- Specified by:
getSnmpVarBindDTO
in classTrapInformation
-
getRequestId
protected java.lang.Integer getRequestId()
- Specified by:
getRequestId
in classTrapInformation
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-