com.adventnet.snmp.mibs.agent
Class TrapForwardingTable

java.lang.Object
  |
  +--com.adventnet.snmp.mibs.agent.TrapForwardingTable

public class TrapForwardingTable
extends java.lang.Object
implements TrapForwardingTableInterface, SnmpAgentData, GetNextSupported, InitSnmpAgentData

Implements a TrapForwardingTable where managers could register themselves for listening to traps. Mangers would register in the table using SNMP

This requires the MIBs to be loaded

We are using rowId for sake of simplicity but you could use combination as key


Field Summary
(package private)  AgentTableModel model
          The AgentTableModel which stores manager rows
(package private)  int[] tableOID
           
 
Constructor Summary
TrapForwardingTable()
           
 
Method Summary
(package private)  java.lang.String addRow(java.util.Vector vars)
           
 ForwardingEntry getForwardingEntry(int index)
          Gets the Entry at the given index.
 SnmpVar getNextReqMesg(int[] OID, SnmpVarBind varbind)
          the getNextReqMesg of SnmpAgentData interface .
 int getNumRows()
          returns no rows (managers) registered for receiving traps.
 java.lang.String getReqMesg(int[] OID)
          The getReqMesg of SnmpAgentData interface.
 java.lang.String getV1v2ManagerHost(int index)
          return the Manager to which trap is to be sent return null if there is no manager for the index
 int getV1v2ManagerPort(int index)
          The manager port to which we need to send the Traps to
 int getV1v2ManagerStatus(int index)
          return rowSatus of the Row.
 void init(AgentMibNode agentMibNode, java.lang.String parameters)
          Method creates a AgentTableModel object and assigns the table OID from the Node.
(package private)  SnmpVar processGetReq(TrapForwardingEntry entry, int nodeOID)
           
(package private)  SnmpVar processSetReq(TrapForwardingEntry entry, SnmpVar var, int nodeOID)
           
 java.lang.String setReqMesg(int[] OID, java.util.Vector snmpvars)
          Sets the new value to the coresponding OID.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tableOID

int[] tableOID

model

AgentTableModel model
The AgentTableModel which stores manager rows
Constructor Detail

TrapForwardingTable

public TrapForwardingTable()
Method Detail

init

public void init(AgentMibNode agentMibNode,
                 java.lang.String parameters)
Method creates a AgentTableModel object and assigns the table OID from the Node.
Specified by:
init in interface InitSnmpAgentData
Tags copied from interface: InitSnmpAgentData
Parameters:
node - at which this class command is located, parameters specified in 'PARAMETERS' in the AGENTCLAUSE

getReqMesg

public java.lang.String getReqMesg(int[] OID)
                            throws AgentSnmpException
The getReqMesg of SnmpAgentData interface. returns the value for the specific OID.
Specified by:
getReqMesg in interface SnmpAgentData
Tags copied from interface: SnmpAgentData
Parameters:
OID - requested OId
Returns:
response in string-form
Throws:
AgentSnmpException - if any problem is encountered

getNextReqMesg

public SnmpVar getNextReqMesg(int[] OID,
                              SnmpVarBind varbind)
                       throws AgentNoNextObject,
                              AgentSnmpException
the getNextReqMesg of SnmpAgentData interface . returns next valid objects valuse of specic OID.
Specified by:
getNextReqMesg in interface GetNextSupported
Tags copied from interface: GetNextSupported
Throws:
AgentSnmpException - Just to report general errors
AgentNoNextObject - in following two cases:
  1. End of mibfile encountered(The node is the last in the mibfile)
  2. or
  3. End of table if the class is implementing a table

setReqMesg

public java.lang.String setReqMesg(int[] OID,
                                   java.util.Vector snmpvars)
                            throws AgentSnmpException
Sets the new value to the coresponding OID. Throws AgentSnmpException , when it fails.
Specified by:
setReqMesg in interface SnmpAgentData
Tags copied from interface: SnmpAgentData
Parameters:
OID - requested OId
snmpvars - Vector of values to be set
Returns:
response in string-form
Throws:
AgentSnmpException - if any problem is encountered

processGetReq

SnmpVar processGetReq(TrapForwardingEntry entry,
                      int nodeOID)
                throws AgentSnmpException

processSetReq

SnmpVar processSetReq(TrapForwardingEntry entry,
                      SnmpVar var,
                      int nodeOID)
                throws AgentSnmpException

addRow

java.lang.String addRow(java.util.Vector vars)
                  throws AgentSnmpException

getNumRows

public int getNumRows()
returns no rows (managers) registered for receiving traps.
Specified by:
getNumRows in interface TrapForwardingTableInterface
Returns:
number of rows in the Table

getV1v2ManagerHost

public java.lang.String getV1v2ManagerHost(int index)
return the Manager to which trap is to be sent return null if there is no manager for the index
Specified by:
getV1v2ManagerHost in interface TrapForwardingTableInterface
Tags copied from interface: TrapForwardingTableInterface
Parameters:
index - The index of the table.
Returns:
The Manager to which trap is to be sent, null if there is no manager for the index.

getV1v2ManagerPort

public int getV1v2ManagerPort(int index)
The manager port to which we need to send the Traps to
Specified by:
getV1v2ManagerPort in interface TrapForwardingTableInterface
Parameters:
row - index Note: if a -1 is returned port is assumed to be 162

getV1v2ManagerStatus

public int getV1v2ManagerStatus(int index)
return rowSatus of the Row. return 1 if active (even though rowstatus may not be present)
Specified by:
getV1v2ManagerStatus in interface TrapForwardingTableInterface
Tags copied from interface: TrapForwardingTableInterface
Parameters:
index - The index to which row status is to required.
Returns:
rowSatus of the value of the Row.
return 1 if active. (even though rowstatus may not be present)

getForwardingEntry

public ForwardingEntry getForwardingEntry(int index)
Description copied from interface: TrapForwardingTableInterface
Gets the Entry at the given index.
Specified by:
getForwardingEntry in interface TrapForwardingTableInterface
Tags copied from interface: TrapForwardingTableInterface
Parameters:
index - the index for which the Entry is required.
Returns:
The ForwardingEntry at the Given Index else a null.