|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.maverick.ssh1.Ssh1Client
Implementation of an SshClient for the SSH1 protocol; no additional features are currently implemented outside of the general SshClient contract.
| Constructor Summary | |
Ssh1Client()
Default public constructor for the client called by SshConnector. |
|
| Method Summary | |
int |
authenticate(SshAuthentication auth)
Authenticate the user. |
boolean |
cancelRemoteForwarding(java.lang.String bindAddress,
int bindPort)
The bindAddress is ignored since the SSH1 protocol does not support setting of the bind address. |
void |
connect(SshTransport transport,
SshContext context,
SshConnector connector,
java.lang.String username,
java.lang.String localIdentification,
java.lang.String remoteIdentification,
boolean buffered)
Connect to an SSH server. |
void |
disconnect()
Disconnect from the remote computer. |
SshClient |
duplicate()
Create an identical version of an SshClient using cached authentication information and the SshTransport duplicate method. |
void |
exit()
|
int |
getChannelCount()
Get the number of active channels. |
SshContext |
getContext()
Get the context that created this client. |
java.lang.String |
getRemoteIdentification()
Returns the identification string supplied by the server during protocol negotiation. |
java.lang.String |
getUsername()
Return the username used for this connection |
int |
getVersion()
Returns the version for this client. |
boolean |
isAuthenticated()
Evaluate whether the user has been authenticated. |
boolean |
isBuffered()
Identifies whether this client is in buffered mode |
boolean |
isConnected()
Evaluate whether the connection is still alive. |
SshTunnel |
openForwardingChannel(java.lang.String hostname,
int port,
java.lang.String listeningAddress,
int listeningPort,
java.lang.String originatingHost,
int originatingPort,
SshTransport transport,
ChannelEventListener listener)
Open a TCPIP forwarding channel to the remote computer. |
SshClient |
openRemoteClient(java.lang.String hostname,
int port,
java.lang.String username)
Open up an SSH client from the remote machine to another remote server. |
SshClient |
openRemoteClient(java.lang.String hostname,
int port,
java.lang.String username,
SshConnector con)
Open up an SSH client from the remote machine to another remote server. |
SshSession |
openSessionChannel()
Opens the one and only session channel available on an SSH1 connection, calling this method multiple times on the same client instance will return the same session instance. |
SshSession |
openSessionChannel(ChannelEventListener listener)
Open a session on the remote computer. |
boolean |
requestRemoteForwarding(java.lang.String bindAddress,
int bindPort,
java.lang.String hostToConnect,
int portToConnect,
ForwardingRequestListener listener)
The bindAddress is ignored since the SSH1 protocol does not support setting of the bind address. |
boolean |
requestXForwarding(java.lang.String display,
ForwardingRequestListener listener)
|
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public Ssh1Client()
| Method Detail |
public void connect(SshTransport transport,
SshContext context,
SshConnector connector,
java.lang.String username,
java.lang.String localIdentification,
java.lang.String remoteIdentification,
boolean buffered)
throws SshException
SshClient
connect in interface SshClienttransport - the transport layercontext - an SSH contextusername - the users namelocalIdentification - the local identification stringremoteIdentification - the remotes identification stringbuffered - should the connection be buffered (threaded)
SshExceptionpublic java.lang.String getRemoteIdentification()
SshClient
getRemoteIdentification in interface SshClientpublic boolean isAuthenticated()
SshClienttrue immediatley
after connection. No other operations can be perform until the user has been
authenticated.
isAuthenticated in interface SshClienttrue if the connection is authenticated, otherwise false
public int authenticate(SshAuthentication auth)
throws SshException
SshClientAuthenticate the user. Once connected call to authenticate the user. When a connection is made no other operations can be performed until the user has been authenticated.
authenticate in interface SshClientauth - the authentication mechanism.
SshException
public SshSession openSessionChannel()
throws SshException,
ChannelOpenException
openSessionChannel in interface SshClientSshException
ChannelOpenException
public SshSession openSessionChannel(ChannelEventListener listener)
throws SshException,
ChannelOpenException
SshClientOpen a session on the remote computer. This can only be called once the user has been authenticated. The session returned is uninitialized and will be opened when either a command is executed or the users shell has been started.
openSessionChannel in interface SshClientlistener - an event listener to add before opening
SshException
ChannelOpenException
public SshTunnel openForwardingChannel(java.lang.String hostname,
int port,
java.lang.String listeningAddress,
int listeningPort,
java.lang.String originatingHost,
int originatingPort,
SshTransport transport,
ChannelEventListener listener)
throws SshException,
ChannelOpenException
SshClientOpen a TCPIP forwarding channel to the remote computer. If successful the remote computer will open a socket to the host/port specified and return a channel which can be used to forward TCPIP data from the local computer to the remotley connected socket.
It should be noted that this is a low level API method and it does not connect the transport to the channel as this would require some threading. The transport is passed here so that it can be attached to the SshTunnel that is returned. If you want to have the API automatically connect the channel to the transport you should use the ForwardingClient which provides management of forwarding connections and threads.
openForwardingChannel in interface SshClienthostname - the host to connect toport - the port to connect tooriginatingHost - the originating host (informational only)originatingPort - the originating port (informational only)transport - listener - an event listener that will be added to the channel before opening.
SshException
ChannelOpenException
public SshClient openRemoteClient(java.lang.String hostname,
int port,
java.lang.String username,
SshConnector con)
throws SshException,
ChannelOpenException
SshClientSshClient instance to any other machine on the
same network.
openRemoteClient in interface SshClienthostname - the name of the remote hostport - the port of the remote hostusername - the name of the user on the remote hostcon - an SshConnector instance that will be used to connect
the client. This does not have to be the same instance that created
this client.
SshException
ChannelOpenException
public SshClient openRemoteClient(java.lang.String hostname,
int port,
java.lang.String username)
throws SshException,
ChannelOpenException
SshClientSshClient instance to any other machine on the
same network.
openRemoteClient in interface SshClienthostname - the name of the remote hostport - the port of the remote hostusername - the name of the user on the remote host
ChannelOpenException
SshException
public boolean requestXForwarding(java.lang.String display,
ForwardingRequestListener listener)
throws SshException
SshException
public boolean requestRemoteForwarding(java.lang.String bindAddress,
int bindPort,
java.lang.String hostToConnect,
int portToConnect,
ForwardingRequestListener listener)
throws SshException
requestRemoteForwarding in interface SshClientbindAddress - the address that the remote computer should listen onbindPort - the port that the remote computer should listen onhostToConnect - the host to connect when a connection is establishedportToConnect - the port to connect when a connection is establishedlistener - a callback interface
SshException
public boolean cancelRemoteForwarding(java.lang.String bindAddress,
int bindPort)
throws SshException
cancelRemoteForwarding in interface SshClientbindAddress - the address that the remote computer is listening on.bindPort - the port that the remote computer is listening on.
SshExceptionpublic void disconnect()
SshClient
disconnect in interface SshClientpublic void exit()
exit in interface Clientpublic boolean isConnected()
SshClient
isConnected in interface SshClienttrue if connected, otherwise falsepublic java.lang.String getUsername()
SshClient
getUsername in interface SshClient
public SshClient duplicate()
throws SshException
SshClient
duplicate in interface SshClientSshExceptionpublic SshContext getContext()
SshClient
getContext in interface SshClientpublic int getChannelCount()
SshClient
getChannelCount in interface SshClientpublic int getVersion()
SshClient
getVersion in interface SshClientpublic boolean isBuffered()
SshClient
isBuffered in interface SshClientpublic java.lang.String toString()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||