com.adventnet.snmp.beans
Class AsyncV3HandShake

java.lang.Object
  extended by com.adventnet.snmp.beans.AsyncV3HandShake
All Implemented Interfaces:
SnmpClient, java.lang.Runnable

 class AsyncV3HandShake
extends java.lang.Object
implements SnmpClient, java.lang.Runnable

The purpose of this class is to perform discovery and timeSynchronization using asynchronous mechanism. This class implements SnmpClient and hence the response to discovery and timeSync is obtained in the callback. Once the timeSync is finished the client is removed from the session's client list.


Field Summary
(package private)  java.lang.String authPassword
           
(package private)  int authProtocol
           
(package private)  int discovMsgID
           
(package private)  SnmpEngineEntry e
           
(package private)  byte[] engineID
           
(package private)  SnmpEngineTable engineTable
           
(package private)  java.lang.String error
           
(package private)  java.util.Hashtable Hostport
           
(package private)  boolean newEntry
           
(package private) static SnmpOID NOT_TIME_WINDOWS_OID
           
(package private)  java.lang.String oldauthPassword
           
(package private)  int oldauthProtocol
           
(package private)  int oldboots
           
(package private)  java.lang.String oldprivPassword
           
(package private)  int oldtime
           
(package private)  ProtocolOptions options
           
(package private)  java.lang.String principal
           
(package private)  java.lang.String privPassword
           
(package private)  int privProtocol
           
(package private)  java.lang.String result
           
(package private)  SnmpServer server
           
(package private)  SnmpSession session
           
(package private)  java.lang.String targetHost
           
(package private)  int targetPort
           
(package private)  long time1
           
(package private)  int timeSyncMsgID
           
(package private)  USMUserEntry u
           
(package private)  USMUserTable usmTable
           
 
Constructor Summary
AsyncV3HandShake(SnmpServer server)
          Maintain the reference to SnmpServer, USMUserEntry, SnmpEngineEntry and SnmpSession
 
Method Summary
 boolean authenticate(SnmpPDU pdu, java.lang.String community)
          The client's authenticate method.
 boolean callback(SnmpSession session, SnmpPDU pdu, int requestID)
          The client's callback method.
 void debugPrint(java.lang.String s)
          The client's debugPrint method.
(package private)  void logErrorMessage(java.lang.String error)
          All the methods of this class, which needs to redirect an error message to the LogManger or to the standard console, can use this method.
(package private)  void logInfoMessage(java.lang.String info)
          All the methods of this class, which needs to redirect an info message to the LogManger or to the standard console, can use this method.
(package private)  void performDiscoveryTimeSync()
          Sends a discovery/timeSync request using asynchronous mechanism.
(package private)  void performTimeSync()
          Sends a timeSync request.
(package private)  void performTimeSync(byte[] EngineID)
          Sends a TimeSync request.
 void run()
           
(package private)  void setAuthPassword(java.lang.String passwd)
          Set the authPassword on this object.
(package private)  void setAuthProtocol(int protocol)
          Set the AuthProtocol to on this object.
(package private)  void setEngineID(byte[] eid)
          Set the engine ID on this object.
(package private)  void setPrincipal(java.lang.String user)
          Set the userName/Principal on this object.
(package private)  void setPrivPassword(java.lang.String passwd)
          Set the privPassword on this object.
(package private)  void setPrivProtocol(int protocol)
          Set the PrivProtocol to on this object.
(package private)  void setProtocolOptions(ProtocolOptions options)
          Set the ProtocolOptions on this object incase of transport mechanism other than UDP.
(package private)  void setTargetHost(java.lang.String host)
          Set the hostName on this object.
(package private)  void setTargetPort(int port)
          Set the port on this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

targetHost

java.lang.String targetHost

targetPort

int targetPort

options

ProtocolOptions options

principal

java.lang.String principal

engineID

byte[] engineID

authPassword

java.lang.String authPassword

privPassword

java.lang.String privPassword

authProtocol

int authProtocol

privProtocol

int privProtocol

time1

long time1

oldboots

int oldboots

oldtime

int oldtime

oldauthProtocol

int oldauthProtocol

oldauthPassword

java.lang.String oldauthPassword

oldprivPassword

java.lang.String oldprivPassword

newEntry

boolean newEntry

Hostport

java.util.Hashtable Hostport

engineTable

SnmpEngineTable engineTable

usmTable

USMUserTable usmTable

e

SnmpEngineEntry e

u

USMUserEntry u

server

SnmpServer server

session

SnmpSession session

discovMsgID

int discovMsgID

timeSyncMsgID

int timeSyncMsgID

result

java.lang.String result

error

java.lang.String error

NOT_TIME_WINDOWS_OID

static final SnmpOID NOT_TIME_WINDOWS_OID
Constructor Detail

AsyncV3HandShake

AsyncV3HandShake(SnmpServer server)
Maintain the reference to SnmpServer, USMUserEntry, SnmpEngineEntry and SnmpSession

Method Detail

debugPrint

public void debugPrint(java.lang.String s)
The client's debugPrint method.

Specified by:
debugPrint in interface SnmpClient

authenticate

public boolean authenticate(SnmpPDU pdu,
                            java.lang.String community)
The client's authenticate method. Lets return true as we we do the check in the callback

Specified by:
authenticate in interface SnmpClient

callback

public boolean callback(SnmpSession session,
                        SnmpPDU pdu,
                        int requestID)
The client's callback method. This will handle response to discovery, send timeSync request and handle the response to timeSync request. It also takes the responsibility to remove the client from the session's client list once the job is done.

Specified by:
callback in interface SnmpClient

performDiscoveryTimeSync

void performDiscoveryTimeSync()
Sends a discovery/timeSync request using asynchronous mechanism. Called from SnmpServer's async_create_v3_tables().


performTimeSync

void performTimeSync(byte[] EngineID)
Sends a TimeSync request.


performTimeSync

void performTimeSync()
Sends a timeSync request.


run

public void run()
Specified by:
run in interface java.lang.Runnable

setTargetHost

void setTargetHost(java.lang.String host)
Set the hostName on this object.

Parameters:
host - The hostName to be set on this object.

setTargetPort

void setTargetPort(int port)
Set the port on this object.

Parameters:
port - The port to be set on this object.

setProtocolOptions

void setProtocolOptions(ProtocolOptions options)
Set the ProtocolOptions on this object incase of transport mechanism other than UDP.

Parameters:
options - The ProtocolOptions to be set on this object.

setPrincipal

void setPrincipal(java.lang.String user)
Set the userName/Principal on this object.

Parameters:
user - The userName to be set on this object.

setAuthPassword

void setAuthPassword(java.lang.String passwd)
Set the authPassword on this object.

Parameters:
passwd - The authPassword to be set on this object.

setPrivPassword

void setPrivPassword(java.lang.String passwd)
Set the privPassword on this object.

Parameters:
passwd - The privPassword to be set on this object.

setEngineID

void setEngineID(byte[] eid)
Set the engine ID on this object.

Parameters:
byte - Array of engineID

setAuthProtocol

void setAuthProtocol(int protocol)
Set the AuthProtocol to on this object.

Parameters:
protocol - The authProtocol to be set on ths object.

setPrivProtocol

void setPrivProtocol(int protocol)
Set the PrivProtocol to on this object.

Parameters:
protocol - The privProtocol to be set on ths object.

logErrorMessage

void logErrorMessage(java.lang.String error)
All the methods of this class, which needs to redirect an error message to the LogManger or to the standard console, can use this method. - Mahesh


logInfoMessage

void logInfoMessage(java.lang.String info)
All the methods of this class, which needs to redirect an info message to the LogManger or to the standard console, can use this method. - Mahesh