Class ChannelToPortHandler

java.lang.Object
org.apache.sshd.common.util.logging.AbstractLoggingBean
org.apache.sshd.common.forward.ChannelToPortHandler

public class ChannelToPortHandler extends org.apache.sshd.common.util.logging.AbstractLoggingBean
Implements forwarding messages received from a channel to a port in TCP/IP port forwarding.
Author:
Apache MINA SSHD Project
  • Field Summary

    Fields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean

    log
  • Constructor Summary

    Constructors
    Constructor
    Description
    ChannelToPortHandler(org.apache.sshd.common.io.IoSession port, Channel channel)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.apache.sshd.common.io.IoSession
    Retrieves the IoSession for the port connection.
    void
    Perform appropriate actions on the port session when the channel received an SSH_MSG_CHANNEL_EOF message.
    protected void
    handleWriteDataFailure(byte cmd, byte[] data, int off, int len, Throwable t)
     
    protected void
    handleWriteDataSuccess(byte cmd, byte[] data, int off, int len)
     
    void
    sendToPort(byte cmd, byte[] data, int off, long len)
    Forwards data received on the SSH channel to the port and adjust the channel window once the data has been written.
    org.apache.sshd.common.io.IoWriteFuture
    sendToPort(org.apache.sshd.common.util.buffer.Buffer buffer)
    Write data to the port directly without adjusting the channel window.

    Methods inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean

    debug, debug, debug, debug, debug, error, error, error, error, error, getSimplifiedLogger, info, info, warn, warn, warn, warn, warn, warn, warn, warn

    Methods inherited from class Object

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

    • ChannelToPortHandler

      public ChannelToPortHandler(org.apache.sshd.common.io.IoSession port, Channel channel)
  • Method Details

    • getPortSession

      public org.apache.sshd.common.io.IoSession getPortSession()
      Retrieves the IoSession for the port connection.
      Returns:
      the IoSession, never null
    • handleEof

      public void handleEof() throws IOException
      Perform appropriate actions on the port session when the channel received an SSH_MSG_CHANNEL_EOF message.
      Throws:
      IOException
    • sendToPort

      public org.apache.sshd.common.io.IoWriteFuture sendToPort(org.apache.sshd.common.util.buffer.Buffer buffer) throws IOException
      Write data to the port directly without adjusting the channel window.
      Parameters:
      buffer - data to write to the port
      Returns:
      an IoWriteFuture fulfilled once the data has been written
      Throws:
      IOException - if an error occurs
    • sendToPort

      public void sendToPort(byte cmd, byte[] data, int off, long len) throws IOException
      Forwards data received on the SSH channel to the port and adjust the channel window once the data has been written.
      Parameters:
      cmd - the SSH command, typically @link SshConstants#SSH_MSG_CHANNEL_DATA}, used for logging only
      data - to forward
      off - offset in data of the start of the data to forward
      len - number of bytes to forward
      Throws:
      IOException - if an error occurs
    • handleWriteDataSuccess

      protected void handleWriteDataSuccess(byte cmd, byte[] data, int off, int len)
    • handleWriteDataFailure

      protected void handleWriteDataFailure(byte cmd, byte[] data, int off, int len, Throwable t)