Class VirtualShellNG

java.lang.Object
com.sshtools.synergy.ssh.ChannelNG<SshServerContext>
com.sshtools.server.SessionChannelNG
com.sshtools.server.vsession.VirtualShellNG
All Implemented Interfaces:
com.sshtools.common.nio.IdleStateListener, com.sshtools.common.ssh.Channel, com.sshtools.common.ssh.SessionChannel, com.sshtools.common.ssh.SessionChannelServer

public class VirtualShellNG extends SessionChannelNG
  • Field Details

  • Constructor Details

    • VirtualShellNG

      public VirtualShellNG(com.sshtools.common.ssh.SshConnection con, ShellCommandFactory commandFactory, String shellCommand)
    • VirtualShellNG

      public VirtualShellNG(com.sshtools.common.ssh.SshConnection con, ShellCommandFactory commandFactory)
  • Method Details

    • addWindowSizeChangeListener

      public void addWindowSizeChangeListener(VirtualShellNG.WindowSizeChangeListener listener)
    • removeWindowSizeChangeListener

      public void removeWindowSizeChangeListener(VirtualShellNG.WindowSizeChangeListener listener)
    • addProtectedEnvironmentVar

      public void addProtectedEnvironmentVar(String name)
    • executeCommand

      protected boolean executeCommand(String cmd)
    • changeWindowDimensions

      protected void changeWindowDimensions(int cols, int rows, int width, int height)
      Description copied from class: SessionChannelNG
      When the window (terminal) size changes on the client side, it MAY send notification in which case this method will be invoked to notify the session that a change has occurred.
      Specified by:
      changeWindowDimensions in class SessionChannelNG
    • onSessionOpen

      public void onSessionOpen()
      Specified by:
      onSessionOpen in interface com.sshtools.common.ssh.SessionChannel
      Overrides:
      onSessionOpen in class SessionChannelNG
    • startShell

      protected boolean startShell()
      Description copied from class: SessionChannelNG
      Invoked when the user wants to start a shell.
      Specified by:
      startShell in class SessionChannelNG
      Returns:
      true if the shell has been started, otherwise false
    • createShell

      protected RootShell createShell(com.sshtools.common.ssh.SshConnection con) throws com.sshtools.common.permissions.PermissionDeniedException, IOException
      Throws:
      com.sshtools.common.permissions.PermissionDeniedException
      IOException
    • requestAgentForwarding

      protected boolean requestAgentForwarding(String requestType)
      Description copied from class: SessionChannelNG
      Implement this method to support agent forwarding.
      Overrides:
      requestAgentForwarding in class SessionChannelNG
      Returns:
    • allocatePseudoTerminal

      protected boolean allocatePseudoTerminal(String term, int cols, int rows, int width, int height, byte[] modes)
      Description copied from class: SessionChannelNG
      If the client requests a pseudo terminal for the session this method will be invoked before the shell, exec or subsystem is started.
      Specified by:
      allocatePseudoTerminal in class SessionChannelNG
      Returns:
      boolean
    • setEnvironmentVariable

      public boolean setEnvironmentVariable(String name, String value)
      Description copied from class: SessionChannelNG
      If the client requests that an environment variable be set this method will be invoked.
      Specified by:
      setEnvironmentVariable in interface com.sshtools.common.ssh.SessionChannelServer
      Specified by:
      setEnvironmentVariable in class SessionChannelNG
      Returns:
      true if the variable has been set, otherwise false
    • onChannelOpenFailure

      protected void onChannelOpenFailure()
      Overrides:
      onChannelOpenFailure in class com.sshtools.synergy.ssh.ChannelNG<SshServerContext>
    • processSignal

      protected void processSignal(String signal)
      Description copied from class: SessionChannelNG
      A signal can be delivered to the process by the client. If a signal is received this method will be invoked so that the session may evaluate and take the required action.
      Specified by:
      processSignal in class SessionChannelNG
    • onLocalEOF

      protected void onLocalEOF()
      Specified by:
      onLocalEOF in class com.sshtools.synergy.ssh.ChannelNG<SshServerContext>
    • enableRawMode

      public void enableRawMode()
      Specified by:
      enableRawMode in interface com.sshtools.common.ssh.SessionChannelServer
      Overrides:
      enableRawMode in class SessionChannelNG
    • disableRawMode

      public void disableRawMode()
      Specified by:
      disableRawMode in interface com.sshtools.common.ssh.SessionChannelServer
      Overrides:
      disableRawMode in class SessionChannelNG