|
HOME | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ireasoning.protocol.snmp.VarBindContainer
com.ireasoning.protocol.snmp.SnmpV1Trap
public class 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, EXPRESSION, 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(java.lang.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 |
java.lang.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. |
java.lang.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 |
java.lang.String |
getTimestampString()
Returns the string format of timestamp value, such as "10 hours 12 minutes" |
java.net.InetAddress |
getTrapSenderIpAddress()
Returns the IP address associated with the received SNMP packet. |
int |
getType()
Returns SnmpConst.V1TRAP |
java.lang.String |
getTypeString()
Returns "V1Trap" |
SnmpVarBind[] |
getVariables()
Returns the variable bindings contained in this trap object |
void |
setCommunity(java.lang.String community)
Sets new community string |
void |
setEnterprise(SnmpOID id)
Sets the enterprise identifier . |
void |
setEnterprise(java.lang.String id)
Sets the enterprise identifier . |
void |
setGeneric(int generic)
Sets the generic-trap field of this trap. |
void |
setIpAddress(java.net.InetAddress addr)
Sets the trap sender's IP address. |
void |
setIpAddress(SnmpIpAddress addr)
Sets the trap sender's IP address. |
void |
setIpAddress(java.lang.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(java.net.InetAddress addr)
Sets the IP address associated with the received SNMP UDP packet |
java.lang.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(java.lang.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(java.lang.String id)
public SnmpIpAddress getIpAddress()
public java.net.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(java.net.InetAddress addr)
public void setIpAddress(SnmpIpAddress addr)
addr
- ip address.public void setIpAddress(java.lang.String addr)
addr
- ip address.public void setIpAddress(java.net.InetAddress addr)
addr
- ip address.public int getGeneric()
public java.lang.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 java.lang.String getTimestampString()
public java.lang.String getCommunity()
public void setCommunity(java.lang.String community)
public SnmpVarBind[] getVariables()
public int getType()
getType
in interface Msg
getType
in interface SnmpDataType
public java.lang.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 java.lang.String toString()
toString
in class java.lang.Object
|
HOME | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |