|
HOME | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.ireasoning.protocol.snmp.VarBindContainer com.ireasoning.protocol.snmp.SnmpV1Trap
This class represents SNMPv1 Trap message. SNMPv2c and SNMPv3 trap are
represented by SnmpTrap
class.
SnmpTrap
,
Serialized FormField Summary | |
static int |
AUTHENTICATION_FAILURE_TRAP
SnmpV1 trap type: authenticationFailure |
static int |
COLD_START_TRAP
SnmpV1 trap type: coldStart |
static int |
EGPNEIGHBOR_LOSS_TRAP
SnmpV1 trap type: egpNeighborLoss |
static int |
LINK_DOWN_TRAP
SnmpV1 trap type: linkDown |
static int |
LINK_UP_TRAP
SnmpV1 trap type: linkUp |
static int |
WARM_START_TRAP
SnmpV1 trap type: warmStart |
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, serialVersionUID, TIMETICKS, UNSIGNED32, VARBIND |
Fields inherited from interface com.ireasoning.protocol.Msg |
ERROR_TYPE |
Constructor Summary | |
SnmpV1Trap(SnmpOID enterprise)
Constructs an SnmpV1Trap object with passed enterprise value, sets agent address to local ip address |
|
SnmpV1Trap(SnmpV1Trap trap)
Makes a copy of passed object |
|
SnmpV1Trap(String enterprise)
Constructs an SnmpV1Trap object with passed enterprise value, sets agent address to local ip address |
Method Summary | |
SnmpDataType |
copy()
Makes a copy of itself |
static SnmpV1Trap |
decodeV1Trap(byte[] data,
int length)
Constructs a SnmpV1Trap object based on passed byte array |
int |
encode(com.ireasoning.protocol.snmp.SnmpEncoder encoder)
For internal use |
static byte[] |
encodeV1Trap(SnmpV1Trap trap)
Encodes passed SnmpV1Trap object to byte array |
String |
getCommunity()
Returns the community name contained in this object |
SnmpOID |
getEnterprise()
Returns the enterpise OID. |
int |
getGeneric()
Returns the generic-trap field of this trap. |
String |
getGenericString()
Returns the string representation of generic-trap field. |
SnmpIpAddress |
getIpAddress()
Returns the value of IP address field of the trap |
int |
getSpecific()
Returns the specific code of this trap. |
long |
getTimestamp()
Returns the timestamp value (in hundredths of a second), which is time elapsed between the last (re)initialization of the network entity and the generation of the trap |
String |
getTimestampString()
Returns the string format of timestamp value, such as "10 hours 12 minutes" |
InetAddress |
getTrapSenderIpAddress()
Returns the IP address associated with the received SNMP packet. |
int |
getType()
Returns SnmpConst.V1TRAP |
String |
getTypeString()
Returns "V1Trap" |
SnmpVarBind[] |
getVariables()
Returns the variable bindings contained in this trap object |
void |
setCommunity(String community)
Sets new community string |
void |
setEnterprise(SnmpOID id)
Sets the enterprise identifier . |
void |
setEnterprise(String id)
Sets the enterprise identifier . |
void |
setGeneric(int generic)
Sets the generic-trap field of this trap. |
void |
setIpAddress(InetAddress addr)
Sets the trap sender's IP address. |
void |
setIpAddress(SnmpIpAddress addr)
Sets the trap sender's IP address. |
void |
setIpAddress(String addr)
Sets the trap sender's IP address. |
void |
setSpecific(int spec)
Sets the specific code for this trap. |
void |
setTimestamp(long timestamp)
Sets the timestamp |
void |
setTrapSenderIpAddress(InetAddress addr)
Sets the IP address associated with the received SNMP UDP packet |
String |
toString()
|
SnmpTrap |
toV2Trap()
Converts to SNMPv2c trap according to RFC 2576 and RFC 1908. |
SnmpTrap |
toV2Trap(boolean isProxy)
Converts to SNMPv2c trap according to RFC 2576 and RFC 1908 |
Methods inherited from class com.ireasoning.protocol.snmp.VarBindContainer |
addVarBind, addVarBinds, addVarBinds, getFirstVarBind, getLastVarBind, getVarBind, getVarBindCount, getVarBinds, removeAllVarBinds, removeAllVarBinds, removeVarBind, setVarBinds, setVarBinds |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.ireasoning.protocol.snmp.SnmpDataType |
equals, hashCode |
Field Detail |
public static final int COLD_START_TRAP
public static final int WARM_START_TRAP
public static final int LINK_DOWN_TRAP
public static final int LINK_UP_TRAP
public static final int AUTHENTICATION_FAILURE_TRAP
public static final int EGPNEIGHBOR_LOSS_TRAP
Constructor Detail |
public SnmpV1Trap(SnmpOID enterprise)
enterprise
- the enterprise identifier value of this objectpublic SnmpV1Trap(String enterprise)
enterprise
- the enterprise identifier value of this objectpublic SnmpV1Trap(SnmpV1Trap trap)
Method Detail |
public static SnmpV1Trap decodeV1Trap(byte[] data, int length) throws SnmpDecodingException
SnmpV1Trap
object based on passed byte array
data
- byte array representation of an SnmpV1Trap objectlength
- the number of bytes of data to be decoded
SnmpDecodingException
public static byte[] encodeV1Trap(SnmpV1Trap trap) throws SnmpEncodingException
SnmpV1Trap
object to byte array
trap
- SnmpV1Trap
object
SnmpEncodingException
public SnmpOID getEnterprise()
public void setEnterprise(SnmpOID id)
public void setEnterprise(String id)
public SnmpIpAddress getIpAddress()
public InetAddress getTrapSenderIpAddress()
Note: It may be different from the return value of getIpAddress()
,
which is the IP address field contained in the SNMPv1 PDU
public void setTrapSenderIpAddress(InetAddress addr)
public void setIpAddress(SnmpIpAddress addr)
addr
- ip address.public void setIpAddress(String addr)
addr
- ip address.public void setIpAddress(InetAddress addr)
addr
- ip address.public int getGeneric()
public String getGenericString()
public void setGeneric(int generic)
generic
- The new generic code for the trap.
One of the following:
0 -- cold start 1 -- warm start 2 -- link down 3 -- link up 4 -- authentification failure 5 -- EGP neighbor loss 6 -- enterprise specific
public int getSpecific()
public void setSpecific(int spec)
If the passed spec
is not 0, generic
will be set to be 6.
spec
- The new specific identifier.public long getTimestamp()
public void setTimestamp(long timestamp)
timestamp
- The timeticks for the trap, in hundredths of a second.public String getTimestampString()
public String getCommunity()
public void setCommunity(String community)
public SnmpVarBind[] getVariables()
public int getType()
getType
in interface SnmpDataType
public String getTypeString()
getTypeString
in interface SnmpDataType
public SnmpTrap toV2Trap()
public SnmpTrap toV2Trap(boolean isProxy)
isProxy
- true if it's performed by a proxy, three more variable bindings,
{ snmpTrapAddress.0, snmpTrapCommunity.0, snmpTrapEnterprise.0}, will be addedpublic SnmpDataType copy()
SnmpDataType
copy
in interface SnmpDataType
public int encode(com.ireasoning.protocol.snmp.SnmpEncoder encoder) throws SnmpEncodingException
SnmpDataType
encode
in interface SnmpDataType
SnmpEncodingException
public String toString()
|
HOME | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |