|
OpenNMS API 1.2.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opennms.protocols.snmp.SnmpPduTrap
The SnmpPduTrap object represents the SNMP Protoco Data Unit for an SNMP Trap. The PDU format for a TRAP is not similar to the PDU format for other V1 types, and thus the SnmpPduTrap object does not extend the SnmpPduPacket class.
Field Summary | |
static int |
GenericAuthenticationFailure
Generic trap type: authentication-failure. |
static int |
GenericColdStart
Generic trap type: cold start. |
static int |
GenericEgpNeighborLoss
Generic trap type: EGP Neighbor Loss. |
static int |
GenericEnterpriseSpecific
Generic trap type: Enterprise Specific. |
static int |
GenericLinkDown
Generic trap type: link down. |
static int |
GenericLinkUp
Generic trap type: link up. |
static int |
GenericWarmStart
Generic trap type: warm start. |
private SnmpIPAddress |
m_agentAddr
The IP Address of the remote agent sending the trap. |
private SnmpObjectId |
m_enterprise
The trap's enterprise object identifier |
private int |
m_generic
The generic trap number. |
private int |
m_specific
The specific trap number. |
private long |
m_tstamp
The timestamp for when the trap occured. |
private java.util.ArrayList |
m_variables
The list of variable bindings for the trap. |
static int |
TRAP
The ASN.1 type for the SNMPv1 Trap. |
Constructor Summary | |
|
SnmpPduTrap()
Constructs a new SnmpPduTrap with the default values. |
protected |
SnmpPduTrap(SnmpPduTrap second)
Constructs a new trap pdu that is identical to the passed pdu. |
Method Summary | |
void |
addVarBind(SnmpVarBind vb)
Adds a new variable to the protocol data unit. |
void |
addVarBindAt(int ndx,
SnmpVarBind vb)
Adds a variable at a specific index. |
java.lang.Object |
clone()
|
int |
decodeASN(byte[] buf,
int offset,
AsnEncoder encoder)
Decodes the protocol data unit from the passed buffer. |
SnmpSyntax |
duplicate()
Creates a duplicate (in memory) object of the caller. |
int |
encodeASN(byte[] buf,
int offset,
AsnEncoder encoder)
Encodes the protocol data unit using the passed encoder and stores the results in the passed buffer. |
SnmpIPAddress |
getAgentAddress()
Gets the remote agent's IP address. |
SnmpObjectId |
getEnterprise()
Used to get the enterpise identifier of the trap. |
int |
getGeneric()
Returns the generic code for the trap. |
int |
getLength()
Returns the number of variables contained in the PDU. |
int |
getSpecific()
Returns the specific code for the trap. |
long |
getTimeStamp()
Returns the timeticks from the trap. |
SnmpVarBind |
getVarBindAt(int ndx)
Retrieves the variable at the specific index. |
SnmpVarBind |
removeVarBindAt(int ndx)
Removes the variable as defined by the index |
void |
setAgentAddress(SnmpIPAddress addr)
Sets the remote agent's IP address. |
void |
setEnterprise(SnmpObjectId id)
Sets the enterprise identifier for the trap. |
void |
setEnterprise(java.lang.String id)
Sets the enterprise identifier for the trap. |
void |
setGeneric(int generic)
Sets the generic code for the trap. |
void |
setSpecific(int spec)
Sets the specific type for the trap. |
void |
setTimeStamp(long ts)
Set's the timeticks in the trap. |
void |
setVarBindAt(int ndx,
SnmpVarBind vb)
Sets the specific variable at the requested location. |
SnmpVarBind[] |
toVarBindArray()
Returns a list of all the variables managed by this protocol data unit. |
byte |
typeId()
Returns the PDU commmand in an 8-bit format |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private SnmpObjectId m_enterprise
private SnmpIPAddress m_agentAddr
private int m_generic
private int m_specific
private long m_tstamp
private java.util.ArrayList m_variables
public static final int TRAP
public static final int GenericColdStart
public static final int GenericWarmStart
public static final int GenericLinkDown
public static final int GenericLinkUp
public static final int GenericAuthenticationFailure
public static final int GenericEgpNeighborLoss
public static final int GenericEnterpriseSpecific
Constructor Detail |
public SnmpPduTrap()
protected SnmpPduTrap(SnmpPduTrap second)
second
- The object to copy.Method Detail |
public SnmpObjectId getEnterprise()
public void setEnterprise(SnmpObjectId id)
id
- The object identifier.public void setEnterprise(java.lang.String id)
id
- The new identifier.public SnmpIPAddress getAgentAddress()
public void setAgentAddress(SnmpIPAddress addr)
addr
- The remote agent's ip address.public int getGeneric()
public void setGeneric(int generic)
generic
- The new generic code for the trap.public int getSpecific()
public void setSpecific(int spec)
spec
- The new specific identifier.public long getTimeStamp()
public void setTimeStamp(long ts)
ts
- The timeticks for the trap.public int getLength()
public void addVarBind(SnmpVarBind vb)
vb
- The new variable to addpublic void addVarBindAt(int ndx, SnmpVarBind vb)
ndx
- The index of the variablevb
- The new variable.public SnmpVarBind getVarBindAt(int ndx)
ndx
- The index of the variable
public void setVarBindAt(int ndx, SnmpVarBind vb)
ndx
- The location to setvb
- The new variablepublic SnmpVarBind removeVarBindAt(int ndx)
ndx
- The index of the variable to remove
public SnmpVarBind[] toVarBindArray()
public byte typeId()
typeId
in interface SnmpSyntax
public int encodeASN(byte[] buf, int offset, AsnEncoder encoder) throws AsnEncodingException
encodeASN
in interface SnmpSyntax
buf
- The buffer to write the encoded information.offset
- The offset to start writing informationencoder
- The encoder object.
AsnEncodingException
- Thrown if the encoder finds an error in the buffer.public int decodeASN(byte[] buf, int offset, AsnEncoder encoder) throws AsnDecodingException
decodeASN
in interface SnmpSyntax
buf
- The encode bufferoffset
- The offset byte to begin decodingencoder
- The decoder object.
AsnDecodingException
- Thrown by the encoder if an error occurs trying to decode
the data buffer.public SnmpSyntax duplicate()
SnmpSyntax
duplicate
in interface SnmpSyntax
public java.lang.Object clone()
|
OpenNMS API 1.2.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |