com.maverick.ssh
Class PseudoTerminalModes

java.lang.Object
  extended bycom.maverick.ssh.PseudoTerminalModes

public class PseudoTerminalModes
extends java.lang.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.

 SshSession session = ssh.openSessionChannel();
 PseudoTerminalModes modes = new PseudoTerminalModes(ssh);

 // Turning off echo
 modes.setTerminalMode(PseudoTerminalModes.ECHO, false);

 // Setting the Input/Output baud rate
 modes.setTerminalMode(PseudoTerminalModes.TTY_OP_ISPEED, 38400);
 modes.setTerminalMode(PseudoTerminalModes.TTY_OP_OSPEED, 38400);

 session.requestPseudoTerminal("vt100", 80, 24, 0, 0, modes);
 

You can reuse an instance of this class providing that you do not want to change any of the modes. If you to want to change modes you can call the reset method to clear out old modes.

Author:
Lee David Painter

Field Summary
static int CS7
          7 bit mode.
static int CS8
          8 bit mode.
static int ECHO
          Enable echoing.
static int ECHOCTL
          Echo control characters as ^(Char).
static int ECHOE
          Visually erase chars.
static int ECHOK
          Kill character discards current line.
static int ECHOKE
          Visual erase for line kill.
static int ECHONL
          Echo NL even if ECHO is off.
static int ICANON
          Canonicalize input lines.
static int ICRNL
          Map CR to NL on input.
static int IEXTEN
          Enable extensions.
static int IGNCR
          Ignore CR on input.
static int IGNPAR
          The ignore parity flag.
static int IMAXBEL
          Ring bell on input queue full.
static int INLCR
          Map NL into CR on input.
static int INPCK
          Enable checking of parity errors.
static int ISIG
          Enable signals INTR, QUIT, [D]SUSP.
static int ISTRIP
          Strip 8th bit off characters.
static int IUCLC
          Translate uppercase characters to lowercase.
static int IXANY
          Any char will restart after stop.
static int IXOFF
          Enable input flow control.
static int IXON
          Enable output flow control.
static int NOFLSH
          Don't flush after interrupt.
static int OCRNL
          Translate carriage return to newline (output).
static int OLCUC
          Convert lowercase to uppercase.
static int ONLCR
          Map NL to CR-NL.
static int ONLRET
          Newline performs a carriage return (output).
static int ONOCR
          Translate newline to carriage return-newline (output).
static int OPOST
          Enable output processing.
static int PARENB
          Parity enable.
static int PARMRK
          Mark parity and framing errors.
static int PARODD
          Odd parity, else even.
static int PENDIN
          Retype pending input.
static int TOSTOP
          Stop background jobs from output.
static int TTY_OP_ISPEED
          Specifies the input baud rate in bits per second.
static int TTY_OP_OSPEED
          Specifies the output baud rate in bits per second.
static int VDISCARD
          Toggles the flushing of terminal output.
static int VDSUSP
          Another suspend character.
static int VEOF
          End-of-file character (sends EOF from the terminal).
static int VEOL
          End-of-line character in addition to carriage return and/or linefeed.
static int VEOL2
          Additional end-of-line character.
static int VERASE
          Erase the character to left of the cursor.
static int VFLUSH
          Character to flush output.
static int VINTR
          Interrupt character; 255 if none.
static int VKILL
          Kill the current input line.
static int VLNEXT
          Enter the next character typed literally, even if it is a special character
static int VQUIT
          The quit character (sends SIGQUIT signal on POSIX systems).
static int VREPRINT
          Reprints the current input line.
static int VSTART
          Continues paused output (normally control-Q).
static int VSTATUS
          Prints system status line (load, command, pid, etc).
static int VSTOP
          Pauses output (normally control-S).
static int VSUSP
          Suspends the current program.
static int VSWITCH
          Switch to a different shell layer.
static int VWERASE
          Erases a word left of cursor.
static int XCASE
          Enable input and output of uppercase characters by preceding their lowercase equivalents with "\".
 
Constructor Summary
PseudoTerminalModes(SshClient client)
           
 
Method Summary
 void reset()
          Clear the modes
 void setTerminalMode(int mode, boolean value)
          Set a boolean value mode
 void setTerminalMode(int mode, int value)
          Set an integer value mode
 byte[] toByteArray()
          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 Detail

VINTR

public static final int VINTR
Interrupt character; 255 if none.

See Also:
Constant Field Values

VQUIT

public static final int VQUIT
The quit character (sends SIGQUIT signal on POSIX systems).

See Also:
Constant Field Values

VERASE

public static final int VERASE
Erase the character to left of the cursor.

See Also:
Constant Field Values

VKILL

public static final int VKILL
Kill the current input line.

See Also:
Constant Field Values

VEOF

public static final int VEOF
End-of-file character (sends EOF from the terminal).

See Also:
Constant Field Values

VEOL

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

See Also:
Constant Field Values

VEOL2

public static final int VEOL2
Additional end-of-line character.

See Also:
Constant Field Values

VSTART

public static final int VSTART
Continues paused output (normally control-Q).

See Also:
Constant Field Values

VSTOP

public static final int VSTOP
Pauses output (normally control-S).

See Also:
Constant Field Values

VSUSP

public static final int VSUSP
Suspends the current program.

See Also:
Constant Field Values

VDSUSP

public static final int VDSUSP
Another suspend character.

See Also:
Constant Field Values

VREPRINT

public static final int VREPRINT
Reprints the current input line.

See Also:
Constant Field Values

VWERASE

public static final int VWERASE
Erases a word left of cursor.

See Also:
Constant Field Values

VLNEXT

public static final int VLNEXT
Enter the next character typed literally, even if it is a special character

See Also:
Constant Field Values

VFLUSH

public static final int VFLUSH
Character to flush output.

See Also:
Constant Field Values

VSWITCH

public static final int VSWITCH
Switch to a different shell layer.

See Also:
Constant Field Values

VSTATUS

public static final int VSTATUS
Prints system status line (load, command, pid, etc).

See Also:
Constant Field Values

VDISCARD

public static final int VDISCARD
Toggles the flushing of terminal output.

See Also:
Constant Field Values

IGNPAR

public static final int IGNPAR
The ignore parity flag. The parameter SHOULD be 0 if this flag is FALSE set, and 1 if it is TRUE.

See Also:
Constant Field Values

PARMRK

public static final int PARMRK
Mark parity and framing errors.

See Also:
Constant Field Values

INPCK

public static final int INPCK
Enable checking of parity errors.

See Also:
Constant Field Values

ISTRIP

public static final int ISTRIP
Strip 8th bit off characters.

See Also:
Constant Field Values

INLCR

public static final int INLCR
Map NL into CR on input.

See Also:
Constant Field Values

IGNCR

public static final int IGNCR
Ignore CR on input.

See Also:
Constant Field Values

ICRNL

public static final int ICRNL
Map CR to NL on input.

See Also:
Constant Field Values

IUCLC

public static final int IUCLC
Translate uppercase characters to lowercase.

See Also:
Constant Field Values

IXON

public static final int IXON
Enable output flow control.

See Also:
Constant Field Values

IXANY

public static final int IXANY
Any char will restart after stop.

See Also:
Constant Field Values

IXOFF

public static final int IXOFF
Enable input flow control.

See Also:
Constant Field Values

IMAXBEL

public static final int IMAXBEL
Ring bell on input queue full.

See Also:
Constant Field Values

ISIG

public static final int ISIG
Enable signals INTR, QUIT, [D]SUSP.

See Also:
Constant Field Values

ICANON

public static final int ICANON
Canonicalize input lines.

See Also:
Constant Field Values

XCASE

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

See Also:
Constant Field Values

ECHO

public static final int ECHO
Enable echoing.

See Also:
Constant Field Values

ECHOE

public static final int ECHOE
Visually erase chars.

See Also:
Constant Field Values

ECHOK

public static final int ECHOK
Kill character discards current line.

See Also:
Constant Field Values

ECHONL

public static final int ECHONL
Echo NL even if ECHO is off.

See Also:
Constant Field Values

NOFLSH

public static final int NOFLSH
Don't flush after interrupt.

See Also:
Constant Field Values

TOSTOP

public static final int TOSTOP
Stop background jobs from output.

See Also:
Constant Field Values

IEXTEN

public static final int IEXTEN
Enable extensions.

See Also:
Constant Field Values

ECHOCTL

public static final int ECHOCTL
Echo control characters as ^(Char).

See Also:
Constant Field Values

ECHOKE

public static final int ECHOKE
Visual erase for line kill.

See Also:
Constant Field Values

PENDIN

public static final int PENDIN
Retype pending input.

See Also:
Constant Field Values

OPOST

public static final int OPOST
Enable output processing.

See Also:
Constant Field Values

OLCUC

public static final int OLCUC
Convert lowercase to uppercase.

See Also:
Constant Field Values

ONLCR

public static final int ONLCR
Map NL to CR-NL.

See Also:
Constant Field Values

OCRNL

public static final int OCRNL
Translate carriage return to newline (output).

See Also:
Constant Field Values

ONOCR

public static final int ONOCR
Translate newline to carriage return-newline (output).

See Also:
Constant Field Values

ONLRET

public static final int ONLRET
Newline performs a carriage return (output).

See Also:
Constant Field Values

CS7

public static final int CS7
7 bit mode.

See Also:
Constant Field Values

CS8

public static final int CS8
8 bit mode.

See Also:
Constant Field Values

PARENB

public static final int PARENB
Parity enable.

See Also:
Constant Field Values

PARODD

public static final int PARODD
Odd parity, else even.

See Also:
Constant Field Values

TTY_OP_ISPEED

public static final int TTY_OP_ISPEED
Specifies the input baud rate in bits per second.

See Also:
Constant Field Values

TTY_OP_OSPEED

public static final int TTY_OP_OSPEED
Specifies the output baud rate in bits per second.

See Also:
Constant Field Values
Constructor Detail

PseudoTerminalModes

public PseudoTerminalModes(SshClient client)
Method Detail

reset

public void reset()
Clear the modes


setTerminalMode

public void setTerminalMode(int mode,
                            int value)
                     throws SshException
Set an integer value mode

Parameters:
mode - int
value - int
Throws:
SshException

setTerminalMode

public void setTerminalMode(int mode,
                            boolean value)
                     throws SshException
Set a boolean value mode

Parameters:
mode - int
value - boolean
Throws:
SshException

toByteArray

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

Returns:
byte[]


Copyright © 2003 3SP LTD. All Rights Reserved.