com.adventnet.snmp.proxy
Class ProxyForwarder

java.lang.Object
  extended by java.lang.Thread
      extended by com.adventnet.snmp.proxy.ProxyForwarder
All Implemented Interfaces:
SnmpClient, java.lang.Runnable

public class ProxyForwarder
extends java.lang.Thread
implements SnmpClient


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
(package private)  SnmpTargetAddrTable addrTable
           
(package private)  SnmpSession agentSession
           
(package private)  SnmpAPI api
           
(package private)  int local_port
           
(package private)  SnmpSession managerSession
           
(package private)  SnmpTargetParamsTable paramsTable
           
(package private)  SnmpProxyTable proxyTable
           
(package private)  java.util.Vector v
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
ProxyForwarder(int localPort)
          Constructs a ProxyForwarder instance with the given localport.
ProxyForwarder(SnmpSession session, boolean debug)
          Constructs a ProxyForwarder object with the specified SnmpSession.
 
Method Summary
 boolean authenticate(SnmpPDU pdu, java.lang.String community)
          This is the SnmpClient method implementation used to authenicate a PDU.
 boolean callback(SnmpSession sess, SnmpPDU pdu, int reqID)
          This is the SnmpClient method implementation method that processes and forwards the result.
 void debugPrint(java.lang.String debugOutput)
          This is the SnmpClient method implementation that prints the standard output.
 boolean getDebug()
          Gets the debug flag on the SnmpAPI associated with this instance.
 SnmpProxyTable getSnmpProxyTable()
          Gets the SnmpProxyTable instance corresponding to this object.
 void run()
          The run method starts a seperate thread where processing of the packets received are done.
 void setDebug(boolean debug)
          Enables/disables the debug flag on the SnmpAPI associated with this instance.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

api

SnmpAPI api

managerSession

SnmpSession managerSession

agentSession

SnmpSession agentSession

v

java.util.Vector v

local_port

int local_port

addrTable

SnmpTargetAddrTable addrTable

proxyTable

SnmpProxyTable proxyTable

paramsTable

SnmpTargetParamsTable paramsTable
Constructor Detail

ProxyForwarder

public ProxyForwarder(int localPort)
Constructs a ProxyForwarder instance with the given localport. One SnmpAPI and SnmpSession will be created and the session the specified localPort will be set on this SnmpSession. Hence the session will be listening on the localPort specified.

Parameters:
localport - The port in which the agentsession will be listening.

ProxyForwarder

public ProxyForwarder(SnmpSession session,
                      boolean debug)
Constructs a ProxyForwarder object with the specified SnmpSession.

Parameters:
session - The SnmpSession that is used on the agent side.
debug - The debug flag to be set on the SnmpAPI instance.
Method Detail

setDebug

public void setDebug(boolean debug)
Enables/disables the debug flag on the SnmpAPI associated with this instance.

Parameters:
debug - The debug value to be set.

getDebug

public boolean getDebug()
Gets the debug flag on the SnmpAPI associated with this instance.

Returns:
true if the debug flag is set on the SnmpAPI associated with this instance, else false.

getSnmpProxyTable

public SnmpProxyTable getSnmpProxyTable()
Gets the SnmpProxyTable instance corresponding to this object.

Returns:
The SnmpProxyTable instance associated with this object.

authenticate

public boolean authenticate(SnmpPDU pdu,
                            java.lang.String community)
This is the SnmpClient method implementation used to authenicate a PDU.

Specified by:
authenticate in interface SnmpClient
Returns:
false when authentication fails in the case of V3.

callback

public boolean callback(SnmpSession sess,
                        SnmpPDU pdu,
                        int reqID)
This is the SnmpClient method implementation method that processes and forwards the result.

Specified by:
callback in interface SnmpClient
Returns:
true always. The pdu received will be enqueued and processed.

debugPrint

public void debugPrint(java.lang.String debugOutput)
This is the SnmpClient method implementation that prints the standard output.

Specified by:
debugPrint in interface SnmpClient

run

public void run()
The run method starts a seperate thread where processing of the packets received are done. The API user need not call this method explicitly.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread