com.adventnet.snmp.beans
Class TrapEvent

java.lang.Object
  |
  +--java.util.EventObject
        |
        +--com.adventnet.snmp.beans.TrapEvent
All Implemented Interfaces:
java.io.Serializable

public class TrapEvent
extends java.util.EventObject

Generated by the Snmp Trap Receiver bean when a trap is received. It contains the trap information.

See Also:
Serialized Form

Fields inherited from class java.util.EventObject
source
 
Constructor Summary
TrapEvent(java.lang.Object o)
          Instantiates a trap event with specified source.
TrapEvent(java.lang.Object o, SnmpPDU pdu)
          Instantiates a trap event with specified source, and specified trap PDU.
TrapEvent(java.lang.Object o, SnmpPDU pdu, java.lang.String error)
          Instantiates a trap event with specified source, specified variable bindings, and specified error message.
 
Method Summary
 java.lang.String getAgentAddress()
          Gets the address of the SNMP agent generating trap.
 java.lang.String getCommunity()
          Gets community string received/sent
 java.lang.String getEnterprise()
          Gets the trap enterprise OID.
 MibNode getNotificationDefinition()
          Gets the Notification definition if available in a loaded MIB
 java.lang.String getObjectID(int index)
          Gets specified variable ObjectID as a String from list of trap variables.
 java.lang.String getRemoteHost()
          Gets hostname of the source of trap.
 int getRemotePort()
          Gets the remote port of source of trap
 int getReqid()
          Gets the request Identifier in packet.
 int getSpecificType()
          Gets specific type number for the Trap Received.
 MibTrap getTrapDefinition()
          Gets the trap definition if available in a loaded MIB
 SnmpPDU getTrapPDU()
          Gets the trap PDU.
 int getTrapType()
          Gets the trap type of a specific Trap.
 long getUpTime()
          Gets the uptime value for a trap.
 java.lang.String getVariable(int index)
          Get the specified Variable as a String from traps list of variables.
 int getVersion()
          Gets SNMP Version number in PDU.
 
Methods inherited from class java.util.EventObject
getSource, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TrapEvent

public TrapEvent(java.lang.Object o)
Instantiates a trap event with specified source.

TrapEvent

public TrapEvent(java.lang.Object o,
                 SnmpPDU pdu)
Instantiates a trap event with specified source, and specified trap PDU.

TrapEvent

public TrapEvent(java.lang.Object o,
                 SnmpPDU pdu,
                 java.lang.String error)
Instantiates a trap event with specified source, specified variable bindings, and specified error message.
Method Detail

getObjectID

public java.lang.String getObjectID(int index)
Gets specified variable ObjectID as a String from list of trap variables. Indexes start at 0.
Returns:
string representation of the specified OID.

getVariable

public java.lang.String getVariable(int index)
Get the specified Variable as a String from traps list of variables. Indexes start at 0.
Returns:
string representation of the specific SnmpVar variable..

getTrapDefinition

public MibTrap getTrapDefinition()
Gets the trap definition if available in a loaded MIB
Returns:
MibTrap object for the defined trap.

getNotificationDefinition

public MibNode getNotificationDefinition()
Gets the Notification definition if available in a loaded MIB
Returns:
MibNode object for the defined trap notification.

getTrapPDU

public SnmpPDU getTrapPDU()
Gets the trap PDU.
Returns:
SnmpPDU for trap.

getRemoteHost

public java.lang.String getRemoteHost()
Gets hostname of the source of trap.
Returns:
Remote hostname in string.

getRemotePort

public int getRemotePort()
Gets the remote port of source of trap
Returns:
remote port number.

getReqid

public int getReqid()
Gets the request Identifier in packet.
Returns:
request Identifier.

getEnterprise

public java.lang.String getEnterprise()
Gets the trap enterprise OID.
Returns:
string representation of SnmpOID.

getAgentAddress

public java.lang.String getAgentAddress()
Gets the address of the SNMP agent generating trap.
Returns:
string represententaion of the Agent Address.

getTrapType

public int getTrapType()
Gets the trap type of a specific Trap. This will return an integer having value between 0 and 6. If the value is from 0 - 5 the trap type is of generic type. If the valus is 6, then the trap is specific type or enterprise specific. 0 - coldStart 1 - warmStart 2 - linkDown 3 - linkUp 4 - authenticationFailure 5 - egpNeigbhourLoss 6 - enterpriseSpecific
Returns:
The number that denotes the trap type.

getSpecificType

public int getSpecificType()
Gets specific type number for the Trap Received.
Returns:
integer that specifies the type.

getUpTime

public long getUpTime()
Gets the uptime value for a trap. The uptime value is the time interval between the time when the agent sent the trap and the agent last restarted.
Returns:
long value of the time interval.

getCommunity

public java.lang.String getCommunity()
Gets community string received/sent
Returns:
community string.

getVersion

public int getVersion()
Gets SNMP Version number in PDU.
Returns:
integer that denotes the SNMP version.


Copyright (c)AdventNet Inc., 1996-2004