Interface ConnectionService

All Superinterfaces:
AutoCloseable, Channel, Closeable, org.apache.sshd.common.Closeable, PortForwardingEventListenerManager, PortForwardingEventListenerManagerHolder, org.apache.sshd.common.PropertyResolver, Service, org.apache.sshd.common.session.SessionContextHolder, org.apache.sshd.common.session.SessionHeartbeatController, SessionHolder<Session>, UnknownChannelReferenceHandlerManager
All Known Implementing Classes:
AbstractConnectionService, ClientConnectionService, ServerConnectionService

public interface ConnectionService extends Service, org.apache.sshd.common.session.SessionHeartbeatController, UnknownChannelReferenceHandlerManager, PortForwardingEventListenerManager, PortForwardingEventListenerManagerHolder
Interface implementing ssh-connection service.
Author:
Apache MINA SSHD Project
  • Method Details

    • registerChannel

      long registerChannel(Channel channel) throws IOException
      Register a newly created channel with a new unique identifier
      Parameters:
      channel - The Channel to register
      Returns:
      The assigned id of this channel - a UINT32 represented as a long
      Throws:
      IOException - If failed to initialize and register the channel
    • unregisterChannel

      void unregisterChannel(Channel channel)
      Remove this channel from the list of managed channels
      Parameters:
      channel - The Channel instance
    • getForwarder

      Forwarder getForwarder()
      Retrieve the forwarder instance
      Returns:
      The Forwarder
    • request

      default org.apache.sshd.common.util.buffer.Buffer request(String request, org.apache.sshd.common.util.buffer.Buffer buffer, long timeout, TimeUnit unit) throws IOException
      Send a global request and wait for the response, if the request is sent with want-reply = true.
      Parameters:
      request - the request name - used mainly for logging and debugging
      buffer - the buffer containing the global request
      timeout - The number of time units to wait - must be positive
      unit - The TimeUnit to wait for the response
      Returns:
      the return buffer if the request was successful, null otherwise.
      Throws:
      IOException - if an error occurred when encoding or sending the packet
      SocketTimeoutException - If no response received within specified timeout
    • request

      default org.apache.sshd.common.util.buffer.Buffer request(String request, org.apache.sshd.common.util.buffer.Buffer buffer, Duration timeout) throws IOException
      Send a global request and wait for the response, if the request is sent with want-reply = true.
      Parameters:
      request - the request name - used mainly for logging and debugging
      buffer - the buffer containing the global request
      timeout - The (never null) timeout to wait - its milliseconds value is used
      Returns:
      the return buffer if the request was successful, null otherwise.
      Throws:
      IOException - if an error occurred when encoding or sending the packet
      SocketTimeoutException - If no response received within specified timeout
    • request

      org.apache.sshd.common.util.buffer.Buffer request(String request, org.apache.sshd.common.util.buffer.Buffer buffer, long maxWaitMillis) throws IOException
      Send a global request and wait for the response, if the request is sent with want-reply = true.
      Parameters:
      request - the request name - used mainly for logging and debugging
      buffer - the buffer containing the global request
      maxWaitMillis - maximum time in milliseconds to wait for the request to finish - must be positive
      Returns:
      the return buffer if the request was successful, null otherwise.
      Throws:
      IOException - if an error occurred when encoding or sending the packet
      SocketTimeoutException - If no response received within specified timeout
    • request

      GlobalRequestFuture request(org.apache.sshd.common.util.buffer.Buffer buffer, String request, GlobalRequestFuture.ReplyHandler replyHandler) throws IOException
      Send a global request and handle the reply asynchronously. If want-reply = true, pass the received Buffer to the given GlobalRequestFuture.ReplyHandler, which may execute in a different thread.
      want-reply == true && replyHandler != null
      The returned future is fulfilled with null when the request was sent, or with an exception if the request could not be sent. The replyHandler is invoked once the reply is received, with the SSH reply code and the data received.
      want-reply == true && replyHandler == null
      The returned future is fulfilled with an exception if the request could not be sent, or a failure reply was received. If a success reply was received, the future is fulfilled with the received data buffer.
      want-reply == false
      The returned future is fulfilled with an empty Buffer when the request was sent, or with an exception if the request could not be sent. If a reply handler is given, it is invoked with that empty buffer. The handler is not invoked if sending the request failed.
      Parameters:
      buffer - the Buffer containing the global request, with the want-reply flag set as appropriate
      request - the request name
      replyHandler - GlobalRequestFuture.ReplyHandler for handling the reply; may be null
      Returns:
      Created GlobalRequestFuture
      Throws:
      IOException - if an error occurred while encoding or sending the packet
    • getAgentForwardSupport

      AgentForwardSupport getAgentForwardSupport()
    • getX11ForwardSupport

      X11ForwardSupport getX11ForwardSupport()
    • isAllowMoreSessions

      boolean isAllowMoreSessions()
    • setAllowMoreSessions

      void setAllowMoreSessions(boolean allow)