|
AdventNet CLI 2.0 API Specification | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--com.adventnet.cli.transport.ssh.SshTransportProviderImpl
The SSH implementation of the CLITransportProvider for communicating with the remote host using ssh.
CLITransportProvider| Fields inherited from interface com.adventnet.cli.transport.CLITransportProvider |
STREAM_CLOSED |
| Constructor Summary | |
SshTransportProviderImpl()
Creates an instance of ssh provider. |
|
| Method Summary | |
void |
close()
This closes the SSH connection to the remote device. |
void |
connect(java.lang.String host,
int port)
Connects to the remote host. |
double |
getSshVersion(java.lang.String host,
int port)
Gets the SSH version of the remote SSH server. |
java.lang.String |
login(java.lang.String userName,
java.lang.String password,
java.lang.String prompt)
Logs into the remote host with username and password. |
void |
open(CLIProtocolOptions cliProtOpt)
Opens a SSH connection to the remote device. |
CLIMessage |
read()
Receives the CLI message from the opened telnet connection. |
int |
read(byte[] b)
Reads data from the socket ( as byte stream). |
void |
setSocketTimeout(int timeout)
sets the socket timeout value. |
void |
write(byte[] b)
Sends command or byte stream to the remote host. |
void |
write(CLIMessage cliMsg)
Sends the command in the CLIMessage. |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Constructor Detail |
public SshTransportProviderImpl()
| Method Detail |
public void open(CLIProtocolOptions cliProtOpt)
throws java.lang.Exception,
ConnectException,
LoginException
The login prompt and password prompt are assumed as "login:" and "Password:" and the login to the remote host will succeed only if the prompt returned by the device matches with the above.
cliProtOpt - the CLIProtocolOptions with the parameters.
public void close()
throws java.lang.Exception
public void write(CLIMessage cliMsg)
throws java.io.IOException
cliMsg - the CLIMessage that has to be sent. The CLI
command (as a string) is obtained by calling
cliMsg.getData().
public CLIMessage read()
throws java.io.IOException
public double getSshVersion(java.lang.String host,
int port)
host - the remote ssh server.port - the port in which the ssh server listens.double value
public void connect(java.lang.String host,
int port)
throws ConnectException
host - the remote host nameport - the remote port
public java.lang.String login(java.lang.String userName,
java.lang.String password,
java.lang.String prompt)
throws java.io.IOException
userName - the user namepassword - the password for authenticationprompt - shell prompt as a string.
public void setSocketTimeout(int timeout)
throws java.io.IOException
timeout - an int value
public void write(byte[] b)
throws java.io.IOException
b - a byte[] value
public int read(byte[] b)
throws java.io.IOException
b - a byte[] valueint value
|
AdventNet CLI 2.0 API Specification | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||