com.adventnet.snmp.snmp2.agent
Class SnmpTrapService

java.lang.Object
  |
  +--com.adventnet.snmp.snmp2.agent.Cache
        |
        +--com.adventnet.snmp.snmp2.agent.BaseSnmpStore
              |
              +--com.adventnet.snmp.snmp2.agent.BaseSnmpTrapService
                    |
                    +--com.adventnet.snmp.snmp2.agent.SnmpTrapService
Direct Known Subclasses:
SnmpMibTrapService

public class SnmpTrapService
extends BaseSnmpTrapService

Used to send SNMPV1 traps & SNMPV2c\V3 Notifcations

Use setSeperateTrapSession(false) to have a same Session which shares with the SnmpAgent for sending traps. By default uses separate session for sending Traps. The default implementation requires the SnmpAgent (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 TrapForwardingTable is used for sending Traps

To use in applications:

  • SnmpTrapService trapGen = new SnmpTrapService ();
  • trapGen.setEnterpriseOID(".1.3.6.1.4.1.2162");
  • trapGen.setTrapIndex(1);
  • trapGen.setManagerHost("localhost");
  • trapGen.setManagerPort(8500);
  • trapGen.sendTrap( new Long(100)); //100 is the uptime

    or

  • TrapRequestEvent te = new TrapRequestEvent(this, varbindVector, TrapRequestEvent.TFTABLE, ".1.3.6.1.2.1.10.32",1);
  • te.setTimeTicks(agentListener.getUpTime());
  • te.setSubAgent(false);
  • trapGen.sendTrap(te);

    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 SnmpTrapService.

    See Also:
    SnmpAgent, TrapForwardingTableInterface, TrapRequestEvent, Serialized Form

    Field Summary
    (package private)  XMLToVector fileToVector
               
    (package private)  ForwardingTable forTable
               
    (package private)  SimpleTrapForwardingTable hdlr
               
    (package private)  boolean isPersistence
               
    (package private)  boolean isReliableTraps
               
    (package private)  NotificationLogTableRequestHandler notifHdlr1
               
    (package private)  NotificationVarbindTableRequestHandler notifVarHdlr1
               
    (package private)  int numRowsforRelTraps
               
    (package private)  boolean selectedPort
               
    (package private) static NativeSnmpTrap snmpTrap
               
    (package private)  java.lang.String trapPathName
               
    (package private)  SnmpPDU trapPDU
               
    (package private) static boolean trapSet
               
    (package private)  java.lang.String trapTableName
               
    (package private)  V3ForwardingTable v3ForTable
               
    (package private)  java.lang.String v3TrapTableName
               
     
    Fields inherited from class com.adventnet.snmp.snmp2.agent.BaseSnmpTrapService
    agentAddr, community, enterprise, forTable, hdlr, isInformRequest, listener, managerHost, managerPort, rowIndex, selectedPort, sessionPort, snmpLog, tfTable, trapIndex, trapPDU, trapSource, trapSourceDefault, varb, version
     
    Fields inherited from class com.adventnet.snmp.snmp2.agent.BaseSnmpStore
    debugLevel, localAddress, oldAddress, oldPort, protocol, session, snmpLog
     
    Fields inherited from class com.adventnet.snmp.snmp2.agent.Cache
    cache, debug
     
    Constructor Summary
    SnmpTrapService()
              no arg constructor which uses the separate SnmpSession.
    SnmpTrapService(boolean isPersistence)
              Deprecated. - persistence options can be set from the ForwardingTable classes. Secondary constructor which uses the separate SnmpSession and turns ON/OFF Persistence storage of TrapForwardingTable. API users can have a separate session by calling setSeperateTrapSession(false)
    SnmpTrapService(int port)
              The port Constructor so that the Traps will be sent throgh the Session opened at the specified Port.
    SnmpTrapService(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.
    SnmpTrapService(java.lang.String dirStr, java.lang.String fileName, boolean fToVPersistence)
              Deprecated. - persistence options can be set from the ForwardingTable classes. Secondary constructor which uses the separate SnmpSession and specifies the persistence of TFTable parameters and type of persistence(FToV or XML Format). API users can have a separate session by calling setSeperateTrapSession(false)
     
    Method Summary
    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.
    protected  void doRegistration()
              Does the Registration of the TrapForwarding Table to the PduRequestHandler Tree.
     java.lang.String getContextName()
              Get the contextName for the V3 message to be forwarded with the notification.
     byte getSecurityLevel()
              Getter for securityLevel of the SnmpV3 Trap to be sent when DEFAULT option is chosen
     int getSecurityModel()
              Get the securityModel for the V3 message to be forwarded with the notification.
    static boolean getTrapFlag()
              Deprecated. - as this method is no longer needed. This trapFlag is especially useful in sending trap if the agent registered as sub-agent with Windows master agent.

    If sendTrap method is called when the agent is running as WindowsSubAgent, then trap should be send through the master agent.So when sendTrap method is called this flag is set .The Aeadll.dll polls for this flag,if it is set, then the Aeadll calls the getTrapObject() ,by which it gives the trap information to the master agent and resets this flag.

    static NativeSnmpTrap getTrapObject()
              Deprecated. - as this method is no longer needed. gets the NativeSnmpTrap object

    If sendTrap method is called when the agent is running as WindowsSubAgent, then trap should be send through the master agent.So when sendTrap method is called this trapflag is set .The Aeadll.dll polls for this trapflag,if it is set, then the Aeadll calls the getTrapObject() ,by which it gives the trap information to the master agent and resets this trapflag.

     java.lang.String getTrapPathName()
              Deprecated. - persistence has been moved to Table files. Getter for the trapPathName . By Default the SnmpTrapService will take the managers from this trapTable path specified.
     java.lang.String getTrapTableName()
              Deprecated. use the method in ForwardingTable. Getter for the trapTableName . By Default the SnmpTrapService will take the managers from this trapTable fileName specified.
     java.lang.String getUserName()
              Get the userName to be used while forwarding the SnmpV3 notification message.
     java.lang.String getV3TrapTableName()
              Deprecated. Make use of the V3ForwardingTable methods. Getter for the v3TrapTableName . By Default the SnmpTrapService will take the managers from this v3TrapTable fileName specified.
     boolean isPersistence()
              Deprecated. - persistence has been moved to Table files. Getter for Flag isPersistence which specifies the Persistency of the values of Trap Forwarding Table. By Default the Persistence to the fileSystem is turned ON.
     boolean isReliableTraps()
              Method to know whether this Traps were stored - reliable.
     void nativeInitTrapService()
              This method initialises the trap session and and puts the session in the cache.
    protected  void printDecodedPDU(SnmpPDU pdu)
               
     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 Traps & SNMPV2\V3 Notifications 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.
    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 setContextName(java.lang.String contextName)
              Set the contextName for the V3 message to be forwarded with the notification.
     void setFToVPersistence(boolean fToVPersistence)
              Deprecated. - persistence has been moved to ForwardingTable files.
     void setHandler(SimpleTrapForwardingTable handler)
              Method to set the SimpleTrapForwardingTable Handler for this TrapService.
     void setPersistence(boolean value)
              Deprecated. use the method in ForwardingTable and V3TrapForwardingTable. Sets whether or not persistence storage to be used or not. By default this will be true
     void setRefreshTrapTable(int refreshTime)
              Used to update the TrapTable periodically
     void setReliableTraps(boolean isReliableTraps, int numRows)
              The Method added for the Reliable Traps Support.
     void setSecurityLevel(byte securityLevel)
              Setter for securityLevel of the SnmpV3 Trap to be sent when DEFAULT option is chosen
     void setSecurityModel(int securityModel)
              Set the securityModel for the V3 message to be forwarded with the notification.
    static void setTrapFlag(boolean flag)
              Deprecated. - as this method is no longer needed. Sets the Trap Flag.

    This trapFlag is especially useful in sending trap if the agent registered as sub-agent with Windows master agent.

    If sendTrap method is called when the agent is running as WindowsSubAgent, then trap should be send through the master agent.So when sendTrap method is called this flag is set .The Aeadll.dll polls for this flag,if it is set, then the Aeadll calls the getTrapObject() ,by which it gives the trap information to the master agent and resets this flag.

     void setTrapForwardingTable(TrapForwardingTableInterface intf)
              Sets the TrapForwardingTable which is used by this TrapRequestListener By default the SnmpTrapService maintains a TrapTable which takes the default managers from a text file under the directory "conf".
    static void setTrapObject(NativeSnmpTrap trap)
              Deprecated. - as this method is no longer needed. sets the NativeSnmpTrap which holds the trap information when the trap is to be send through the windows master agent.
     void setTrapPathName(java.lang.String pathName)
              Deprecated. - persistence has been moved to Table files. Setter for the trapPathName . By Default the SnmpTrapService will take the managers from this trapTable path specified.
     void setTrapTableName(java.lang.String tableName)
              Deprecated. Make use of the ForwardingTable methods. Setter for the trapTableName . By Default the SnmpTrapService will take the managers from this trapTable fileName specified.
     void setUserName(java.lang.String userName)
              Set the userName to be used while forwarding the SnmpV3 notification message.
     void setV3TrapTableName(java.lang.String tableName)
              Deprecated. Make use of the V3ForwardingTable methods. Setter for the v3TrapTableName . By Default the SnmpTrapService will take the managers from this v3TrapTable fileName specified.
     void setWriter(XMLToVector writer)
              Method to set the XMLToVector instance for storing the datas.
     
    Methods inherited from class com.adventnet.snmp.snmp2.agent.BaseSnmpTrapService
    addRegistrationListener, addSnmpV1TrapHeader, closeTrapSession, createProtocolOptions, getAgentAddr, getCommunity, getEnterpriseOID, getInformFlag, getLocalAddress, getManagerHost, getManagerPort, getTrapForwardingTable, getTrapIndex, getTrapSession, getVarbind, getVersion, initSeperateTrapSession, isTrapSessionAlive, isTrapSourceDefault, isUsesSeperateSession, oidEqualsSnmp, oidEqualsSnmp, removeRegistrationListener, sendTrap, sendTrap, sendTrap, sendTrapDefault, sendTrapToManagers, setAgentAddr, setCommunity, setDebug, setDefaultTrap, setEnterpriseOID, setForwardingEntryOID, setHandler, setInformFlag, setLocalAddress, setManagerHost, setManagerPort, setProtocol, setTrapIndex, setTrapSession, setTrapSessionPort, setTrapSourceDefault, setUsesSeperateSession, setVarbind, setVersion, validateTrap
     
    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

    selectedPort

    boolean selectedPort

    trapPDU

    SnmpPDU trapPDU

    isReliableTraps

    boolean isReliableTraps

    v3ForTable

    V3ForwardingTable v3ForTable

    forTable

    ForwardingTable forTable

    trapPathName

    java.lang.String trapPathName

    trapTableName

    java.lang.String trapTableName

    v3TrapTableName

    java.lang.String v3TrapTableName

    hdlr

    SimpleTrapForwardingTable hdlr

    isPersistence

    boolean isPersistence

    fileToVector

    XMLToVector fileToVector

    trapSet

    static boolean trapSet

    snmpTrap

    static NativeSnmpTrap snmpTrap

    numRowsforRelTraps

    int numRowsforRelTraps

    notifHdlr1

    NotificationLogTableRequestHandler notifHdlr1

    notifVarHdlr1

    NotificationVarbindTableRequestHandler notifVarHdlr1
    Constructor Detail

    SnmpTrapService

    public SnmpTrapService()
    no arg constructor which uses the separate SnmpSession. API users can have a separate session by calling setSeperateTrapSession(false)

    SnmpTrapService

    public SnmpTrapService(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.

    SnmpTrapService

    public SnmpTrapService(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.

    SnmpTrapService

    public SnmpTrapService(boolean isPersistence)
    Deprecated. - persistence options can be set from the ForwardingTable classes. Secondary constructor which uses the separate SnmpSession and turns ON/OFF Persistence storage of TrapForwardingTable. API users can have a separate session by calling setSeperateTrapSession(false)

    Parameters:
    isPersistence - to turn ON persistence or Not

    SnmpTrapService

    public SnmpTrapService(java.lang.String dirStr,
                           java.lang.String fileName,
                           boolean fToVPersistence)
    Deprecated. - persistence options can be set from the ForwardingTable classes. Secondary constructor which uses the separate SnmpSession and specifies the persistence of TFTable parameters and type of persistence(FToV or XML Format). API users can have a separate session by calling setSeperateTrapSession(false)

    Parameters:
    isPersistence - to turn ON persistence or Not
    Method Detail

    setTrapForwardingTable

    public void setTrapForwardingTable(TrapForwardingTableInterface intf)
    Sets the TrapForwardingTable which is used by this TrapRequestListener By default the SnmpTrapService 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.

    Overrides:
    setTrapForwardingTable in class BaseSnmpTrapService
    Parameters:
    intf - the TrapForwardingTableInterface

  • setRefreshTrapTable

    public void setRefreshTrapTable(int refreshTime)
    Used to update the TrapTable periodically
    Parameters:
    refreshTime - Time period for refreshing the TrapTable.

    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
    Overrides:
    addTrapRequest in class BaseSnmpTrapService
    Parameters:
    te - the trap event
    See Also:
    TrapRequestEvent

    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.
    Overrides:
    sendTrap in class BaseSnmpTrapService
    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 Traps & SNMPV2\V3 Notifications This is low_level method which API users can use to send trap.
    Overrides:
    sendTrap in class BaseSnmpTrapService
    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)
    Overrides:
    printDecodedPDU in class BaseSnmpTrapService

    addSnmpV2TrapHeader

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

    setSecurityModel

    public void setSecurityModel(int securityModel)
    Set the securityModel for the V3 message to be forwarded with the notification.
    Parameters:
    int - securityModel - the securityModel

    setContextName

    public void setContextName(java.lang.String contextName)
    Set the contextName for the V3 message to be forwarded with the notification.
    Parameters:
    String - contextName - the contextName.

    setUserName

    public void setUserName(java.lang.String userName)
    Set the userName to be used while forwarding the SnmpV3 notification message.
    Parameters:
    String - userName - the userName .

    getSecurityModel

    public int getSecurityModel()
    Get the securityModel for the V3 message to be forwarded with the notification.
    Returns:
    the securityModel

    getContextName

    public java.lang.String getContextName()
    Get the contextName for the V3 message to be forwarded with the notification.
    Returns:
    - the contextName.

    getUserName

    public java.lang.String getUserName()
    Get the userName to be used while forwarding the SnmpV3 notification message.
    Returns:
    the userName .

    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
    Overrides:
    sendTrapToManagersInTable in class BaseSnmpTrapService
    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

    getTrapPathName

    public java.lang.String getTrapPathName()
    Deprecated. - persistence has been moved to Table files. Getter for the trapPathName . By Default the SnmpTrapService will take the managers from this trapTable path specified.

    Returns:
    String TrapPathName - string specifying the TrapPathName like "/TrapTableName".

    setTrapPathName

    public void setTrapPathName(java.lang.String pathName)
    Deprecated. - persistence has been moved to Table files. Setter for the trapPathName . By Default the SnmpTrapService will take the managers from this trapTable path specified.

    Parameters:
    pathName - specifies the TrapPathName like this "/".

    getTrapTableName

    public java.lang.String getTrapTableName()
    Deprecated. use the method in ForwardingTable. Getter for the trapTableName . By Default the SnmpTrapService will take the managers from this trapTable fileName specified.

    See Also:
    setTrapTableName(String tableName)

    setTrapTableName

    public void setTrapTableName(java.lang.String tableName)
    Deprecated. Make use of the ForwardingTable methods. Setter for the trapTableName . By Default the SnmpTrapService will take the managers from this trapTable fileName specified.

    See Also:
    getTrapTableName()

    getV3TrapTableName

    public java.lang.String getV3TrapTableName()
    Deprecated. Make use of the V3ForwardingTable methods. Getter for the v3TrapTableName . By Default the SnmpTrapService will take the managers from this v3TrapTable fileName specified.

    See Also:
    setV3TrapTableName(String tableName)

    setV3TrapTableName

    public void setV3TrapTableName(java.lang.String tableName)
    Deprecated. Make use of the V3ForwardingTable methods. Setter for the v3TrapTableName . By Default the SnmpTrapService will take the managers from this v3TrapTable fileName specified.

    See Also:
    getV3TrapTableName()

    isReliableTraps

    public boolean isReliableTraps()
    Method to know whether this Traps were stored - reliable.
    Returns:
    true if the Traps are stroed else a false.

    setPersistence

    public void setPersistence(boolean value)
    Deprecated. use the method in ForwardingTable and V3TrapForwardingTable. Sets whether or not persistence storage to be used or not. By default this will be true

    Parameters:
    val - true for persistence and false for non persistence
    See Also:
    isPersistence()

    isPersistence

    public boolean isPersistence()
    Deprecated. - persistence has been moved to Table files. Getter for Flag isPersistence which specifies the Persistency of the values of Trap Forwarding Table. By Default the Persistence to the fileSystem is turned ON.

    Returns:
    true if Persistence is turned on for TrapForwardingTable.
    See Also:
    setPersistence(boolean value)

    doRegistration

    protected void doRegistration()
    Does the Registration of the TrapForwarding Table to the PduRequestHandler Tree.
    Overrides:
    doRegistration in class BaseSnmpTrapService

    getTrapFlag

    public static boolean getTrapFlag()
    Deprecated. - as this method is no longer needed. This trapFlag is especially useful in sending trap if the agent registered as sub-agent with Windows master agent.

    If sendTrap method is called when the agent is running as WindowsSubAgent, then trap should be send through the master agent.So when sendTrap method is called this flag is set .The Aeadll.dll polls for this flag,if it is set, then the Aeadll calls the getTrapObject() ,by which it gives the trap information to the master agent and resets this flag.

    Returns:
    whether the trap flag is set.
    Since:
    AdventNet Agent Toolkit (Java/JMX Edition) 5.0
    See Also:
    setTrapFlag(boolean flag)

    setTrapFlag

    public static void setTrapFlag(boolean flag)
    Deprecated. - as this method is no longer needed. Sets the Trap Flag.

    This trapFlag is especially useful in sending trap if the agent registered as sub-agent with Windows master agent.

    If sendTrap method is called when the agent is running as WindowsSubAgent, then trap should be send through the master agent.So when sendTrap method is called this flag is set .The Aeadll.dll polls for this flag,if it is set, then the Aeadll calls the getTrapObject() ,by which it gives the trap information to the master agent and resets this flag.

    Parameters:
    flag - specifying the boolean value of registration of the Agent as a subAgent to Windows MasterAgent
    Since:
    AdventNet Agent Toolkit (Java/JMX Edition) 5.0
    See Also:
    getTrapFlag()

    setTrapObject

    public static void setTrapObject(NativeSnmpTrap trap)
    Deprecated. - as this method is no longer needed. sets the NativeSnmpTrap which holds the trap information when the trap is to be send through the windows master agent.

    Parameters:
    trap - The NativeSnmpTrap object
    Since:
    AdventNet Agent Toolkit (Java/JMX Edition) 5.0
    See Also:
    getTrapObject()

    getTrapObject

    public static NativeSnmpTrap getTrapObject()
    Deprecated. - as this method is no longer needed. gets the NativeSnmpTrap object

    If sendTrap method is called when the agent is running as WindowsSubAgent, then trap should be send through the master agent.So when sendTrap method is called this trapflag is set .The Aeadll.dll polls for this trapflag,if it is set, then the Aeadll calls the getTrapObject() ,by which it gives the trap information to the master agent and resets this trapflag.

    Returns:
    the trap object which has the trap information.
    Since:
    AdventNet Agent Toolkit (Java/JMX Edition) 5.0
    See Also:
    setTrapObject, NativeSnmpTrap

    nativeInitTrapService

    public void nativeInitTrapService()
    This method initialises the trap session and and puts the session in the cache. Used when the Agent is registered as subAgent to Windows Master Agent

    setFToVPersistence

    public void setFToVPersistence(boolean fToVPersistence)
    Deprecated. - persistence has been moved to ForwardingTable files.


    getSecurityLevel

    public byte getSecurityLevel()
    Getter for securityLevel of the SnmpV3 Trap to be sent when DEFAULT option is chosen
    Returns:
    securityLevel The securityLevel of the Trap PDU to be sent

    setSecurityLevel

    public void setSecurityLevel(byte securityLevel)
    Setter for securityLevel of the SnmpV3 Trap to be sent when DEFAULT option is chosen
    Parameters:
    securityLevel - The securityLevel of the Trap PDU to be sent

    setReliableTraps

    public void setReliableTraps(boolean isReliableTraps,
                                 int numRows)
    The Method added for the Reliable Traps Support. Enabling this will store the Traps sent by this service in the NotificationLogTable and NotifcationVarBindTables.
    Parameters:
    isReliableTraps - true to set the feature on.
    numRows - the int value of the mnumber of rows needed in the reliable trap table.
    See Also:
    NotificationLogTable, NotifcationVarBindTable

    setWriter

    public void setWriter(XMLToVector writer)
    Method to set the XMLToVector instance for storing the datas. API users need not use this method
    Parameters:
    writer - the XMLToVector instance.

    setHandler

    public void setHandler(SimpleTrapForwardingTable handler)
    Method to set the SimpleTrapForwardingTable Handler for this TrapService.
    Parameters:
    handler - The SimpleTrapForwardingTable 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
    Overrides:
    sendTrap in class BaseSnmpTrapService
    Parameters:
    entry - the Forwarding\V3Forwarding 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