|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.lang.Thread | +--com.adventnet.snmp.snmp2.SnmpSession
SnmpSession is the basic communication class for performing any SNMP operations. This class extends "java.lang.Thread". This thread is the receiver thread of AdventNet SNMP API stack. This thread receives packets, decodes them and form SnmpPDU objects.
This class is thread safe. That is, a single instance of SnmpSession can be used simultaneously by a large number of threads to do SNMP operations. So there is really less need to instantiate a number of SnmpSession objects.
Some of the important features that this class has are:
The Asynchronous way of sending SNMP requests. The method "send(SnmpPDU)" can be used to send such asynchronous requests to the desired host/port. To receive the response, the SnmpClient interface should be implemented and add it using the method "addSnmpClientWithID". This method returns a id, which can be set on the SnmpPDU object before sending a request. By doing this, only that particular client will be called with the response, otherwise all the clients that has been added to this SnmpSession will be informed with the response.
The Synchronous way of sending SNMP requests. The method "syncSend(SnmpPDU)" can be used for this purpose. This method waits till the response arrives or till timeout.
Any SnmpTransportProvider implementation can be plugged into this class. The interface that should be used for this implementation is SnmpTransportProvider. By default the underlying protocol used is UDP. AdventNet SNMP API stack also provides implementation for TCP. The method "setTransportProvider(String)" can be used to set the implementation class name.
Any SNMP network management Applet can be written using this class.
While performing asynchronous SNMP operations, a delay between packets that are sent into the network can be achieved by using the method "setTimeToWait(int)". This will ensure that each packet is sent out with the specified delay.
Every request that is sent out will wait for the response till a specified timeout value. The default value of this timeout is 5 seconds. In case of retries, the timeout value increase exponentially. This timeout policy for retries can be plugged in by using the abstract class TimeoutPolicy. The "setTimeoutPolicy(TimeoutPolicy)" method can be used to achieve this.
Every response received will be given to the "callback" method of SnmpClient. Further processing will be done in the "callback" method. During this processing time some packets may get dropped. To minimize this packet loss, a separate processing thread called the "CALLBACK" thread is provided. This thread can be started by calling the method "setCallbackthread(boolean)" with the "true" value.
A sample code snippet of how to create a SnmpSession object.
SnmpAPI api = new SnmpAPI();
SnmpSession session = new SnmpSession(api);
session.open();
SnmpPDU pdu = new SnmpPDU();
pdu.setRemoteHost("localhost");
pdu.setCommand(SnmpAPI.GET_REQ_MSG);
pdu.addNull(new SnmpOID(".1.3.6.1.2.1.1.1.0"));
SnmpPDU response_pdu = session.syncSend(pdu);
if(response_pdu == null)
{
System.out.println("The Request has timed out.");
}
else
{
System.out.println(response_pdu.printVarBinds());
}
The output for the above program will be
Object ID: .1.3.6.1.2.1.1.1.0
STRING: Linux localhost 2.4.2-2 #1 Sun Apr 8 20:41:30 EDT 2001 i686
An instance of SnmpSession cannot be reused after calling the close method. That is the following code will not work:
SnmpSession session = new SnmpSession(api); session.open(); session.send(pdu); session.close(); session.open(); // This is not allowed. session.send(pdu); // This will not work.
SnmpPDU
, Serialized FormField Summary | |
static int |
IP
Deprecated. Since all the SNMP communications go through a single transport provider, this is not needed. |
static int |
TRANSPORT_PROVIDER
Deprecated. Since all the SNMP communications go through a single transport provider, this is not needed. |
Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
SnmpSession(SnmpAPI api)
Creates a new SnmpSession object by taking the SnmpAPI instance. |
Method Summary | |
void |
addSnmpClient(SnmpClient client)
Subscribe for callbacks. |
int |
addSnmpClientWithID(SnmpClient client)
Subscribes for callbacks. |
int[] |
checkResponses()
Checks for any outstanding responses that are still in the receive queue. |
boolean |
checkTimeout(int reqid)
Returns true if the reqid is in the list of this session's timed out requests, and removes it from the list. |
void |
close()
Close Snmp Session and stop receiver thread. |
SnmpVar |
get(SnmpOID oid)
Deprecated. use the following instead
SnmpPDU pdu = new SnmpPDU();
|
SnmpVar |
get(java.lang.String oidString)
Deprecated. use the following instead
SnmpPDU pdu = new SnmpPDU();
|
java.lang.String |
getCommunity()
Gets community for outgoing SNMPv1 and SNMPv2c requests. |
ConnectionListener |
getConnectionListener()
To get reference to the ConnectionListener object. |
byte[] |
getContextName()
Gets the context name associated with the SNMPv3 message. |
java.lang.String[] |
getLocalAddresses()
Deprecated. use the following instead. UDPProtocolOptions opt = (UDPProtocolOptions)snmpSession.getProtocolOptions(); String[] local_address = opt.getLocalAddresses(); |
int |
getLocalPort()
Deprecated. use the following instead.
UDPProtocolOptions opt = (UDPProtocolOptions)snmpSession.getProtocolOptions();
|
SnmpVar |
getnext(SnmpOID oid)
Deprecated. use the following instead
SnmpPDU pdu = new SnmpPDU();
|
SnmpVar |
getnext(java.lang.String oidString)
Deprecated. use the following instead
SnmpPDU pdu = new SnmpPDU();
|
int |
getPacketBufferSize()
Gets the Datagram Buffer Size used for receiving SNMP packets. |
java.lang.String |
getPeername()
Deprecated. use the following instead. UDPProtocolOptions opt = (UDPProtocolOptions)snmpSession.getProtocolOptions(); opt.getRemoteHost(); |
int |
getProtocol()
Deprecated. since all SNMP communications go through only a transportProvider, this method is not at all necessary. |
ProtocolOptions |
getProtocolOptions()
This method will return the ProtocolOptions associated with this SnmpSession. |
int |
getReceiveBufferSize()
Deprecated. instead use the getReceiveBufferSize method available in UDPProtocolOptions. |
int |
getRemotePort()
Deprecated. use the following instead.
UDPProtocolOptions opt = (UDPProtocolOptions)snmpSession.getProtocolOptions();
|
boolean |
getReport()
Returns the status of report flag. |
int |
getRetries()
Gets number of retries before timeout. |
SASClient |
getSASClient()
Deprecated. use the following instead SASProtocolOptions opt = (SASProtocolOptions)snmpSession.getProtocolOptions(); SASClient sasclient = opt.getSASClient(); |
int |
getSASProtocol()
Deprecated. use the following instead.
SASProtocolOptions opt = (SASProtocolOptions)snmpSession.getProtocolOptions();
|
byte |
getSecLevelForTimeSync()
Returns the securitylevel that would be used when doing a V3 timeSync for a authPriv user. |
SnmpAPI |
getSnmpAPI()
Returns the SnmpAPI reference associated with this SnmpSession. |
java.util.Vector |
getSnmpClients()
Returns the clients that have been registered for callbacks or null is returned if no one is registered. |
int |
getSnmpClientsSize()
Deprecated. use the following instead int snmpClientsSize = (snmpSession.getSnmpClients()).size(); |
java.util.Hashtable |
getSnmpClientsWithID()
Returns the hashtable in which the clientID and the SnmpClient are associated. |
int |
getStartLocalPort()
Deprecated. now the "open(Applet)" method will throw an SnmpException if it is unable to connect to the SAServer. When such an exception is received, the user should decide whether "open(void)" method should be called or not. |
int |
getTimeout()
Gets the timeout value. |
int |
getTimeToWait()
Gets the inter-packet delay time set on this SnmpSession object. |
java.lang.String |
getTransportProvider()
This method gets the transportProvier classname. |
byte[] |
getUserName()
Returns the principal for SNMPv3 messages. |
int |
getVersion()
Gets snmp version for outgoing SNMP requests. |
java.lang.String |
getWriteCommunity()
Gets writeCommunity for outgoing requests. |
boolean |
isSessionEstablished()
To get the status of the connection established using this session instance. |
boolean |
isSetAutoInformResponse()
Checks if the automatic response flag for the Inform Request is set. |
boolean |
isTrapAuthEnable()
Gets status of Trap Authentication for v3 pdus. |
void |
open()
Opens Snmp Session to communicate with an SNMP peer. |
void |
open(java.applet.Applet applet)
Deprecated. use the following instead
SnmpAPI api = new SnmpAPI();
|
java.util.Hashtable |
partialSet(SnmpOID[] oids,
SnmpVar[] vars)
SNMP set request method is for multiple SnmpOID argument. |
java.util.Hashtable |
partialSet(SnmpPDU pdu)
SNMP set request method is for multiple SnmpOID argument. |
SnmpPDU |
receive(int reqid)
Fetches SNMP response PDU, fetches first PDU in response queue, if reqid is 0. |
void |
removeAllSnmpClients()
This method removes all the SnmpClients that were registered in this SnmpSession. |
void |
removeConnectionListener()
Unsubscribes for ConnectionListener. |
void |
removeSnmpClient(SnmpClient client)
Unsubscribes for callbacks. |
void |
removeSnmpClientWithID(int clientid)
Unsubscribe for callbacks. |
void |
restoreDefaultTimeoutPolicy()
restores this SnmpSession object to have the default TimeoutPolicy. |
void |
run()
The run method starts the receiver thread for this session object. |
int |
send(SnmpPDU pdu)
Send SnmpPDU on the given session after encoding the PDU. |
java.util.Vector |
sendNotification(SnmpPDU pdu)
Authenticates and sends the notification to all the entries that can avail of the notification filtering facility. |
SnmpVar |
set(SnmpOID oid,
SnmpVar var)
Deprecated. use the following instead
SnmpPDU pdu = new SnmpPDU();
|
SnmpVar |
set(java.lang.String oidString,
java.lang.String setString,
byte type)
Deprecated. use the following instead
SnmpPDU pdu = new SnmpPDU();
|
void |
setAutoInformResponse(boolean flag)
Sets the automatic response flag for the Inform Request. |
void |
setCallbackthread(boolean useThread)
Sets this to true if the user wants the callback to be called from a seperate thread. |
void |
setCommunity(java.lang.String community)
Sets community for outgoing SNMPv1 and SNMPv2c requests. |
void |
setConnectionListener(ConnectionListener connListener)
Subscribes for ConnectionListener. |
void |
setContextName(byte[] name)
Sets the context name associated with the SNMPv3 message. |
void |
setLocalAddresses(java.lang.String[] local_addrs)
Deprecated. use the following instead. UDPProtocolOptions opt = (UDPProtocolOptions)snmpSession.getProtocolOptions(); opt.setLocalAddresses(local_addrs); |
void |
setLocalPort(int local_port)
Deprecated. use the following instead.
UDPProtocolOptions opt = (UDPProtocolOptions)snmpSession.getProtocolOptions();
|
void |
setPacketBufferSize(int size)
Sets the Datagram Buffer Size used for receiving SNMP packets. |
void |
setPeername(java.lang.String peername)
Deprecated. use the following instead. UDPProtocolOptions opt = (UDPProtocolOptions)snmpSession.getProtocolOptions(); opt.setRemoteHost(peername); |
void |
setProtocol(int protocol)
Deprecated. Since all the SNMP communications go through a single transport provider, this is not needed. |
void |
setProtocolOptions(ProtocolOptions tParam)
This associates the ProtocolOptions with this SnmpSession. |
void |
setReceiveBufferSize(int bufferSize)
Deprecated. instead use the setReceiveBufferSize method available in UDPProtocolOptions. |
void |
setRemotePort(int port)
Deprecated. use the following instead.
UDPProtocolOptions opt = (UDPProtocolOptions)snmpSession.getProtocolOptions();
|
void |
setReport(boolean status)
Sets the status of report flag. |
void |
setRetries(int retries)
Sets number of retries before timeout. |
void |
setSASProtocol(int prot)
Deprecated. use the following instead.
SASProtocolOptions opt = new SASProtocolOptions();
|
void |
setSecLevelForTimeSync(byte secLevel)
Sets the securityLevel to use when doing a V3 timeSync for a authPriv user. |
void |
setSocketParms(int socketTimeout,
int socketDelay)
Deprecated. since a new transportProvider implementation for udp has been added, this method no longer becomes necessary. |
void |
setStartLocalPort(int startLocalPort)
Deprecated. now the "open(Applet)" method will throw an SnmpException if it is unable to connect to the SAServer. When such an exception is received, the user should decide whether "open(void)" method should be called or not. |
void |
setTimeout(int timeout)
Sets the timeout value. |
void |
setTimeoutPolicy(TimeoutPolicy timeoutPolicy)
sets the TimeoutPolicy for this SnmpSession. |
void |
setTimeToWait(int waitTime)
Sets the inter-packet delay time. |
void |
setTransportProvider(java.lang.String providerClassName)
This method sets the transportProvider classname, which will be used for communication purposes. |
void |
setTrapAuthEnable(boolean isAuth)
Specify whether traps should be authenticated while receiving SNMPv3 trap messages. |
void |
setUserName(byte[] name)
Sets the principal for SNMPv3 messages. |
void |
setVersion(int version)
Sets snmp version for outgoing requests. |
void |
setWriteCommunity(java.lang.String writeCommunity)
Sets writeCommunity for outgoing requests. |
SnmpPDU |
syncSend(SnmpPDU pdu)
Send SnmpPDU synchronously - returns response SnmpPDU and throws SnmpException on failure, including timeout on SNMP response. |
Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, 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 |
public static final int IP
public static final int TRANSPORT_PROVIDER
Constructor Detail |
public SnmpSession(SnmpAPI api)
api
- The instance of SnmpAPIMethod Detail |
public int getVersion()
It is to be noted that when an application sends an SNMPv1 pdu using a session whose version is set to SNMP_VERSION_3, an SNMPv3 message is sent to the peer. This problem arises because the API uses SNMP_VERSION_1 as the default pdu version and it could not distinguish between applications leaving the version in pdu to default and setting it explicitly to SNMP_VERSION_1. To circumvent this problem, applications should set session version to SNMP_VERSION_1 and set the pdu version explicitly to SNMP_VERSION_2C or SNMP_VERSION_3 while communicating with v2c and v3 peers.
public void setVersion(int version)
It is to be noted that when an application sends an SNMPv1 pdu using a session whose version is set to SNMP_VERSION_3, an SNMPv3 message is sent to the peer. This problem arises, because the API uses SNMP_VERSION_1 as the default pdu version and it could not distinguish between applications leaving the version in pdu to default and setting it explicitly to SNMP_VERSION_1. To circumvent this problem, applications should set session version to SNMP_VERSION_1 and set the pdu version explicitly to SNMP_VERSION_2C or SNMP_VERSION_3, while communicating with v2c and v3 peers.
version
- The version of the outgoing SNMP request.public int getReceiveBufferSize() throws java.net.SocketException
java.net.SocketException
- if there is an error in
the underlying protocol, such as a UDP error.NoSuchMethodError
- if this method is
invoked while using JDK lesser than 1.2. The
reason is the getReceiveBufferSize method has been
added in java.net.DatagramSocket only in JDK1.2 and
above.public void setReceiveBufferSize(int bufferSize) throws java.lang.IllegalArgumentException, java.net.SocketException
bufferSize
- the buffer Size that is to be
set on the datagramSocket.java.lang.IllegalArgumentException
- if the bufferSize
is
0 or is negative.java.net.SocketException
- if there is an error in
the underlying protocol, such as a UDP error.NoSuchMethodError
- if this method is
invoked while using JDK lesser than 1.2. The
reason is the setReceiveBufferSize method has been
added in java.net.DatagramSocket only in JDK1.2 and
above.public void setCallbackthread(boolean useThread)
The performance of the receiver thread in receiving responses or traps is little bit poorer,If we invoke the callback from a separate thread. In order to be called back when a response is received, applications should implement the SnmpClient interface and register with the SnmpSession, using the addSnmpClient() method.
SnmpClient
public java.lang.String getCommunity()
public void setCommunity(java.lang.String community)
couumnity
- The community for the outgoing SNMPv1 or SNMPv2c
messages.public java.lang.String getWriteCommunity()
public void setWriteCommunity(java.lang.String writeCommunity)
writeCommunity
- The writeCommunity for the outgoing SNMPv1
or SNMPv2c messages.public int getRetries()
public void setRetries(int retries)
retries
- The retries value to be used by the session.public void setSASProtocol(int prot)
SASProtocolOptions opt = new SASProtocolOptions();
opt.setApplet(applet);
opt.setProtocol(SASClient.TCP_PROTOCOL); //or SASClient.HTTP_PROTOCOL
snmpSession.setProtocolOptions(opt);
snmpSession.open();
prot
- the protocol that is to be used for SNMP communications.public int getSASProtocol()
SASProtocolOptions opt = (SASProtocolOptions)snmpSession.getProtocolOptions();
int sasprotocol = opt.getProtocol();
public int getTimeout()
public void setTimeout(int timeout)
timeout
- The timeout value to be used for monitoring the
SNMP requests.public byte getSecLevelForTimeSync()
public void setSecLevelForTimeSync(byte secLevel)
secLevel
- The securityLevelpublic byte[] getUserName()
public void setUserName(byte[] name)
name
- The principal for SNMPv3 messages.public void setContextName(byte[] name)
name
- the contextName associated with the SNMPv3 message.public byte[] getContextName()
public void setTrapAuthEnable(boolean isAuth)
isAuth
- Set this to true if traps should be authenticated
while receiving SNMPv3 trap messages. False otherwise.public boolean isTrapAuthEnable()
public int getPacketBufferSize()
public void setPacketBufferSize(int size)
size
- The size of the datagram packet buffer to be used in bytes.
An initial allocation of 64K is made by default.public java.lang.String getPeername()
public void setPeername(java.lang.String peername)
peername
- the peername to which the SNMP communications
should take place.public int getRemotePort()
UDPProtocolOptions opt = (UDPProtocolOptions)snmpSession.getProtocolOptions();
opt.getRemotePort();
public void setRemotePort(int port)
UDPProtocolOptions opt = (UDPProtocolOptions)snmpSession.getProtocolOptions();
opt.setRemotePort(port);
port
- The remote port on the peer that this session is used to
communicate.public boolean getReport()
public void setReport(boolean status)
public java.lang.String[] getLocalAddresses()
public void setLocalAddresses(java.lang.String[] local_addrs)
local_addrs
- An array of Strings which contain the address
to which the session is bound. Only the address in the last String
is bound to the session.public int getLocalPort()
UDPProtocolOptions opt = (UDPProtocolOptions)snmpSession.getProtocolOptions();
int local_port = opt.getLocalPort();
public void setLocalPort(int local_port)
UDPProtocolOptions opt = (UDPProtocolOptions)snmpSession.getProtocolOptions();
opt.setLocalPort(local_port);
local_port
- The port number on which the datagram packets
are to be sent and received in this session.public int getStartLocalPort()
public void setStartLocalPort(int startLocalPort)
startLocalPort
- The port at which to send and receive
datagram packets in case of applets using IE4.0.public SASClient getSASClient()
public java.util.Vector getSnmpClients()
public int getSnmpClientsSize()
int snmpClientsSize = (snmpSession.getSnmpClients()).size();
public java.util.Hashtable getSnmpClientsWithID()
public void addSnmpClient(SnmpClient client)
SnmpClient
public int addSnmpClientWithID(SnmpClient client)
SnmpClient
public void removeSnmpClient(SnmpClient client)
SnmpClient
public void removeAllSnmpClients()
public void removeSnmpClientWithID(int clientid)
id
- that the client has got while calling
addSnmpClientWithID() method.public void setProtocol(int protocol)
protocol
- The value for identifying the IP
protocol. The constant value for IP is provided in this class.public void setAutoInformResponse(boolean flag)
flag
- boolean value of the flag to be set.public boolean isSetAutoInformResponse()
public SnmpAPI getSnmpAPI()
public void run()
run
in class java.lang.Thread
public void open() throws SnmpException
SnmpException
- is thrown on socket error.SnmpException
public void setTransportProvider(java.lang.String providerClassName)
providerClassName
- The class name of the transport provider,
through which the SNMP communication will take place.public java.lang.String getTransportProvider()
public void open(java.applet.Applet applet) throws SnmpException
SnmpAPI api = new SnmpAPI();
SnmpSession ses = new SnmpSession(api);
SASProtocolOptions opt = new SASProtocolOptions();
opt.setApplet(applet);
ses.setProtocolOptions(opt);
ses.open();
the
- applet instance needed to create a SASClient.SnmpException
- is thrown on socket error.SASClient
public void setTimeoutPolicy(TimeoutPolicy timeoutPolicy)
timeoutPolicy
- this is the user's own
implementation of TimeoutPolicypublic void restoreDefaultTimeoutPolicy()
public void close()
public int send(SnmpPDU pdu) throws SnmpException
pdu
- The instance of SnmpPDUSnmpException
- is thrown on send error.public SnmpPDU syncSend(SnmpPDU pdu) throws SnmpException
pdu
- The SnmpPDU that is to be sent.SnmpException
- is thrown on send error.public SnmpVar get(java.lang.String oidString) throws SnmpException
SnmpPDU pdu = new SnmpPDU();
pdu.addNull(new SnmpOID(oidString));
pdu.setCommand(SnmpAPI.GET_REQ_MSG);
SnmpPDU response_pdu = snmpSession.syncSend(pdu);
SnmpVar var = null;
if(response_pdu != null)
{
var = response_pdu.getVariable(0);
}
SnmpException
- is thrown on error.public SnmpVar get(SnmpOID oid) throws SnmpException
SnmpPDU pdu = new SnmpPDU();
pdu.addNull(oid);
pdu.setCommand(SnmpAPI.GET_REQ_MSG);
SnmpPDU response_pdu = snmpSession.syncSend(pdu);
SnmpVar var = null;
if(response_pdu != null)
{
var = response_pdu.getVariable(0);
}
SnmpException
- is thrown on error.public SnmpVar getnext(java.lang.String oidString) throws SnmpException
SnmpPDU pdu = new SnmpPDU();
pdu.addNull(new SnmpOID(oidString));
pdu.setCommand(SnmpAPI.GETNEXT_REQ_MSG);
SnmpPDU response_pdu = snmpSession.syncSend(pdu);
SnmpVar var = null;
if(response_pdu != null)
{
var = response_pdu.getVariable(0);
}
SnmpException
- is thrown on error.public SnmpVar getnext(SnmpOID oid) throws SnmpException
SnmpPDU pdu = new SnmpPDU();
pdu.addNull(oid);
pdu.setCommand(SnmpAPI.GETNEXT_REQ_MSG);
SnmpPDU response_pdu = snmpSession.syncSend(pdu);
SnmpVar var = null;
if(response_pdu != null)
{
var = response_pdu.getVariable(0);
}
SnmpException
- is thrown on error.public SnmpVar set(java.lang.String oidString, java.lang.String setString, byte type) throws SnmpException
SnmpPDU pdu = new SnmpPDU();
SnmpVar variable = SnmpVar.createVariable(setString, type);
SnmpOID oid = new SnmpOID(oidString);
SnmpVarBind varbind = new SnmpVarBind(oid, variable);
pdu.addVariableBinding(varbind);
pdu.setCommand(SnmpAPI.SET_REQ_MSG);
SnmpPDU response_pdu = snmpSession.syncSend(pdu);
SnmpVar var = null;
if(response_pdu != null)
{
var = response_pdu.getVariable(0);
}
oidString
- The String oid.setString
- String value.type
- Type of the variableSnmpException
- is thrown on error.public SnmpVar set(SnmpOID oid, SnmpVar var) throws SnmpException
SnmpPDU pdu = new SnmpPDU();
SnmpVarBind varbind = new SnmpVarBind(oid, var);
pdu.addVariableBinding(varbind);
pdu.setCommand(SnmpAPI.SET_REQ_MSG);
SnmpPDU response_pdu = snmpSession.syncSend(pdu);
SnmpVar response_var = null;
if(response_pdu != null)
{
response_var = response_pdu.getVariable(0);
}
oidString
- The String oid.var
- The SnmpVar ,the variable.SnmpException
- is thrown on error.public java.util.Hashtable partialSet(SnmpOID[] oids, SnmpVar[] vars) throws SnmpException
oids
- The array of SnmpOID.vars
- The array of SnmpVar.SnmpException
- is thrown on error.public java.util.Hashtable partialSet(SnmpPDU pdu) throws SnmpException
pdu
- SnmpPDU.SnmpException
- is thrown on error.public SnmpPDU receive(int reqid)
reqid
- The request id.public boolean checkTimeout(int reqid)
reqid
- The request id.public int[] checkResponses()
public void setSocketParms(int socketTimeout, int socketDelay)
socketTimeout
- The timeout for the socket in mssocketDelay
- The delay in mspublic void setProtocolOptions(ProtocolOptions tParam)
tParam
- ProtocolOptions to be set.public ProtocolOptions getProtocolOptions()
public int getProtocol()
public void setConnectionListener(ConnectionListener connListener)
connListener
- - ConnectionListener instance.ConnectionListener
public void removeConnectionListener()
public ConnectionListener getConnectionListener()
ConnectionListener
public boolean isSessionEstablished()
public java.util.Vector sendNotification(SnmpPDU pdu) throws SnmpException
pdu
- The SnmpPDU instance that contains the SnmpOID to be used for
notification filtering.public void setTimeToWait(int waitTime)
waitTime
- The inter-packet delay time.
Warning : This method should be used only when the underlying
protocol is UDP.The timeout value to be set for the request
should be taken care by the user.public int getTimeToWait()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |