Class Subsystem

java.lang.Object
com.sshtools.common.ssh.Subsystem
Direct Known Subclasses:
PublicKeySubsystemServer, SftpSubsystem

public abstract class Subsystem extends Object
Defines the abstract attributes of an SSH Subsystem.
Author:
Lee David Painter
  • Field Details

    • SUBSYSTEM_INCOMING

      public static final Integer SUBSYSTEM_INCOMING
    • SUBSYSTEM_OUTGOING

      public static final Integer SUBSYSTEM_OUTGOING
    • session

      protected SessionChannel session
    • context

      protected Context context
  • Constructor Details

    • Subsystem

      public Subsystem(String name)
  • Method Details

    • getContext

      public Context getContext()
    • getConnection

      public SshConnection getConnection()
    • getSession

      public SessionChannel getSession()
    • init

      public void init(SessionChannel session, Context context) throws IOException, PermissionDeniedException
      Initialize the subsystem with the current session and configuration.
      Parameters:
      session -
      context -
      Throws:
      IOException
      PermissionDeniedException
    • executeOperation

      protected void executeOperation(Integer messageQueue, ConnectionAwareTask r)
    • cleanup

      protected void cleanup()
    • cleanupSubsystem

      protected abstract void cleanupSubsystem()
    • processMessage

      public void processMessage(ByteBuffer data) throws IOException
      Process channel data and transform into a subsystem message when enough data has arrived.
      Parameters:
      data -
      Throws:
      IOException
    • parseMessage

      protected void parseMessage(ByteBuffer data) throws IOException
      Throws:
      IOException
    • free

      public void free()
    • onSubsystemFree

      protected abstract void onSubsystemFree()
      The subsystem has been closed and all resources should be freed.
    • onMessageReceived

      protected abstract void onMessageReceived(byte[] msg) throws IOException
      Called when a subsystem message has been extracted from the incoming data stream.
      Parameters:
      msg -
      Throws:
      IOException
    • sendMessage

      public void sendMessage(Packet packet) throws IOException
      Send a subsystem message. NOTE: you do not have to prefix the message with its length as this operation is performed inside this method.
      Parameters:
      msg -
      Throws:
      IOException
    • onFreeMessage

      public void onFreeMessage(byte[] msg)