blob: ad980e98cfe01c89238959321765f8d1bd7df9b1 [file] [log] [blame]
Ben Lindstromae8e2d32001-04-14 23:13:02 +00001/* RCSID("$OpenBSD: ttymodes.h,v 1.11 2001/04/14 16:33:20 stevesk Exp $"); */
Damien Millerd4a8b7e1999-10-27 13:42:43 +10002/*
Damien Miller95def091999-11-25 00:26:21 +11003 * Author: Tatu Ylonen <ylo@cs.hut.fi>
Damien Miller95def091999-11-25 00:26:21 +11004 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
5 * All rights reserved
Damien Miller4af51302000-04-16 11:18:38 +10006 *
Damien Millere4340be2000-09-16 13:29:08 +11007 * As far as I am concerned, the code I have written for this software
8 * can be used freely for any purpose. Any derived versions of this
9 * software must be clearly marked as such, and if the derived work is
10 * incompatible with the protocol description in the RFC file, it must be
11 * called by a name other than "ssh" or "Secure Shell".
Damien Miller95def091999-11-25 00:26:21 +110012 */
Damien Millerd4a8b7e1999-10-27 13:42:43 +100013
Ben Lindstromae8e2d32001-04-14 23:13:02 +000014/*
15 * SSH2 tty modes support by Kevin Steves.
16 * Copyright (c) 2001 Kevin Steves. All rights reserved.
17 *
18 * Redistribution and use in source and binary forms, with or without
19 * modification, are permitted provided that the following conditions
20 * are met:
21 * 1. Redistributions of source code must retain the above copyright
22 * notice, this list of conditions and the following disclaimer.
23 * 2. Redistributions in binary form must reproduce the above copyright
24 * notice, this list of conditions and the following disclaimer in the
25 * documentation and/or other materials provided with the distribution.
26 *
27 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
28 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
29 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
30 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
31 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
32 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
33 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
34 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
36 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 */
Damien Millerd4a8b7e1999-10-27 13:42:43 +100038
Ben Lindstromae8e2d32001-04-14 23:13:02 +000039/*
40 * SSH1:
41 * The tty mode description is a stream of bytes. The stream consists of
Damien Miller95def091999-11-25 00:26:21 +110042 * opcode-arguments pairs. It is terminated by opcode TTY_OP_END (0).
43 * Opcodes 1-127 have one-byte arguments. Opcodes 128-159 have integer
44 * arguments. Opcodes 160-255 are not yet defined, and cause parsing to
45 * stop (they should only be used after any other data).
46 *
Ben Lindstromae8e2d32001-04-14 23:13:02 +000047 * SSH2:
48 * Differences between SSH1 and SSH2 terminal mode encoding include:
49 * 1. Encoded terminal modes are represented as a string, and a stream
50 * of bytes within that string.
51 * 2. Opcode arguments are uint32 (1-159); 160-255 remain undefined.
52 * 3. The values for TTY_OP_ISPEED and TTY_OP_OSPEED are different;
53 * 128 and 129 vs. 192 and 193 respectively.
54 *
Damien Miller95def091999-11-25 00:26:21 +110055 * The client puts in the stream any modes it knows about, and the
56 * server ignores any modes it does not know about. This allows some degree
57 * of machine-independence, at least between systems that use a posix-like
58 * tty interface. The protocol can support other systems as well, but might
59 * require reimplementing as mode names would likely be different.
60 */
Damien Millerd4a8b7e1999-10-27 13:42:43 +100061
Damien Miller95def091999-11-25 00:26:21 +110062/*
63 * Some constants and prototypes are defined in packet.h; this file
Damien Miller5428f641999-11-25 11:54:57 +110064 * is only intended for including from ttymodes.c.
Damien Miller95def091999-11-25 00:26:21 +110065 */
Damien Millerd4a8b7e1999-10-27 13:42:43 +100066
Ben Lindstrom00261542001-03-10 17:17:28 +000067/* termios macro */
Damien Millerd4a8b7e1999-10-27 13:42:43 +100068/* name, op */
Ben Lindstrom00261542001-03-10 17:17:28 +000069TTYCHAR(VINTR, 1)
70TTYCHAR(VQUIT, 2)
71TTYCHAR(VERASE, 3)
Damien Millerd4a8b7e1999-10-27 13:42:43 +100072#if defined(VKILL)
Ben Lindstrom00261542001-03-10 17:17:28 +000073TTYCHAR(VKILL, 4)
Damien Miller5428f641999-11-25 11:54:57 +110074#endif /* VKILL */
Ben Lindstrom00261542001-03-10 17:17:28 +000075TTYCHAR(VEOF, 5)
Damien Millerd4a8b7e1999-10-27 13:42:43 +100076#if defined(VEOL)
Ben Lindstrom00261542001-03-10 17:17:28 +000077TTYCHAR(VEOL, 6)
Damien Miller5428f641999-11-25 11:54:57 +110078#endif /* VEOL */
Ben Lindstrom00261542001-03-10 17:17:28 +000079#ifdef VEOL2
Damien Millerd4a8b7e1999-10-27 13:42:43 +100080TTYCHAR(VEOL2, 7)
Damien Miller5428f641999-11-25 11:54:57 +110081#endif /* VEOL2 */
Ben Lindstrom00261542001-03-10 17:17:28 +000082TTYCHAR(VSTART, 8)
83TTYCHAR(VSTOP, 9)
Damien Millerd4a8b7e1999-10-27 13:42:43 +100084#if defined(VSUSP)
Ben Lindstrom00261542001-03-10 17:17:28 +000085TTYCHAR(VSUSP, 10)
Damien Miller5428f641999-11-25 11:54:57 +110086#endif /* VSUSP */
Damien Millerd4a8b7e1999-10-27 13:42:43 +100087#if defined(VDSUSP)
Ben Lindstrom00261542001-03-10 17:17:28 +000088TTYCHAR(VDSUSP, 11)
Damien Miller5428f641999-11-25 11:54:57 +110089#endif /* VDSUSP */
Damien Millerd4a8b7e1999-10-27 13:42:43 +100090#if defined(VREPRINT)
Ben Lindstrom00261542001-03-10 17:17:28 +000091TTYCHAR(VREPRINT, 12)
Damien Miller5428f641999-11-25 11:54:57 +110092#endif /* VREPRINT */
Damien Millerd4a8b7e1999-10-27 13:42:43 +100093#if defined(VWERASE)
Ben Lindstrom00261542001-03-10 17:17:28 +000094TTYCHAR(VWERASE, 13)
Damien Miller5428f641999-11-25 11:54:57 +110095#endif /* VWERASE */
Damien Millerd4a8b7e1999-10-27 13:42:43 +100096#if defined(VLNEXT)
Ben Lindstrom00261542001-03-10 17:17:28 +000097TTYCHAR(VLNEXT, 14)
Damien Miller5428f641999-11-25 11:54:57 +110098#endif /* VLNEXT */
Damien Millerd4a8b7e1999-10-27 13:42:43 +100099#if defined(VFLUSH)
Ben Lindstrom00261542001-03-10 17:17:28 +0000100TTYCHAR(VFLUSH, 15)
Damien Miller5428f641999-11-25 11:54:57 +1100101#endif /* VFLUSH */
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000102#ifdef VSWTCH
Ben Lindstrom00261542001-03-10 17:17:28 +0000103TTYCHAR(VSWTCH, 16)
Damien Miller5428f641999-11-25 11:54:57 +1100104#endif /* VSWTCH */
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000105#if defined(VSTATUS)
Ben Lindstrom00261542001-03-10 17:17:28 +0000106TTYCHAR(VSTATUS, 17)
Damien Miller5428f641999-11-25 11:54:57 +1100107#endif /* VSTATUS */
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000108#ifdef VDISCARD
Ben Lindstrom00261542001-03-10 17:17:28 +0000109TTYCHAR(VDISCARD, 18)
Damien Miller5428f641999-11-25 11:54:57 +1100110#endif /* VDISCARD */
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000111
112/* name, field, op */
Ben Lindstrom00261542001-03-10 17:17:28 +0000113TTYMODE(IGNPAR, c_iflag, 30)
114TTYMODE(PARMRK, c_iflag, 31)
115TTYMODE(INPCK, c_iflag, 32)
116TTYMODE(ISTRIP, c_iflag, 33)
117TTYMODE(INLCR, c_iflag, 34)
118TTYMODE(IGNCR, c_iflag, 35)
119TTYMODE(ICRNL, c_iflag, 36)
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000120#if defined(IUCLC)
Ben Lindstrom00261542001-03-10 17:17:28 +0000121TTYMODE(IUCLC, c_iflag, 37)
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000122#endif
Ben Lindstrom00261542001-03-10 17:17:28 +0000123TTYMODE(IXON, c_iflag, 38)
124TTYMODE(IXANY, c_iflag, 39)
125TTYMODE(IXOFF, c_iflag, 40)
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000126#ifdef IMAXBEL
Ben Lindstrom00261542001-03-10 17:17:28 +0000127TTYMODE(IMAXBEL,c_iflag, 41)
Damien Miller5428f641999-11-25 11:54:57 +1100128#endif /* IMAXBEL */
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000129
Ben Lindstrom00261542001-03-10 17:17:28 +0000130TTYMODE(ISIG, c_lflag, 50)
131TTYMODE(ICANON, c_lflag, 51)
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000132#ifdef XCASE
Ben Lindstrom00261542001-03-10 17:17:28 +0000133TTYMODE(XCASE, c_lflag, 52)
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000134#endif
Ben Lindstrom00261542001-03-10 17:17:28 +0000135TTYMODE(ECHO, c_lflag, 53)
136TTYMODE(ECHOE, c_lflag, 54)
137TTYMODE(ECHOK, c_lflag, 55)
138TTYMODE(ECHONL, c_lflag, 56)
139TTYMODE(NOFLSH, c_lflag, 57)
140TTYMODE(TOSTOP, c_lflag, 58)
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000141#ifdef IEXTEN
Ben Lindstrom00261542001-03-10 17:17:28 +0000142TTYMODE(IEXTEN, c_lflag, 59)
Damien Miller5428f641999-11-25 11:54:57 +1100143#endif /* IEXTEN */
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000144#if defined(ECHOCTL)
Ben Lindstrom00261542001-03-10 17:17:28 +0000145TTYMODE(ECHOCTL,c_lflag, 60)
Damien Miller5428f641999-11-25 11:54:57 +1100146#endif /* ECHOCTL */
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000147#ifdef ECHOKE
Ben Lindstrom00261542001-03-10 17:17:28 +0000148TTYMODE(ECHOKE, c_lflag, 61)
Damien Miller5428f641999-11-25 11:54:57 +1100149#endif /* ECHOKE */
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000150#if defined(PENDIN)
Ben Lindstrom00261542001-03-10 17:17:28 +0000151TTYMODE(PENDIN, c_lflag, 62)
Damien Miller5428f641999-11-25 11:54:57 +1100152#endif /* PENDIN */
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000153
Ben Lindstrom00261542001-03-10 17:17:28 +0000154TTYMODE(OPOST, c_oflag, 70)
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000155#if defined(OLCUC)
Ben Lindstrom00261542001-03-10 17:17:28 +0000156TTYMODE(OLCUC, c_oflag, 71)
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000157#endif
Ben Lindstrom00261542001-03-10 17:17:28 +0000158TTYMODE(ONLCR, c_oflag, 72)
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000159#ifdef OCRNL
Ben Lindstrom00261542001-03-10 17:17:28 +0000160TTYMODE(OCRNL, c_oflag, 73)
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000161#endif
162#ifdef ONOCR
Ben Lindstrom00261542001-03-10 17:17:28 +0000163TTYMODE(ONOCR, c_oflag, 74)
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000164#endif
165#ifdef ONLRET
Ben Lindstrom00261542001-03-10 17:17:28 +0000166TTYMODE(ONLRET, c_oflag, 75)
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000167#endif
168
Ben Lindstrom00261542001-03-10 17:17:28 +0000169TTYMODE(CS7, c_cflag, 90)
170TTYMODE(CS8, c_cflag, 91)
171TTYMODE(PARENB, c_cflag, 92)
172TTYMODE(PARODD, c_cflag, 93)