Package com.sshtools.client
Class ConnectionProtocolClient
java.lang.Object
com.sshtools.common.ssh.ExecutorOperationSupport<com.sshtools.synergy.ssh.SshContext>
com.sshtools.synergy.ssh.ConnectionProtocol<SshClientContext>
com.sshtools.client.ConnectionProtocolClient
- All Implemented Interfaces:
com.sshtools.synergy.ssh.Service
public class ConnectionProtocolClient
extends com.sshtools.synergy.ssh.ConnectionProtocol<SshClientContext>
Implements the client side of the SSH connection prototocol
-
Field Summary
Fields inherited from class com.sshtools.synergy.ssh.ConnectionProtocol
con, outstandingRequests, SERVICE_NAME, username
Fields inherited from class com.sshtools.common.ssh.ExecutorOperationSupport
CALLBACKS, EVENTS, MESSAGES_INCOMING, MESSAGES_OUTGOING
-
Constructor Summary
ConstructorsConstructorDescriptionConnectionProtocolClient
(com.sshtools.synergy.ssh.TransportProtocol<SshClientContext> transport, String username) -
Method Summary
Modifier and TypeMethodDescriptionprotected com.sshtools.synergy.ssh.ChannelNG<SshClientContext>
createChannel
(String channeltype, com.sshtools.synergy.ssh.Connection<SshClientContext> con) Create an SSH channel.getName()
The name of the ssh service i.e.protected boolean
isClient()
protected void
onStart()
protected void
onStop()
protected boolean
processTCPIPCancel
(com.sshtools.common.util.ByteArrayReader bar, com.sshtools.common.util.ByteArrayWriter msg) Process remote forwarding cancel request.protected boolean
processTCPIPForward
(com.sshtools.common.util.ByteArrayReader bar, com.sshtools.common.util.ByteArrayWriter response) Process a request for remote forwarding.int
startLocalForwarding
(String addressToBind, int portToBind, String destinationHost, int destinationPort) Start local port forwarding.int
startRemoteForwarding
(String addressToBind, int portToBind, String destinationHost, int destinationPort) Start remote port forwarding.void
void
void
stopLocalForwarding
(String addressToBind, int portToBind) void
void
stopRemoteForwarding
(String addressToBind, int portToBind) Methods inherited from class com.sshtools.synergy.ssh.ConnectionProtocol
addGlobalRequestHandler, disconnect, getActiveChannels, getConnection, getIdleLog, getIdleTimeoutSeconds, getLocalAddress, getLocalPort, getMaxChannels, getQueueSize, getRemoteAddress, getSessionIdentifier, getTransport, getUsername, getUUID, idle, openChannel, processGlobalRequestFailure, processGlobalRequestSuccess, processMessage, sendChannelOpenConfirmation, sendChannelOpenFailure, sendGlobalRequest, start, stop
Methods inherited from class com.sshtools.common.ssh.ExecutorOperationSupport
addIncomingTask, addOutgoingTask, addTask, cleanupOperations
-
Constructor Details
-
ConnectionProtocolClient
public ConnectionProtocolClient(com.sshtools.synergy.ssh.TransportProtocol<SshClientContext> transport, String username)
-
-
Method Details
-
isClient
protected boolean isClient()- Specified by:
isClient
in classcom.sshtools.synergy.ssh.ConnectionProtocol<SshClientContext>
-
onStart
protected void onStart()- Specified by:
onStart
in classcom.sshtools.synergy.ssh.ConnectionProtocol<SshClientContext>
-
onStop
protected void onStop()- Specified by:
onStop
in classcom.sshtools.synergy.ssh.ConnectionProtocol<SshClientContext>
-
startLocalForwarding
public int startLocalForwarding(String addressToBind, int portToBind, String destinationHost, int destinationPort) throws com.sshtools.common.permissions.UnauthorizedException, com.sshtools.common.ssh.SshException Start local port forwarding. Listening on a local interface and forwarding the data to a host on the remote network.- Parameters:
addressToBind
-portToBind
-destinationHost
-destinationPort
-- Returns:
- Throws:
com.sshtools.common.permissions.UnauthorizedException
com.sshtools.common.ssh.SshException
-
stopLocalForwarding
public void stopLocalForwarding() -
stopLocalForwarding
-
stopLocalForwarding
-
stopRemoteForwarding
public void stopRemoteForwarding(String addressToBind, int portToBind) throws com.sshtools.common.ssh.SshException - Throws:
com.sshtools.common.ssh.SshException
-
stopRemoteForwarding
public void stopRemoteForwarding() throws com.sshtools.common.ssh.SshException- Throws:
com.sshtools.common.ssh.SshException
-
startRemoteForwarding
public int startRemoteForwarding(String addressToBind, int portToBind, String destinationHost, int destinationPort) throws com.sshtools.common.ssh.SshException Start remote port forwarding. Requests that the server starts a listening socket on the remote network and delivers data to a host on the local network.- Parameters:
addressToBind
-portToBind
-destinationHost
-destinationPort
-- Returns:
- actual destination port
- Throws:
com.sshtools.common.ssh.SshException
-
getContext
- Overrides:
getContext
in classcom.sshtools.synergy.ssh.ConnectionProtocol<SshClientContext>
-
processTCPIPCancel
protected boolean processTCPIPCancel(com.sshtools.common.util.ByteArrayReader bar, com.sshtools.common.util.ByteArrayWriter msg) throws IOException Process remote forwarding cancel request. This method does nothing since the client does not support opening of remote forwarding channels.- Specified by:
processTCPIPCancel
in classcom.sshtools.synergy.ssh.ConnectionProtocol<SshClientContext>
- Throws:
IOException
-
processTCPIPForward
protected boolean processTCPIPForward(com.sshtools.common.util.ByteArrayReader bar, com.sshtools.common.util.ByteArrayWriter response) throws IOException Process a request for remote forwarding. This method does nothing since the client does not support opening of remote forwarding channels.- Specified by:
processTCPIPForward
in classcom.sshtools.synergy.ssh.ConnectionProtocol<SshClientContext>
- Throws:
IOException
-
getName
The name of the ssh service i.e. ssh-connection -
createChannel
protected com.sshtools.synergy.ssh.ChannelNG<SshClientContext> createChannel(String channeltype, com.sshtools.synergy.ssh.Connection<SshClientContext> con) throws com.sshtools.common.ssh.UnsupportedChannelException, com.sshtools.common.permissions.PermissionDeniedException, com.sshtools.common.ssh.ChannelOpenException Create an SSH channel. This method delegates creation to the ChannelFactory installed on the current SshContext.- Specified by:
createChannel
in classcom.sshtools.synergy.ssh.ConnectionProtocol<SshClientContext>
- Throws:
com.sshtools.common.ssh.ChannelOpenException
com.sshtools.common.ssh.UnsupportedChannelException
com.sshtools.common.permissions.PermissionDeniedException
-