Class PseudoTerminalModes

java.lang.Object
com.sshtools.client.PseudoTerminalModes

public class PseudoTerminalModes extends Object

When a client requests a pseudo terminal it informs the server of any terminal modes that it knows of. This is typically used in situations where advance terminal configuration is required but it can also be used to perform simple configuration such as turning off character echo.

NOTE: the server may ignore some of the modes set if it does not support them.

 var session = ssh.openSessionChannel();
 session.requestPseudoTerminal("vt100", 80, 24, 0, 0, PseudoTerminalModesBuilder.create().
                        // Turning off echo
                        withMode(PseudoTerminalModes.ECHO, false).
                        // Setting the Input/Output baud rate
                        withMode(PseudoTerminalModes.TTY_OP_ISPEED, 38400).
                        withMode(PseudoTerminalModes.TTY_OP_OSPEED, 38400).
                        build());
 
Author:
Lee David Painter
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    7 bit mode.
    static final int
    8 bit mode.
    static final int
    Enable echoing.
    static final int
    Echo control characters as ^(Char).
    static final int
    Visually erase chars.
    static final int
    Kill character discards current line.
    static final int
    Visual erase for line kill.
    static final int
    Echo NL even if ECHO is off.
    static final int
    Canonicalize input lines.
    static final int
    Map CR to NL on input.
    static final int
    Enable extensions.
    static final int
    Ignore CR on input.
    static final int
    The ignore parity flag.
    static final int
    Ring bell on input queue full.
    static final int
    Map NL into CR on input.
    static final int
    Enable checking of parity errors.
    static final int
    Enable signals INTR, QUIT, [D]SUSP.
    static final int
    Strip 8th bit off characters.
    static final int
    Translate uppercase characters to lowercase.
    static final int
    Output is assumed to be UTF-8
    static final int
    Any char will restart after stop.
    static final int
    Enable input flow control.
    static final int
    Enable output flow control.
    static final int
    Don't flush after interrupt.
    static final int
    Translate carriage return to newline (output).
    static final int
    Convert lowercase to uppercase.
    static final int
    Map NL to CR-NL.
    static final int
    Newline performs a carriage return (output).
    static final int
    Translate newline to carriage return-newline (output).
    static final int
    Enable output processing.
    static final int
    Parity enable.
    static final int
    Mark parity and framing errors.
    static final int
    Odd parity, else even.
    static final int
    Retype pending input.
    static final int
    Stop background jobs from output.
    static final int
    Specifies the input baud rate in bits per second.
    static final int
    Specifies the output baud rate in bits per second.
    static final int
    Toggles the flushing of terminal output.
    static final int
    Another suspend character.
    static final int
    End-of-file character (sends EOF from the terminal).
    static final int
    End-of-line character in addition to carriage return and/or linefeed.
    static final int
    Additional end-of-line character.
    static final int
    Erase the character to left of the cursor.
    static final int
    Character to flush output.
    static final int
    Interrupt character; 255 if none.
    static final int
    Kill the current input line.
    static final int
    Enter the next character typed literally, even if it is a special character
    static final int
    The quit character (sends SIGQUIT signal on POSIX systems).
    static final int
    Reprints the current input line.
    static final int
    Continues paused output (normally control-Q).
    static final int
    Prints system status line (load, command, pid, etc).
    static final int
    Pauses output (normally control-S).
    static final int
    Suspends the current program.
    static final int
    Switch to a different shell layer.
    static final int
    Erases a word left of cursor.
    static final int
    Enable input and output of uppercase characters by preceding their lowercase equivalents with "\".
  • Constructor Summary

    Constructors
    Constructor
    Description
    Deprecated, for removal: This API element is subject to removal in a future version.
    PseudoTerminalModes(byte[] modes)
    Deprecated, for removal: This API element is subject to removal in a future version.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Deprecated, for removal: This API element is subject to removal in a future version.
    void
    setTerminalMode(int mode, boolean value)
    Deprecated, for removal: This API element is subject to removal in a future version.
    void
    setTerminalMode(int mode, int value)
    Deprecated, for removal: This API element is subject to removal in a future version.
    byte[]
    Returns the encoded modes for use by the SshSession.

    Methods inherited from class java.lang.Object

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

    • VINTR

      public static final int VINTR
      Interrupt character; 255 if none.
      See Also:
    • VQUIT

      public static final int VQUIT
      The quit character (sends SIGQUIT signal on POSIX systems).
      See Also:
    • VERASE

      public static final int VERASE
      Erase the character to left of the cursor.
      See Also:
    • VKILL

      public static final int VKILL
      Kill the current input line.
      See Also:
    • VEOF

      public static final int VEOF
      End-of-file character (sends EOF from the terminal).
      See Also:
    • VEOL

      public static final int VEOL
      End-of-line character in addition to carriage return and/or linefeed.
      See Also:
    • VEOL2

      public static final int VEOL2
      Additional end-of-line character.
      See Also:
    • VSTART

      public static final int VSTART
      Continues paused output (normally control-Q).
      See Also:
    • VSTOP

      public static final int VSTOP
      Pauses output (normally control-S).
      See Also:
    • VSUSP

      public static final int VSUSP
      Suspends the current program.
      See Also:
    • VDSUSP

      public static final int VDSUSP
      Another suspend character.
      See Also:
    • VREPRINT

      public static final int VREPRINT
      Reprints the current input line.
      See Also:
    • VWERASE

      public static final int VWERASE
      Erases a word left of cursor.
      See Also:
    • VLNEXT

      public static final int VLNEXT
      Enter the next character typed literally, even if it is a special character
      See Also:
    • VFLUSH

      public static final int VFLUSH
      Character to flush output.
      See Also:
    • VSWITCH

      public static final int VSWITCH
      Switch to a different shell layer.
      See Also:
    • VSTATUS

      public static final int VSTATUS
      Prints system status line (load, command, pid, etc).
      See Also:
    • VDISCARD

      public static final int VDISCARD
      Toggles the flushing of terminal output.
      See Also:
    • IGNPAR

      public static final int IGNPAR
      The ignore parity flag. The parameter SHOULD be 0 if this flag is FALSE, and 1 if it is TRUE.
      See Also:
    • PARMRK

      public static final int PARMRK
      Mark parity and framing errors.
      See Also:
    • INPCK

      public static final int INPCK
      Enable checking of parity errors.
      See Also:
    • ISTRIP

      public static final int ISTRIP
      Strip 8th bit off characters.
      See Also:
    • INLCR

      public static final int INLCR
      Map NL into CR on input.
      See Also:
    • IGNCR

      public static final int IGNCR
      Ignore CR on input.
      See Also:
    • ICRNL

      public static final int ICRNL
      Map CR to NL on input.
      See Also:
    • IUCLC

      public static final int IUCLC
      Translate uppercase characters to lowercase.
      See Also:
    • IXON

      public static final int IXON
      Enable output flow control.
      See Also:
    • IXANY

      public static final int IXANY
      Any char will restart after stop.
      See Also:
    • IXOFF

      public static final int IXOFF
      Enable input flow control.
      See Also:
    • IMAXBEL

      public static final int IMAXBEL
      Ring bell on input queue full.
      See Also:
    • IUTF8

      public static final int IUTF8
      Output is assumed to be UTF-8
      See Also:
    • ISIG

      public static final int ISIG
      Enable signals INTR, QUIT, [D]SUSP.
      See Also:
    • ICANON

      public static final int ICANON
      Canonicalize input lines.
      See Also:
    • XCASE

      public static final int XCASE
      Enable input and output of uppercase characters by preceding their lowercase equivalents with "\".
      See Also:
    • ECHO

      public static final int ECHO
      Enable echoing.
      See Also:
    • ECHOE

      public static final int ECHOE
      Visually erase chars.
      See Also:
    • ECHOK

      public static final int ECHOK
      Kill character discards current line.
      See Also:
    • ECHONL

      public static final int ECHONL
      Echo NL even if ECHO is off.
      See Also:
    • NOFLSH

      public static final int NOFLSH
      Don't flush after interrupt.
      See Also:
    • TOSTOP

      public static final int TOSTOP
      Stop background jobs from output.
      See Also:
    • IEXTEN

      public static final int IEXTEN
      Enable extensions.
      See Also:
    • ECHOCTL

      public static final int ECHOCTL
      Echo control characters as ^(Char).
      See Also:
    • ECHOKE

      public static final int ECHOKE
      Visual erase for line kill.
      See Also:
    • PENDIN

      public static final int PENDIN
      Retype pending input.
      See Also:
    • OPOST

      public static final int OPOST
      Enable output processing.
      See Also:
    • OLCUC

      public static final int OLCUC
      Convert lowercase to uppercase.
      See Also:
    • ONLCR

      public static final int ONLCR
      Map NL to CR-NL.
      See Also:
    • OCRNL

      public static final int OCRNL
      Translate carriage return to newline (output).
      See Also:
    • ONOCR

      public static final int ONOCR
      Translate newline to carriage return-newline (output).
      See Also:
    • ONLRET

      public static final int ONLRET
      Newline performs a carriage return (output).
      See Also:
    • CS7

      public static final int CS7
      7 bit mode.
      See Also:
    • CS8

      public static final int CS8
      8 bit mode.
      See Also:
    • PARENB

      public static final int PARENB
      Parity enable.
      See Also:
    • PARODD

      public static final int PARODD
      Odd parity, else even.
      See Also:
    • TTY_OP_ISPEED

      public static final int TTY_OP_ISPEED
      Specifies the input baud rate in bits per second.
      See Also:
    • TTY_OP_OSPEED

      public static final int TTY_OP_OSPEED
      Specifies the output baud rate in bits per second.
      See Also:
  • Constructor Details

  • Method Details

    • reset

      @Deprecated(since="3.1.0", forRemoval=true) public void reset()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Clear the modes
    • setTerminalMode

      @Deprecated(since="3.1.0", forRemoval=true) public void setTerminalMode(int mode, int value) throws com.sshtools.common.ssh.SshException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Set an integer value mode
      Parameters:
      mode - int
      value - int
      Throws:
      com.sshtools.common.ssh.SshException
    • setTerminalMode

      @Deprecated(since="3.1.0", forRemoval=true) public void setTerminalMode(int mode, boolean value) throws com.sshtools.common.ssh.SshException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Set a boolean value mode
      Parameters:
      mode - int
      value - boolean
      Throws:
      com.sshtools.common.ssh.SshException
    • toByteArray

      public byte[] toByteArray()
      Returns the encoded modes for use by the SshSession.
      Returns:
      byte[]