com.adventnet.snmp.snmp2.agent
Class BaseSnmpTrapService

java.lang.Object
  extended by com.adventnet.snmp.snmp2.agent.Cache
      extended by com.adventnet.snmp.snmp2.agent.BaseSnmpStore
          extended by com.adventnet.snmp.snmp2.agent.BaseSnmpTrapService
All Implemented Interfaces:
TrapRequestListener, AgentEventListener, java.io.Serializable
Direct Known Subclasses:
SnmpTrapService

public class BaseSnmpTrapService
extends BaseSnmpStore
implements TrapRequestListener

Used to send traps

Use setUsesSeperateSession(false) to have a same Session which shares with the Agent for sending traps. By default uses separate session for sending Traps. The default implementation requires the Agent (or the source bean for SnmpPduRequestEvent) to be alive

Provides a low level API to send traps

Listener component for TrapRequestEvents doesn't provide MIB support ie API users would need to explicitly fill the Trap details which needs to be sent.

Based on the Event parameters a BaseTrapForwardingTable is used for sending Traps If the agent acts as a standalone agent then the trap is send through SnmpSession for the registered managers in the table maintained by this BaseSnmpTrapService.

Both SnmpTrapService and MicroSnmpTrapService extend this class.

See Also:
SnmpTrapService, MicroSnmpTrapService, BaseSnmpAgent, SnmpAgent, TrapForwardingTableInterface, TrapRequestEvent, Serialized Form

Field Summary
(package private)  java.lang.String agentAddr
           
(package private)  java.lang.String community
           
(package private)  SnmpOID enterprise
           
(package private)  BaseForwardingTable forTable
           
(package private)  BaseTrapForwardingTable hdlr
           
protected  boolean isInformRequest
           
(package private)  RegistrationListener listener
           
(package private)  java.lang.String managerHost
           
(package private)  int managerPort
           
(package private)  int rowIndex
           
 boolean selectedPort
           
(package private)  int sessionPort
           
protected  Log snmpLog
           
(package private)  TrapForwardingTableInterface tfTable
           
(package private)  int trapIndex
           
(package private)  SnmpPDU trapPDU
           
(package private)  boolean trapSource
           
(package private)  boolean trapSourceDefault
           
(package private)  java.util.Vector varb
           
(package private)  int version
           
 
Fields inherited from class com.adventnet.snmp.snmp2.agent.BaseSnmpStore
debugLevel, oldAddress, oldPort, protocol, session
 
Fields inherited from class com.adventnet.snmp.snmp2.agent.Cache
cache, debug
 
Constructor Summary
BaseSnmpTrapService()
          no arg constructor which uses the separate SnmpSession.
BaseSnmpTrapService(int port)
          The port Constructor so that the Traps will be sent throgh the Session opened at the specified Port.
BaseSnmpTrapService(java.lang.String ipAddress, int port)
          The ipAddress, port Constructor so that the Traps will be sent through the Session opened at the specified Port and Address.
 
Method Summary
 void addRegistrationListener(RegistrationListener l)
          adds the registration listener for this bean.This listener maintains the registration tree where VarBindRequestListeners can register for their interested OID.
protected  void addSnmpV1TrapHeader(SnmpPDU pdu, SnmpSession session, SnmpOID enterprise, int trapIndex, long timeticks)
          Adds Trap Header in Snmp Version 1 model
protected  void addSnmpV2TrapHeader(SnmpPDU pdu, SnmpSession session, SnmpOID enterprise, int trapIndex, long timeticks)
          Adds Trap Header in Snmp Version 2 model
 void addTrapRequest(TrapRequestEvent te)
          This is the listener method for TrapRequestEvents.
 void closeTrapSession()
          closes the TrapSession if open
 ProtocolOptions createProtocolOptions(java.lang.String remoteHost, int remotePort, int localPort)
          This method will be called when by the SnmpSession to get the ProtocolOptions for the transport provider.
 void disableAuthTraps(boolean auth)
           
protected  void doRegistration()
          Does the Registration of the TrapForwarding Table to the PduRequestHandler Tree.
 java.lang.String getAgentAddr()
          Getter for agent address.
 java.lang.String getCommunity()
          Getter for community to be used.
 java.lang.String getEnterpriseOID()
          Getter for enterprise OID
 boolean getInformFlag()
          Method to get the Inform flag.
 java.lang.String getLocalAddress()
          Getter for the Address which sends the Trap
 java.lang.String getManagerHost()
          Getter for managerHost default localhost The source of this information could also be specified in form of ACL files or by simple TrapForwarding Table Typical TrapRequestEvent listeners would look at this values when the source value returned is DEFAULT
 int getManagerPort()
          Getter for managerPort The source of this information could also be specified in form of ACL files or by simple TrapForwarding Table Typical TrapRequestEvent listeners would look at this values when the source value returned is DEFAULT
 TrapForwardingTableInterface getTrapForwardingTable()
          Gets the BaseTrapForwardingTable which is used by this TrapRequestListener.
 int getTrapIndex()
          trapIndex value this could either be generic or enterpise specific value which is decided by the enterprise OID which is set by the user
protected  SnmpSession getTrapSession()
          Method to retrieve the Trap Session used by this TrapService.
 java.util.Vector getVarbind()
          Getter for varbind.
 int getVersion()
          Getter of SNMP version of trap events.
protected  SnmpSession initSeperateTrapSession()
          This method initialises a seperate session for sending TRAPs.
 boolean isTrapSessionAlive()
          This method checks for if session being used by the Trap Service is alive.
 boolean isTrapSourceDefault()
          Getter of TrapSourceDefault value
 boolean isUsesSeperateSession()
          getter for flag which indicates whether the Session is used is the same as the Session used by agent
protected  boolean oidEqualsSnmp(int[] oid)
          A Checker for enterprise OID to be equal to the SNMP OID
protected  boolean oidEqualsSnmp(SnmpOID oid)
          A Checker for enterprise OID to be equal to the SNMP OID
protected  void printDecodedPDU(SnmpPDU pdu)
           
 void removeRegistrationListener(RegistrationListener l)
          removes the registration listener for this bean.
 void sendTrap()
          Default sendTrap method which sends traps based on the properties set in the Service.
 void sendTrap(java.lang.Long timeticks)
          sendTrap with properties in the service and timeticks value(Agent UpTime)
 void sendTrap(java.lang.Object entry, SnmpOID enterprise, java.lang.String community, int trapIndex, long timeticks, java.util.Vector varbindVector)
          send the Trap to the managers in the TrapForwarding Table
protected  void sendTrap(SnmpPDU pdu, java.lang.String managerNode, int managerPort, java.lang.String community)
          Used to send SNMPV1 and SNMPV2 Traps This is low_level method which API users can use to send trap.
 void sendTrap(java.lang.String managerNode, int managerPort, SnmpOID enterprise, java.lang.String community, int trapIndex, long timeticks, java.util.Vector varbindVector, int version)
          Used to send SNMPV1 & SNMPV2 traps This is low_level method which API users can use to send trap.
 void sendTrap(TrapRequestEvent ev)
          this method just calls addTrapRequest(ev);
protected  void sendTrapDefault(TrapRequestEvent te)
           
protected  void sendTrapToManagers(TrapRequestEvent te)
           
protected  void sendTrapToManagersInTable(SnmpOID enterprise, java.lang.String community, int trapIndex, long timeticks, java.util.Vector varbindings, int version)
          send the Trap to the managers in the TrapForwarding Table
 void setAgentAddr(java.lang.String agentAddr)
          Setter for agent address - This has to be set to send the AgentAddress along with the SnmpV1 Traps
 void setCommunity(java.lang.String community)
          Setter for community to be used.
 void setDebug(boolean val)
          Deprecated. use Logging. sets the debug messages true for SnmpAPI.
 void setDefaultTrap(boolean isDefault)
          This method switches the trapSource (DEFAULT/TFTABLE) ie, specifies whether the manager to which the trap to be sent must be taken from TFTABLE / DEFAULT.
 void setEnterpriseOID(java.lang.String oid)
          Setter for enterprise OID
 void setForwardingEntryOID(java.lang.String oid)
          Sets the TrapForwardingEntry oid.
 void setHandler(BaseTrapForwardingTable handler)
          Method to set the BaseTrapForwardingTable Handler for this TrapService.
 void setInformFlag(boolean ir)
          Setter for this TrapSerive to send Inform requests.
 void setLocalAddress(java.lang.String localAddress)
          Sets the address of the agent which sends the trap
 void setManagerHost(java.lang.String managerHost)
          Setter for managerHost
 void setManagerPort(int managerPort)
          Setter for managerPort
 void setProtocol(int protocol)
          To set the protocol to be used by the session.
 void setTrapForwardingTable(TrapForwardingTableInterface intf)
          Sets the TrapForwardingTable which is used by this TrapRequestListener By default the BaseSnmpTrapService maintains a TrapTable which takes the default managers from a text file under the directory "conf".
 void setTrapIndex(int value)
          setter for the trapIndex
 void setTrapSession(SnmpSession session)
          Sets the session being used by the service as specified in the param.
protected  void setTrapSessionPort(int aport)
           
 void setTrapSourceDefault(boolean trapSourceDefault)
          Deprecated. use the method setDefaultTrap(boolean isDefault) Setter for the TrapSourceDefault value.
 void setUsesSeperateSession(boolean val)
          This method must be set when you would like a seperate session to be to be started for sending traps.
 void setVarbind(java.util.Vector varb)
          Setter for varbind
 void setVersion(int version)
          Setter for version of this TrapRequest
 boolean validateTrap(SnmpPDU pdu, java.lang.String managerHost, int managerPort)
          This is the Dummy Method added, to be Overwritten by the User to Validate the Traps that is sent from the Agent by adding a new class extending the SnmpTrapService.
 
Methods inherited from class com.adventnet.snmp.snmp2.agent.BaseSnmpStore
closeAll, finalize, getSnmpAPI, getSnmpSession, getSnmpSession, initSession, initSnmpStore, isAlive, isDebug, killSnmpAgent
 
Methods inherited from class com.adventnet.snmp.snmp2.agent.Cache
getFromCache, getMibOperations, putInCache, setMibOperations
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

isInformRequest

protected boolean isInformRequest

selectedPort

public boolean selectedPort

trapPDU

SnmpPDU trapPDU

trapSourceDefault

boolean trapSourceDefault

tfTable

TrapForwardingTableInterface tfTable

forTable

BaseForwardingTable forTable

trapSource

boolean trapSource

rowIndex

int rowIndex

version

int version

enterprise

SnmpOID enterprise

trapIndex

int trapIndex

community

java.lang.String community

managerHost

java.lang.String managerHost

managerPort

int managerPort

agentAddr

java.lang.String agentAddr

varb

java.util.Vector varb

listener

RegistrationListener listener

hdlr

BaseTrapForwardingTable hdlr

snmpLog

protected Log snmpLog

sessionPort

int sessionPort
Constructor Detail

BaseSnmpTrapService

public BaseSnmpTrapService()
no arg constructor which uses the separate SnmpSession. API users can have a separate session by calling setUsesSeperateSession(true)


BaseSnmpTrapService

public BaseSnmpTrapService(int port)
The port Constructor so that the Traps will be sent throgh the Session opened at the specified Port.

Parameters:
port - the int value of the port from where the Traps are to be sent.

BaseSnmpTrapService

public BaseSnmpTrapService(java.lang.String ipAddress,
                           int port)
The ipAddress, port Constructor so that the Traps will be sent through the Session opened at the specified Port and Address.

Parameters:
port - the int value of the port from where the Traps are to be sent.
ipAddress - String denoting the ipAddress to which the TrapSession has to be bound.
Method Detail

setTrapSourceDefault

public void setTrapSourceDefault(boolean trapSourceDefault)
Deprecated. use the method setDefaultTrap(boolean isDefault) Setter for the TrapSourceDefault value.

Parameters:
trapSourceDefault - specifies the handling the TrapForwarding using DEFAULT(true) option or the TFTABLE(false) option
Since:
AdventNet Agent Toolkit (Java/JMX Edition) 5.0

setDefaultTrap

public void setDefaultTrap(boolean isDefault)
This method switches the trapSource (DEFAULT/TFTABLE) ie, specifies whether the manager to which the trap to be sent must be taken from TFTABLE / DEFAULT. In the case of default, the traps can be sent to only one manager and by default , it is Users should set this flag to false to use the TrapForwardingTable. localhost - port number 162.

Parameters:
value - The Default option flag, if true the Default option is taken.
See Also:
isTrapSourceDefault()

isTrapSourceDefault

public boolean isTrapSourceDefault()
Getter of TrapSourceDefault value

Returns:
false if TFTABLE option is selected. By Default, the value is true.

setDebug

public void setDebug(boolean val)
Deprecated. use Logging. sets the debug messages true for SnmpAPI.

Description copied from class: BaseSnmpStore
sets the debug messages true for SnmpAPI.

Overrides:
setDebug in class BaseSnmpStore
Parameters:
val - true or false .
See Also:
SnmpAPI

setTrapForwardingTable

public void setTrapForwardingTable(TrapForwardingTableInterface intf)
Sets the TrapForwardingTable which is used by this TrapRequestListener By default the BaseSnmpTrapService maintains a TrapTable which takes the default managers from a text file under the directory "conf". As well the managers can make their entries remotely by using the "V1V2TrapForwardingTable" in "AGENT-SNMP-CONFIG-MIB" with entry oid ".1.3.6.1.4.1.2162.10.3.1.2.2.1.1"

For example to make a manager entry remotely,

  • set v1V2ManagerHost .1.3.6.1.4.1.2162.10.3.1.2.2.1.1.1 = 128.243.165.20
  • set v1V2ManagerPort .1.3.6.1.4.1.2162.10.3.1.2.2.1.1.2 = 162
  • set v1V2ManagerVersion .1.3.6.1.4.1.2162.10.3.1.2.2.1.1.3 = 2
  • set v1V2ManagerCommunity .1.3.6.1.4.1.2162.10.3.1.2.2.1.1.4 = public
  • set v1V2ManagerTimeOut .1.3.6.1.4.1.2162.10.3.1.2.2.1.1.5 = 5000
  • set v1V2ManagerRetries .1.3.6.1.4.1.2162.10.3.1.2.2.1.1.6 = 1
  • set v1V2ManagerStatus .1.3.6.1.4.1.2162.10.3.1.2.2.1.1.7 = 1(active)

    API users can have their own trapForwardingTable and call this method.

    Parameters:
    intf - the TrapForwardingTableInterface

  • getTrapForwardingTable

    public TrapForwardingTableInterface getTrapForwardingTable()
    Gets the BaseTrapForwardingTable which is used by this TrapRequestListener.

    Returns:
    the TrapForwardingTableInterface associated with this BaseSnmTrapService.

    addTrapRequest

    public void addTrapRequest(TrapRequestEvent te)
    This is the listener method for TrapRequestEvents. Source beans would call this method when they need to issue Traps

    Specified by:
    addTrapRequest in interface TrapRequestListener
    Parameters:
    te - the trap event
    See Also:
    TrapRequestEvent

    isUsesSeperateSession

    public boolean isUsesSeperateSession()
    getter for flag which indicates whether the Session is used is the same as the Session used by agent

    Returns:
    false if not uses separate session, otherwise true

    setUsesSeperateSession

    public void setUsesSeperateSession(boolean val)
    This method must be set when you would like a seperate session to be to be started for sending traps. By default SnmpTrapService uses the separate SnmpSession for sending TRAPs

    Parameters:
    val - yes for seperate session for Traps no for share the the same session.

    setTrapSession

    public void setTrapSession(SnmpSession session)
    Sets the session being used by the service as specified in the param.

    Parameters:
    session - the SnmpSession

    oidEqualsSnmp

    protected boolean oidEqualsSnmp(SnmpOID oid)
    A Checker for enterprise OID to be equal to the SNMP OID

    Parameters:
    oid - enterpise OID which needs to be checked
    Returns:
    true if oid equals Snmp

    oidEqualsSnmp

    protected boolean oidEqualsSnmp(int[] oid)
    A Checker for enterprise OID to be equal to the SNMP OID

    Returns:
    true if oid equals Snmp

    sendTrap

    public void sendTrap(java.lang.String managerNode,
                         int managerPort,
                         SnmpOID enterprise,
                         java.lang.String community,
                         int trapIndex,
                         long timeticks,
                         java.util.Vector varbindVector,
                         int version)
    Used to send SNMPV1 & SNMPV2 traps This is low_level method which API users can use to send trap.

    Parameters:
    managerNode - The Manager Host
    managerPort - The Manager Port to send the Trap
    enterprise - Enterprise Oid
    community - The community with which the Trap is to be sent
    trapIndex - The TrapIndex of the Trap
    timeticks - The Agent upTime
    varbind - Vector of SnmpVarBind variables
    version - SnmpTrap version to be sent.
    See Also:
    SnmpAPI, SnmpVarBind

    sendTrap

    protected void sendTrap(SnmpPDU pdu,
                            java.lang.String managerNode,
                            int managerPort,
                            java.lang.String community)
    Used to send SNMPV1 and SNMPV2 Traps This is low_level method which API users can use to send trap.

    Parameters:
    pdu - The enterprise SNMP PDU
    managerNode - The Manager Host
    managerPort - The Manager Port to which the Trap is to be sent
    community - The community with which the Trap is to be sent
    See Also:
    SnmpPDU

    printDecodedPDU

    protected void printDecodedPDU(SnmpPDU pdu)

    addSnmpV1TrapHeader

    protected void addSnmpV1TrapHeader(SnmpPDU pdu,
                                       SnmpSession session,
                                       SnmpOID enterprise,
                                       int trapIndex,
                                       long timeticks)
    Adds Trap Header in Snmp Version 1 model


    addSnmpV2TrapHeader

    protected void addSnmpV2TrapHeader(SnmpPDU pdu,
                                       SnmpSession session,
                                       SnmpOID enterprise,
                                       int trapIndex,
                                       long timeticks)
    Adds Trap Header in Snmp Version 2 model


    getLocalAddress

    public java.lang.String getLocalAddress()
    Getter for the Address which sends the Trap

    Returns:
    the address of the agent which sends the trap

    setLocalAddress

    public void setLocalAddress(java.lang.String localAddress)
    Sets the address of the agent which sends the trap

    Parameters:
    localAddress - The hostName or the IP of the machine which sends the trap

    setProtocol

    public void setProtocol(int protocol)
    To set the protocol to be used by the session. By default is UDP transport. If the protocol value is SnmpAgent.TRANSPORT_PROVIDER then user specified transport protocol provider will be used for SNMP entity communication.

    Parameters:
    protocol - the protocol to be used for transport. To use the user specifed transport layer this param value should be SnmpAgent.TRANSPORT_PROVIDER

    createProtocolOptions

    public ProtocolOptions createProtocolOptions(java.lang.String remoteHost,
                                                 int remotePort,
                                                 int localPort)
    This method will be called when by the SnmpSession to get the ProtocolOptions for the transport provider. This method will be called only when the protocol=SnmpAgent.TRANSPORT_PROVIDER. API user may override this method to provide their own protocol options. * Default implementation is com.adventnet.snmp.snmp2.AgentTcpProtocolOptionsImpl class

    Overrides:
    createProtocolOptions in class BaseSnmpStore
    Parameters:
    remoteHost - the remoteHost name. For agent session this value will be null. For SnmpTrapService session, this has the manager's host name.
    remotePort - the remotePort value. For agent session this value will be 0. For SnmpTrapService session, this has the manager's port number.
    localPort - the port number of the session by which the agent will be started.
    Returns:
    The ProtocolOptions created.

    initSeperateTrapSession

    protected SnmpSession initSeperateTrapSession()
    This method initialises a seperate session for sending TRAPs.

    Returns:
    The seperately initiated SnmpSession

    getTrapSession

    protected SnmpSession getTrapSession()
    Method to retrieve the Trap Session used by this TrapService.

    Returns:
    a Session based on the property usesSeparateSession

    closeTrapSession

    public void closeTrapSession()
    closes the TrapSession if open


    sendTrap

    public void sendTrap()
    Default sendTrap method which sends traps based on the properties set in the Service.


    sendTrap

    public void sendTrap(java.lang.Long timeticks)
    sendTrap with properties in the service and timeticks value(Agent UpTime)

    Parameters:
    timeticks - timer value

    sendTrap

    public void sendTrap(TrapRequestEvent ev)
    this method just calls addTrapRequest(ev);

    Parameters:
    te - The TrapRequestEvent object.
    See Also:
    addTrapRequest(TrapRequestEvent)

    isTrapSessionAlive

    public boolean isTrapSessionAlive()
    This method checks for if session being used by the Trap Service is alive. This could be a seperate session or the common Session used by the Agent

    Returns:
    true if the Session used by this is alive

    sendTrapToManagersInTable

    protected void sendTrapToManagersInTable(SnmpOID enterprise,
                                             java.lang.String community,
                                             int trapIndex,
                                             long timeticks,
                                             java.util.Vector varbindings,
                                             int version)
    send the Trap to the managers in the TrapForwarding Table

    Parameters:
    enterprise - The enterprise OID
    community - The community with which the Trap is to be sent
    trapIndex - The Trap Index of the Trap to be sent
    timeticks - The Agent UpTime
    varbindings - The varBind Vector
    version - The Snmp Version of the Trap

    sendTrapToManagers

    protected void sendTrapToManagers(TrapRequestEvent te)

    sendTrapDefault

    protected void sendTrapDefault(TrapRequestEvent te)

    getVersion

    public int getVersion()
    Getter of SNMP version of trap events.

    Returns:
    the version of this Trap. By default it is SnmpAPI.SNMP_VERSION_1 (version 1)
    See Also:
    constant values for valid version settings

    setVersion

    public void setVersion(int version)
    Setter for version of this TrapRequest

    Parameters:
    the - SNMP version

    getEnterpriseOID

    public java.lang.String getEnterpriseOID()
    Getter for enterprise OID

    Returns:
    "snmp" by default

    setEnterpriseOID

    public void setEnterpriseOID(java.lang.String oid)
    Setter for enterprise OID

    Parameters:
    enterprise - OID

    getTrapIndex

    public int getTrapIndex()
    trapIndex value this could either be generic or enterpise specific value which is decided by the enterprise OID which is set by the user

    Returns:
    trap index

    setTrapIndex

    public void setTrapIndex(int value)
    setter for the trapIndex

    Parameters:
    value - the trap index.

    getCommunity

    public java.lang.String getCommunity()
    Getter for community to be used. Most managers would simply ignore this.

    Returns:
    the value of the community

    setCommunity

    public void setCommunity(java.lang.String community)
    Setter for community to be used. Most managers would simply ignore this

    Parameters:
    community - value of the community

    getManagerHost

    public java.lang.String getManagerHost()
    Getter for managerHost default localhost The source of this information could also be specified in form of ACL files or by simple TrapForwarding Table Typical TrapRequestEvent listeners would look at this values when the source value returned is DEFAULT

    Returns:
    the manager host name

    setManagerHost

    public void setManagerHost(java.lang.String managerHost)
    Setter for managerHost

    Parameters:
    managerHost - the host name

    getManagerPort

    public int getManagerPort()
    Getter for managerPort The source of this information could also be specified in form of ACL files or by simple TrapForwarding Table Typical TrapRequestEvent listeners would look at this values when the source value returned is DEFAULT

    Returns:
    the manager port number
    See Also:
    setManagerPort(int managerPort)

    setManagerPort

    public void setManagerPort(int managerPort)
    Setter for managerPort

    Parameters:
    the - manager port number
    See Also:
    getManagerPort()

    getAgentAddr

    public java.lang.String getAgentAddr()
    Getter for agent address.

    Returns:
    the agent address
    See Also:
    setAgentAddr(String agentAddr)

    setAgentAddr

    public void setAgentAddr(java.lang.String agentAddr)
    Setter for agent address - This has to be set to send the AgentAddress along with the SnmpV1 Traps

    Parameters:
    agentAddr - agent address
    See Also:
    getAgentAddr()

    getVarbind

    public java.util.Vector getVarbind()
    Getter for varbind.

    Returns:
    the vector contains varbind
    See Also:
    setVarbind(Vector varb)

    setVarbind

    public void setVarbind(java.util.Vector varb)
    Setter for varbind

    Parameters:
    varb - vector contains the varbind
    See Also:
    getVarbind()

    addRegistrationListener

    public void addRegistrationListener(RegistrationListener l)
    adds the registration listener for this bean.This listener maintains the registration tree where VarBindRequestListeners can register for their interested OID.

    Parameters:
    l - the registration listener to whom the SnmpTrapService registers the TrapForwardingTable(VarBindRequestListener).
    See Also:
    removeRegistrationListener(RegistrationListener l)

    removeRegistrationListener

    public void removeRegistrationListener(RegistrationListener l)
    removes the registration listener for this bean.

    Parameters:
    l - the registration listener to whom the SnmpTrapService registers the TrapForwardingTable(VarBindRequestListener).
    See Also:
    addRegistrationListener(RegistrationListener l)

    setForwardingEntryOID

    public void setForwardingEntryOID(java.lang.String oid)
    Sets the TrapForwardingEntry oid.

    Parameters:
    oid - ex:- .1.3.6.1.4.1.2162.10.3.1.2.2.1.1 The Entry OID of the V1V2TrapForwarding Table in the AGENT-SNMP-CONFIG-MIB.

    doRegistration

    protected void doRegistration()
    Does the Registration of the TrapForwarding Table to the PduRequestHandler Tree.


    setHandler

    public void setHandler(BaseTrapForwardingTable handler)
    Method to set the BaseTrapForwardingTable Handler for this TrapService.

    Parameters:
    handler - The BaseTrapForwardingTable instance.

    sendTrap

    public void sendTrap(java.lang.Object entry,
                         SnmpOID enterprise,
                         java.lang.String community,
                         int trapIndex,
                         long timeticks,
                         java.util.Vector varbindVector)
    send the Trap to the managers in the TrapForwarding Table

    Parameters:
    entry - the Forwarding Entry Object for which the Trap is to be sent.
    enterprise - The enterprise OID
    community - The community with which the Trap is to be sent
    trapIndex - The Trap Index of the Trap to be sent
    timeticks - The Agent UpTime
    varbindings - The varBind Vector
    version - The Snmp Version of the Trap

    setTrapSessionPort

    protected void setTrapSessionPort(int aport)

    validateTrap

    public boolean validateTrap(SnmpPDU pdu,
                                java.lang.String managerHost,
                                int managerPort)
    This is the Dummy Method added, to be Overwritten by the User to Validate the Traps that is sent from the Agent by adding a new class extending the SnmpTrapService.

    The method to Validate the Traps. This will get called before the sendTrap method Sends the Traps to the Managers in the TFTable. Users have to Instrument the validating conditions in this method fulfilling their requirement.

    Parameters:
    pdu - The Trap SnmpPDU.
    managerNode - The ManagerHost for which the Trap is targeted.
    managerPort - The ManagerPort for which the Trap is targeted.

    setInformFlag

    public void setInformFlag(boolean ir)
    Setter for this TrapSerive to send Inform requests.

    Parameters:
    ir - true to send Inform Requests.

    getInformFlag

    public boolean getInformFlag()
    Method to get the Inform flag.

    Returns:
    true if Informs are sent by this else a false.

    disableAuthTraps

    public void disableAuthTraps(boolean auth)