|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.adventnet.snmp.snmp2.SASProtocolOptions
This class is the implementation of ProtocolOptions for
SAS implementation of SnmpTransportProvider.
This class is useful for opening the session and
setting the parameters for sending any SNMP request.
This class should be instantiated and the required values
should be set before setting this instance in the
SnmpSession. Only after, setting this instance in the
SnmpSession, the open method of SnmpSession should be
called in case of applets.
For example, opening the SnmpSession object
SASProtocolOption opt = new SASProtocolOptions(remoteHost,remotePort,applet);
SnmpSession session = new SnmpSession(api);
session.setProtocolOptions(opt);
try
{
session.open();
}
catch(SnmpException ex)
{
ex.printStackTrace();
}
Similarly for sending a SNMP request:
SASProtocolOptions opt = new SASProtoclOptions(remoteHost,remotePort);
pdu.setProtocolOptions(opt);
try
{
session.syncSend(pdu);
}
catch(SnmpException ex)
{
ex.printStackTrace();
}
Constructor Summary | |
SASProtocolOptions()
Initializes the variables for this instance of SASProtocolOptions. |
|
SASProtocolOptions(java.lang.String remoteHost,
int remotePort)
Initializes the variables for this instance of SASProtocolOptions. |
|
SASProtocolOptions(java.lang.String remoteHost,
int remotePort,
java.applet.Applet applet)
Initializes the variables for this instance of SASProtocolOptions. |
Method Summary | |
java.applet.Applet |
getApplet()
gets the applet instance. |
int |
getLocalPort()
gets the localport at which the sasclient is started. |
int |
getProtocol()
gets the protocol. |
java.lang.String |
getRemoteHost()
gets the remoteHost of this ProtocolOptions obeject. |
int |
getRemotePort()
gets the remotePort for this object. |
SASClient |
getSASClient()
gets the SASClient instance. |
java.lang.String |
getSessionId()
gets the session id for this ProtocolOptions obejct. |
void |
setApplet(java.applet.Applet app)
sets the applet instance for this protocoloptions. |
void |
setLocalPort(int port)
sets the localport at which this sasclient should be started. |
void |
setProtocol(int prot)
sets the protocol value. |
void |
setRemoteHost(java.lang.String host)
sets the remote host. |
void |
setRemotePort(int port)
sets the remotePort. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public SASProtocolOptions()
public SASProtocolOptions(java.lang.String remoteHost, int remotePort, java.applet.Applet applet)
SASProtocolOption sasOpt = new SASProtocolOptions(remoteHost,remotePort,applet); SnmpSession session = new SnmpSession(api); session.setProtocolOption(sasOpt); try { session.open(); } catch(SnmpException ex) { ex.printStackTrace(); }
remoteHost
- the host to which a packet should be sent.remotePort
- the port to which a packet should be sent.app
- the applet instance which is to be set.java.lang.IllegalArgumentException
- remoteHost
is null or empty.
remotePort
is negative or greater than 65535.
public SASProtocolOptions(java.lang.String remoteHost, int remotePort)
pdu.setProtocolOptions(new SASProtoclOptions(remoteHost,remotePort)); try { session.syncSend(pdu); } catch(SnmpException ex) { ex.printStackTrace(); }
remoteHost
- the host to which a packet should be sent.remotePort
- the port to which a packet should be sent.java.lang.IllegalArgumentException
- remoteHost
is null or empty.
remotePort
is negative or greater than 65535.Method Detail |
public java.lang.String getSessionId()
getSessionId
in interface ProtocolOptions
public java.lang.String getRemoteHost()
public void setRemoteHost(java.lang.String host)
host
- the remoteHost to which a packet should be sent.public int getRemotePort()
public void setRemotePort(int port)
port
- the remotePort to which a packet should be sent.public int getLocalPort()
public void setLocalPort(int port)
port
- the port at which this sasclient should be started.public java.applet.Applet getApplet()
the
- applet instancepublic void setApplet(java.applet.Applet app)
app
- the applet instance which is to be set.public int getProtocol()
public void setProtocol(int prot)
prot
- the protocol to be set.public SASClient getSASClient()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |