com.outbackinc.services.protocol.snmp
Class SnmpTrapEvent

java.lang.Object
  |
  +--com.outbackinc.services.protocol.snmp.SnmpTrapEvent
All Implemented Interfaces:
java.io.Serializable

public class SnmpTrapEvent
extends java.lang.Object
implements java.io.Serializable

The SnmpTrapEvent contains all the information from a received trap PDU. The information in the PDU is decoded and available from the trap event through accessor functions.

NOTE: As of jSNMP v3.0, traps are based upon the SNMPV2 trap specification ( RFC 1905 - Protocol Operations for Version 2 of the Simple Network Management Protocol). That is, all traps are specified by an enterprise OID and trap code. The generic SNMPV1 traps, coldStart, warmStart, linkDown, linkUp, authenticationFailure, and egpNeighborLoss, are converted to traps with an enterprise OID of 1.3.6.1.6.3.1.1.5 and corresponding trap codes of 1, 2, 3, 4, 5, and 6 (see RFC 2576 - Coexistence between Version 1, Version 2, and Version 3 of the Internet-standard Network Management Framework). The SNMPv1 deprecated getGenericTrapType and getSpecificTrapType methods have been superceeded by the getTrapType method, but will work as before.

See Also:
SnmpAuthoritativeSession, SnmpConstants, Serialized Form

Constructor Summary
SnmpTrapEvent(java.net.InetAddress cAgentInetAddress, int iPort, java.lang.String szEnterpriseOID, java.lang.Integer igrGenericType, java.lang.Integer igrSpecificType, java.lang.Integer igrTimeStamp, java.util.Vector cVarBindsVector)
          Deprecated. as of jSNMP v3.0
 
Method Summary
 java.net.InetAddress getAgentAddress()
          Deprecated. as of jSNMP v3.0 by getAgentIPAddress()
 java.lang.String getAgentIPAddress()
          Gets the IP Address of the agent which generated this trap.
 java.lang.String getEnterpriseOID()
          Gets the enterprise OID
 java.lang.Integer getGenericTrapType()
          Deprecated. as of jSNMP v3.0 getTrapType() and getEnterpriseOID()
 int getNumberOfVarBinds()
          Obtains the number of VarBinds in this trap
 int getPort()
          Gets the port on which this trap was received
 java.lang.String getSendersIPAddress()
          Gets the IP Address of the sender of this trap's datagram packet.
 SnmpAuthoritativeSession getSession()
          Gets the session of the agent which generated this trap.
 java.lang.Integer getSpecificTrapType()
          Deprecated. as of jSNMP v3.0 getTrapType() and getEnterpriseOID()
 java.lang.Long getTimeStamp()
          Gets the time elapsed between the last (re)initialization of the network entity and the generation of the trap.
 java.lang.Integer getTrapType()
          Gets the type of trap.
 byte getType()
          Gets the trap/inform type (SnmpConstants.SNMP_TRAP, SnmpConstants.SNMP_TRAPV2, or SnmpConstants.SNMP_INFORM)
 SnmpVarBind getVarBind(int index)
          Gets the OIDs from each VarBind
 boolean isGeneric()
          Determines if the Trap is generic.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SnmpTrapEvent

public SnmpTrapEvent(java.net.InetAddress cAgentInetAddress,
                     int iPort,
                     java.lang.String szEnterpriseOID,
                     java.lang.Integer igrGenericType,
                     java.lang.Integer igrSpecificType,
                     java.lang.Integer igrTimeStamp,
                     java.util.Vector cVarBindsVector)
Deprecated. as of jSNMP v3.0

Constructor.
Parameters:
cAgentInetAddress - Address of the host running the agent.
iPort - Port the trap was received on
szEnterpriseOID - OID from trap
igrGenericType - The generic trap type. Indicates event that triggered trap.
igrSpecificType - An enterprise-specific trap type
igrTimeStamp - When the trap occured.
cVarBindsVector - VarBinds related to the trap.
Method Detail

getType

public byte getType()
Gets the trap/inform type (SnmpConstants.SNMP_TRAP, SnmpConstants.SNMP_TRAPV2, or SnmpConstants.SNMP_INFORM)
Returns:
trap/inform type
See Also:
SnmpConstants

getPort

public int getPort()
Gets the port on which this trap was received
Returns:
port

getEnterpriseOID

public java.lang.String getEnterpriseOID()
Gets the enterprise OID
Returns:
enterprise OID

getAgentAddress

public java.net.InetAddress getAgentAddress()
Deprecated. as of jSNMP v3.0 by getAgentIPAddress()

Gets the InetAddress of the agent which generated this trap. This is the address contained within the SNMP packet.
Returns:
InetAddress of the agent on success, else null for failure

getAgentIPAddress

public java.lang.String getAgentIPAddress()
Gets the IP Address of the agent which generated this trap. This is the address contained within the SNMP packet. This may not be necessarily the same as the physical sender of the datagram.
Returns:
IP Address of the agent

getSendersIPAddress

public java.lang.String getSendersIPAddress()
Gets the IP Address of the sender of this trap's datagram packet. This is the address of the physical sender of the datagram and not necessarily the same as the address contained within the SNMP packet, which is the address of the agent that generated the trap.
Returns:
IP Address of the sender

getSession

public SnmpAuthoritativeSession getSession()
Gets the session of the agent which generated this trap. May not be in trap profile. May be null if trap object created with deprecated constructor and invalid cAgentInetAddress argument.
Returns:
session

isGeneric

public boolean isGeneric()
Determines if the Trap is generic. This method is retained from jSNMP 2.X for convenience. It tests for what is considered "generic" in SNMPv1 by effectively evaluating the trap's enterprise OID. If the Enterprise OID is "1.3.6.1.6.3.1.1.5", then the trap is considered "generic." This method is more efficient than using getEnterpriseOID() and then comparing strings.
Returns:
true if the trap has a generic type, false if specific

getGenericTrapType

public java.lang.Integer getGenericTrapType()
Deprecated. as of jSNMP v3.0 getTrapType() and getEnterpriseOID()

Gets the type of generic trap
Returns:
generic trap type (coldStart, warmStart, linkDown, etc.)

getSpecificTrapType

public java.lang.Integer getSpecificTrapType()
Deprecated. as of jSNMP v3.0 getTrapType() and getEnterpriseOID()

Gets the type of specific trap
Returns:
specific trap type

getTrapType

public java.lang.Integer getTrapType()
Gets the type of trap. If this is a "generic" trap (getEnterpriseOID() returns "1.3.6.1.6.3.1.1.5"), the value returned will be zero based as defined in MIB-II, otherwise it will be one based.

"Generic" Traps
0 - coldStart
1 - warmStart
2 - linkDown
3 - linkUp
4 - authenticationFailure
5 - egpNeighborLoss

Returns:
trap type
See Also:
isGeneric()

getTimeStamp

public java.lang.Long getTimeStamp()
Gets the time elapsed between the last (re)initialization of the network entity and the generation of the trap. Note, pre jSNMP 3.2 versions returned an Integer.
Returns:
time stamp

getNumberOfVarBinds

public int getNumberOfVarBinds()
Obtains the number of VarBinds in this trap
Returns:
number of varbinds

getVarBind

public SnmpVarBind getVarBind(int index)
Gets the OIDs from each VarBind
Parameters:
index - 0-based index of the VarBind in the list
Returns:
the SnmpVarBind


Home  Services  Products  Purchase  Contact Us  About Us  Legal  Ceramics
Copyright © 2003-2008 jSNMP Enterprises All rights reserved.