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

    Constructors
    Constructor
    Description
    ConnectionProtocolClient(com.sshtools.synergy.ssh.TransportProtocol<SshClientContext> transport, String username)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected com.sshtools.synergy.ssh.ChannelNG<SshClientContext>
    createChannel(String channeltype, com.sshtools.synergy.ssh.Connection<SshClientContext> con)
    Create an SSH channel.
     
    The name of the ssh service i.e.
    protected boolean
     
    protected void
     
    protected void
     
    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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ConnectionProtocolClient

      public ConnectionProtocolClient(com.sshtools.synergy.ssh.TransportProtocol<SshClientContext> transport, String username)
  • Method Details

    • isClient

      protected boolean isClient()
      Specified by:
      isClient in class com.sshtools.synergy.ssh.ConnectionProtocol<SshClientContext>
    • onStart

      protected void onStart()
      Specified by:
      onStart in class com.sshtools.synergy.ssh.ConnectionProtocol<SshClientContext>
    • onStop

      protected void onStop()
      Specified by:
      onStop in class com.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

      public void stopLocalForwarding(String addressToBind, int portToBind)
    • stopLocalForwarding

      public void stopLocalForwarding(String key)
    • 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

      public SshClientContext getContext()
      Overrides:
      getContext in class com.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 class com.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 class com.sshtools.synergy.ssh.ConnectionProtocol<SshClientContext>
      Throws:
      IOException
    • getName

      public String 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 class com.sshtools.synergy.ssh.ConnectionProtocol<SshClientContext>
      Throws:
      com.sshtools.common.ssh.ChannelOpenException
      com.sshtools.common.ssh.UnsupportedChannelException
      com.sshtools.common.permissions.PermissionDeniedException