Sample Encodings of Terminal Modes in SSH 1.5

There is a good explanation of ASCII available at this site - http://daffy.robelle.com/smugbook/ascii.html
This is a sample SSH_CMSG_REQUEST_PTY Packet (Packet Type 10) taken from a Linux SSH client.

`31 9d 65 fc dc 0a 00 00 00 05 76 74 31 30 32 00 00 00 36 00 00 00 51 00 00 00 21 00 00 00 00 c1 00 00 25 80 c0 00 00 25 80 01 03 02 1c 03 7f 04 15 05 04 06 00 07 00 08 11 09 13 0a 1a 0c 12 0d 17 0e 16 12 0f 1e 00 1f 00 20 00 21 00 22 00 23 00 24 01 25 00 26 01 27 00 28 00 29 00 32 01 33 01 34 00 35 01 36 01 37 01 38 00 39 00 3a 00 3b 01 3c 01 3d 01 3e 00 46 01 47 00 48 01 49 00 4a 00 4b 00 5a 01 5b 01 5c 00 5d 00 00 fe 06 d1 6a```

`PTY Encoded Data in red.`

All this stuff took me a while to figure out and I only understood it after I put the client into debug mode and looked at the raw packets being sent. Hopefully the breakdown here will help you with your own ssh implementations.

The Breakdown

First two opcodes have 4 byte arguments
`c1 00 00 25 80 - 129 TTY_OP_ISPEED - Specifies Input Baud Rate`
`c0 00 00 25 80 - 128 TTY_OP_OSPEED - Specifies Output Baud Rate```

`Rest of the Opcodes (01 - 5D) have one byte arguments`
`HEXOP HEXARG [DECIMAL OPCODE] Description```

`01 03 [01 VINTR ] - Interrupt Character (CTRL-C)`
`02 1C [02 VQUIT ] - SIGQUIT Character (CTRL-\)`
`03 7F [03 VERASE ] - Erase character to left of cursor (DELETE Key)`
`04 16 [04 VKILL ] - Kill the current line input (CTRL-V)`
`05 04 [05 VEOF ] - End of File Character (CTRL-D)`
`06 00 [06 VEOL ] - End of Line Character`
`07 00 [07 VEOL2 ] - Additional End of line char`
`08 11 [08 VSTART ] - Continues Paused output`
`09 13 [09 VSTOP ] - XON/XOFF to pause listings (CTRL-S)`
`0A 1A [10 VDSUSP ] - Suspends current program (CTRL-Z)`
`0C 12 [12 VREPRINT] - Reprint current line (CTRL-R)`
`0D 17 [13 VWERASE ] - Erases a word to left of character (CTRL-W)`
`0E 16 [14 VLNEXT ] - Enter next char typed literally (CTRL-V)`
`12 0F [18 VDISCARD] - Flushing of output terminal (CTRL-O)```

The following settings are set to 00 (FALSE) or 01 (TRUE) for
their arguments.``

`1E 00 [30 IGNPAR ] - Ignore Parity (FALSE)`
`1F 00 [31 PARMRK ] - Mark parity and framing errors (FALSE)`
`20 00 [32 INPCK ] - Enable checking of parity errors (FALSE)`
`21 00 [33 ISTRIP ] - Strip Eighth Bit (FALSE)`
`22 00 [34 INLCR ] - Map NL into CR on input (FALSE)`
`23 00 [35 IGNCR ] - Ignore CR on input (FALSE)`
`24 01 [36 ICRNL ] - Map CR to NL on input (TRUE)`
`25 00 [37 IUCLC ] - Tranlsate upper to lower case (FALSE)`
`26 01 [38 IXON ] - Enable output flow control (TRUE)`
`27 00 [39 IXANY ] - Any char will restart after stop (FALSE)`
`28 00 [40 IXOFF ] - Enable input flow control (FALSE)`
`29 00 [41 IMAXBEL ] - Ring bel on input queue full (FALSE)`
`32 01 [50 ISIG ] - Enable INTR, QUIT, SUSP (TRUE)`
`33 01 [51 ICANON ] - Canonicalize input lines (TRUE)`
`34 00 [52 XCASE ] - Enable input and output of upper case with \ (FALSE)`
`35 01 [53 ECHO ] - Enable echoing (TRUE)`
`36 01 [54 ECHOE ] - Visually Erase chars (TRUE)`
`37 01 [55 ECHOK ] - Kill character discards current line (TRUE)`
`38 00 [56 ECHONL ] - Echo New Line even if ECHO is off (FALSE)`
`39 00 [57 NOFLSH ] - Don't flush after interrupt (FALSE)`
`3A 00 [58 TOSTOP ] - Stop background jobs from output (FALSE)`
`3B 01 [59 IEXTEN ] - Enable extensions (TRUE)`
`3C 01 [60 ECHOCTL ] - Echo control characters as ^char (TRUE)`
`3D 01 [61 ECHOKE ] - Visual erase for line kill (TRUE)`
`3E 01 [62 PENDIN ] - Retype pending input (TRUE)`
`46 01 [70 OPOST ] - Enable output processing (TRUE)`
`47 00 [71 OLCUC ] - Conver lower case to uppercase (FALSE)`
`48 01 [72 ONLCR ] - Map NL to NL-CR (TRUE)`
`49 00 [73 OCRNL ] - Translate carriage return to newline (output) (FALSE)`
`4A 00 [74 ONOCR ] - Translate newline to carriage return - newline`
`(output). (FALSE)`
`4B 00 [75 ONLRET ] - Newline performs a carriage return (output) (FALSE)`
`5A 01 [90 CS7 ] - 7 BIT mode (TRUE)`
`5B 01 [91 CS8 ] - 8 BIT mode (TRUE)`
`5C 00 [92 PARENB ] - Parity Enable`
`5D 00 [93 PARODD ] - Odd parity, else even`
`00 - TTY_OP_END (End of encoding)`