com.ireasoning.protocol.snmp
Class SnmpTrap
java.lang.Object
|
+--com.ireasoning.protocol.snmp.VarBindContainer
|
+--com.ireasoning.protocol.snmp.SnmpPdu
|
+--com.ireasoning.protocol.snmp.SnmpV2Notification
|
+--com.ireasoning.protocol.snmp.SnmpTrap
- All Implemented Interfaces:
- Msg, Serializable, SnmpDataType
- public class SnmpTrap
- extends SnmpV2Notification
This class represents SNMPv2 and SNMPv3 trap type object.
SNMPv1 trap is represented by
SnmpV1Trap
class.
- See Also:
SnmpV1Trap
,
SnmpInform
, Serialized Form
Fields inherited from interface com.ireasoning.protocol.snmp.SnmpDataType |
BITS, BITSTRING, COUNTER32, COUNTER64, END_OF_MIB_VIEW, END_OF_MIB_VIEW_OBJECT, GAUGE32, INTEGER, IPADDRESS, NO_SUCH_INSTANCE, NO_SUCH_INSTANCE_OBJECT, NO_SUCH_OBJECT, NO_SUCH_OBJECT_OBJECT, NULL, OCTETSTRING, OID, OPAQUE, PDU, SEQUENCE, SEQUENCEOF, TIMETICKS, UNSIGNED32, VARBIND |
Fields inherited from interface com.ireasoning.protocol.Msg |
ERROR_TYPE |
Constructor Summary |
SnmpTrap(long sysUpTime,
SnmpOID snmpTrapOID)
Creates a SnmpTrap object using passed parameters |
SnmpTrap(long sysUpTime,
SnmpOID snmpTrapOID,
SnmpVarBind[] varbinds)
Creates a SnmpTrap object using passed parameters |
SnmpTrap(SnmpTrap trap)
Makes a copy of passed trap object |
Methods inherited from class com.ireasoning.protocol.snmp.SnmpPdu |
decodePdu, encode, encodePdu, getCommand, getCommunity, getContextEngineID, getContextName, getDestinationAddress, getDestinationPort, getErrorIndex, getErrorStatus, getErrorStatusString, getErrorStatusString, getErrorString, getMaxRepetitions, getNonRepeaters, getRequestID, getSourceAddress, getSourcePort, getVersion, hasMore, setCommand, setCommunity, setContextEngineID, setContextName, setDestinationAddress, setDestinationPort, setErrorIndex, setErrorStatus, setHasMore, setMaxRepetitions, setNonRepeaters, setOID, setOID, setOIDs, setOIDs, setRequestID, setSourceAddress, setSourcePort, setVersion |
Methods inherited from class com.ireasoning.protocol.snmp.VarBindContainer |
addVarBind, addVarBinds, addVarBinds, getFirstVarBind, getLastVarBind, getVarBind, getVarBindCount, getVarBinds, removeAllVarBinds, removeAllVarBinds, removeVarBind, setVarBinds, setVarBinds |
SnmpTrap
public SnmpTrap(long sysUpTime,
SnmpOID snmpTrapOID,
SnmpVarBind[] varbinds)
- Creates a SnmpTrap object using passed parameters
- Parameters:
sysUpTime
- the sysUpTime valuesnmpTrapOID
- the snmpTrapOID valuevarbinds
- the other variable bindings of this trap object
SnmpTrap
public SnmpTrap(long sysUpTime,
SnmpOID snmpTrapOID)
- Creates a SnmpTrap object using passed parameters
- Parameters:
sysUpTime
- the sysUpTime valuesnmpTrapOID
- the snmpTrapOID value
SnmpTrap
public SnmpTrap(SnmpTrap trap)
- Makes a copy of passed trap object
getType
public int getType()
- Returns SnmpConst.V2TRAP
- Overrides:
getType
in class SnmpPdu
- Following copied from interface:
com.ireasoning.protocol.snmp.SnmpDataType
- Returns:
- the object data type
getTypeString
public String getTypeString()
- Returns "V2Trap"
- Overrides:
getTypeString
in class SnmpPdu
toV1Trap
public SnmpV1Trap toV1Trap()
- Converts this v2 trap object to v1 trap according to RFC 2576 and RFC 2089.
Use sender's IP address as the value of ip address field of SNMPv1 trap.
If the translation occurs within a proxy application, the proxy must attempt
to extract the original source of the notification from the variable-bindings.
If the SNMPv2 variable-bindings contains a variable binding whose name is
snmpTrapAddress.0, the agent-addr parameter SHALL be set to the value of that variable binding.
- Returns:
- V1 trap object
toV1Trap
public SnmpV1Trap toV1Trap(String ipAddress)
- Converts this v2 trap object to v1 trap according to RFC 2576 and RFC 2089
- Parameters:
ipAddress
- notification originator's IP address- Returns:
- V1 trap object
copy
public SnmpDataType copy()
- Description copied from interface:
SnmpDataType
- Makes a copy of itself
- Overrides:
copy
in class SnmpPdu
- Following copied from interface:
com.ireasoning.protocol.snmp.SnmpDataType
- Returns:
- a deep copy of this object
Copyright © 2002 iReasoning Inc. All Rights Reserved.