Package com.sshtools.client
Class ConnectionProtocolClient
java.lang.Object
com.sshtools.common.ssh.ExecutorOperationSupport<SshContext>
com.sshtools.synergy.ssh.ConnectionProtocol<SshClientContext>
com.sshtools.client.ConnectionProtocolClient
- All Implemented Interfaces:
Service
Implements the client side of the SSH connection prototocol
-
Field Summary
Fields inherited from class com.sshtools.synergy.ssh.ConnectionProtocol
con, outstandingRequests, SERVICE_NAME, usernameFields inherited from class com.sshtools.common.ssh.ExecutorOperationSupport
CALLBACKS, EVENTS, MESSAGES_INCOMING, MESSAGES_OUTGOING -
Constructor Summary
ConstructorsConstructorDescriptionConnectionProtocolClient(TransportProtocol<SshClientContext> transport, String username) -
Method Summary
Modifier and TypeMethodDescriptionprotected ChannelNG<SshClientContext>createChannel(String channeltype, Connection<SshClientContext> con) Create an SSH channel.getName()The name of the ssh service i.e.protected booleanisClient()protected voidonStart()protected voidonStop()protected booleanprocessTCPIPCancel(com.sshtools.common.util.ByteArrayReader bar, com.sshtools.common.util.ByteArrayWriter msg) Process remote forwarding cancel request.protected booleanprocessTCPIPForward(com.sshtools.common.util.ByteArrayReader bar, com.sshtools.common.util.ByteArrayWriter response) Process a request for remote forwarding.intstartLocalForwarding(String addressToBind, int portToBind, String destinationHost, int destinationPort) Start local port forwarding.intstartRemoteForwarding(String addressToBind, int portToBind, String destinationHost, int destinationPort) Start remote port forwarding.voidvoidvoidstopLocalForwarding(String addressToBind, int portToBind) voidvoidstopRemoteForwarding(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, stopMethods inherited from class com.sshtools.common.ssh.ExecutorOperationSupport
addIncomingTask, addOutgoingTask, addTask, cleanupOperations
-
Constructor Details
-
ConnectionProtocolClient
-
-
Method Details
-
isClient
protected boolean isClient()- Specified by:
isClientin classConnectionProtocol<SshClientContext>
-
onStart
protected void onStart()- Specified by:
onStartin classConnectionProtocol<SshClientContext>
-
onStop
protected void onStop()- Specified by:
onStopin classConnectionProtocol<SshClientContext>
-
startLocalForwarding
public int startLocalForwarding(String addressToBind, int portToBind, String destinationHost, int destinationPort) throws UnauthorizedException, 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:
UnauthorizedExceptionSshException
-
stopLocalForwarding
public void stopLocalForwarding() -
stopLocalForwarding
-
stopLocalForwarding
-
stopRemoteForwarding
- Throws:
SshException
-
stopRemoteForwarding
- Throws:
SshException
-
startRemoteForwarding
public int startRemoteForwarding(String addressToBind, int portToBind, String destinationHost, int destinationPort) throws 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:
SshException
-
getContext
- Overrides:
getContextin classConnectionProtocol<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:
processTCPIPCancelin classConnectionProtocol<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:
processTCPIPForwardin classConnectionProtocol<SshClientContext>- Throws:
IOException
-
getName
The name of the ssh service i.e. ssh-connection -
createChannel
protected ChannelNG<SshClientContext> createChannel(String channeltype, Connection<SshClientContext> con) throws UnsupportedChannelException, PermissionDeniedException, ChannelOpenException Create an SSH channel. This method delegates creation to the ChannelFactory installed on the current SshContext.- Specified by:
createChannelin classConnectionProtocol<SshClientContext>- Throws:
ChannelOpenExceptionUnsupportedChannelExceptionPermissionDeniedException
-