xref: /titanic_50/usr/src/cmd/ssh/include/ttymodes.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate /*	$OpenBSD: ttymodes.h,v 1.12 2002/03/04 17:27:39 stevesk Exp $	*/
2*7c478bd9Sstevel@tonic-gate 
3*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
4*7c478bd9Sstevel@tonic-gate 
5*7c478bd9Sstevel@tonic-gate /*
6*7c478bd9Sstevel@tonic-gate  * NOTE: This file MUST NOT have a header guard added!!!
7*7c478bd9Sstevel@tonic-gate  *
8*7c478bd9Sstevel@tonic-gate  * This header is included twice in ttymodes.c, which defines the TTYCHAR()
9*7c478bd9Sstevel@tonic-gate  * and TTYMODE() macros, used below, twice, once prior to inclusion of this
10*7c478bd9Sstevel@tonic-gate  * file in tty_make_modes() and once prior to inclusion of this file in
11*7c478bd9Sstevel@tonic-gate  * tty_parse_modes().
12*7c478bd9Sstevel@tonic-gate  */
13*7c478bd9Sstevel@tonic-gate 
14*7c478bd9Sstevel@tonic-gate /*
15*7c478bd9Sstevel@tonic-gate  * Author: Tatu Ylonen <ylo@cs.hut.fi>
16*7c478bd9Sstevel@tonic-gate  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
17*7c478bd9Sstevel@tonic-gate  *                    All rights reserved
18*7c478bd9Sstevel@tonic-gate  *
19*7c478bd9Sstevel@tonic-gate  * As far as I am concerned, the code I have written for this software
20*7c478bd9Sstevel@tonic-gate  * can be used freely for any purpose.  Any derived versions of this
21*7c478bd9Sstevel@tonic-gate  * software must be clearly marked as such, and if the derived work is
22*7c478bd9Sstevel@tonic-gate  * incompatible with the protocol description in the RFC file, it must be
23*7c478bd9Sstevel@tonic-gate  * called by a name other than "ssh" or "Secure Shell".
24*7c478bd9Sstevel@tonic-gate  */
25*7c478bd9Sstevel@tonic-gate 
26*7c478bd9Sstevel@tonic-gate /*
27*7c478bd9Sstevel@tonic-gate  * SSH2 tty modes support by Kevin Steves.
28*7c478bd9Sstevel@tonic-gate  * Copyright (c) 2001 Kevin Steves.  All rights reserved.
29*7c478bd9Sstevel@tonic-gate  *
30*7c478bd9Sstevel@tonic-gate  * Redistribution and use in source and binary forms, with or without
31*7c478bd9Sstevel@tonic-gate  * modification, are permitted provided that the following conditions
32*7c478bd9Sstevel@tonic-gate  * are met:
33*7c478bd9Sstevel@tonic-gate  * 1. Redistributions of source code must retain the above copyright
34*7c478bd9Sstevel@tonic-gate  *    notice, this list of conditions and the following disclaimer.
35*7c478bd9Sstevel@tonic-gate  * 2. Redistributions in binary form must reproduce the above copyright
36*7c478bd9Sstevel@tonic-gate  *    notice, this list of conditions and the following disclaimer in the
37*7c478bd9Sstevel@tonic-gate  *    documentation and/or other materials provided with the distribution.
38*7c478bd9Sstevel@tonic-gate  *
39*7c478bd9Sstevel@tonic-gate  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
40*7c478bd9Sstevel@tonic-gate  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
41*7c478bd9Sstevel@tonic-gate  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
42*7c478bd9Sstevel@tonic-gate  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
43*7c478bd9Sstevel@tonic-gate  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
44*7c478bd9Sstevel@tonic-gate  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
45*7c478bd9Sstevel@tonic-gate  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
46*7c478bd9Sstevel@tonic-gate  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
47*7c478bd9Sstevel@tonic-gate  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
48*7c478bd9Sstevel@tonic-gate  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
49*7c478bd9Sstevel@tonic-gate  */
50*7c478bd9Sstevel@tonic-gate /*
51*7c478bd9Sstevel@tonic-gate  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
52*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
53*7c478bd9Sstevel@tonic-gate  */
54*7c478bd9Sstevel@tonic-gate 
55*7c478bd9Sstevel@tonic-gate /*
56*7c478bd9Sstevel@tonic-gate  * SSH1:
57*7c478bd9Sstevel@tonic-gate  * The tty mode description is a stream of bytes.  The stream consists of
58*7c478bd9Sstevel@tonic-gate  * opcode-arguments pairs.  It is terminated by opcode TTY_OP_END (0).
59*7c478bd9Sstevel@tonic-gate  * Opcodes 1-127 have one-byte arguments.  Opcodes 128-159 have integer
60*7c478bd9Sstevel@tonic-gate  * arguments.  Opcodes 160-255 are not yet defined, and cause parsing to
61*7c478bd9Sstevel@tonic-gate  * stop (they should only be used after any other data).
62*7c478bd9Sstevel@tonic-gate  *
63*7c478bd9Sstevel@tonic-gate  * SSH2:
64*7c478bd9Sstevel@tonic-gate  * Differences between SSH1 and SSH2 terminal mode encoding include:
65*7c478bd9Sstevel@tonic-gate  * 1. Encoded terminal modes are represented as a string, and a stream
66*7c478bd9Sstevel@tonic-gate  *    of bytes within that string.
67*7c478bd9Sstevel@tonic-gate  * 2. Opcode arguments are uint32 (1-159); 160-255 remain undefined.
68*7c478bd9Sstevel@tonic-gate  * 3. The values for TTY_OP_ISPEED and TTY_OP_OSPEED are different;
69*7c478bd9Sstevel@tonic-gate  *    128 and 129 vs. 192 and 193 respectively.
70*7c478bd9Sstevel@tonic-gate  *
71*7c478bd9Sstevel@tonic-gate  * The client puts in the stream any modes it knows about, and the
72*7c478bd9Sstevel@tonic-gate  * server ignores any modes it does not know about.  This allows some degree
73*7c478bd9Sstevel@tonic-gate  * of machine-independence, at least between systems that use a posix-like
74*7c478bd9Sstevel@tonic-gate  * tty interface.  The protocol can support other systems as well, but might
75*7c478bd9Sstevel@tonic-gate  * require reimplementing as mode names would likely be different.
76*7c478bd9Sstevel@tonic-gate  */
77*7c478bd9Sstevel@tonic-gate 
78*7c478bd9Sstevel@tonic-gate /*
79*7c478bd9Sstevel@tonic-gate  * Some constants and prototypes are defined in packet.h; this file
80*7c478bd9Sstevel@tonic-gate  * is only intended for including from ttymodes.c.
81*7c478bd9Sstevel@tonic-gate  */
82*7c478bd9Sstevel@tonic-gate 
83*7c478bd9Sstevel@tonic-gate /* termios macro */
84*7c478bd9Sstevel@tonic-gate /* name, op */
85*7c478bd9Sstevel@tonic-gate TTYCHAR(VINTR, 1)
86*7c478bd9Sstevel@tonic-gate TTYCHAR(VQUIT, 2)
87*7c478bd9Sstevel@tonic-gate TTYCHAR(VERASE, 3)
88*7c478bd9Sstevel@tonic-gate #if defined(VKILL)
89*7c478bd9Sstevel@tonic-gate TTYCHAR(VKILL, 4)
90*7c478bd9Sstevel@tonic-gate #endif /* VKILL */
91*7c478bd9Sstevel@tonic-gate TTYCHAR(VEOF, 5)
92*7c478bd9Sstevel@tonic-gate #if defined(VEOL)
93*7c478bd9Sstevel@tonic-gate TTYCHAR(VEOL, 6)
94*7c478bd9Sstevel@tonic-gate #endif /* VEOL */
95*7c478bd9Sstevel@tonic-gate #ifdef VEOL2
96*7c478bd9Sstevel@tonic-gate TTYCHAR(VEOL2, 7)
97*7c478bd9Sstevel@tonic-gate #endif /* VEOL2 */
98*7c478bd9Sstevel@tonic-gate TTYCHAR(VSTART, 8)
99*7c478bd9Sstevel@tonic-gate TTYCHAR(VSTOP, 9)
100*7c478bd9Sstevel@tonic-gate #if defined(VSUSP)
101*7c478bd9Sstevel@tonic-gate TTYCHAR(VSUSP, 10)
102*7c478bd9Sstevel@tonic-gate #endif /* VSUSP */
103*7c478bd9Sstevel@tonic-gate #if defined(VDSUSP)
104*7c478bd9Sstevel@tonic-gate TTYCHAR(VDSUSP, 11)
105*7c478bd9Sstevel@tonic-gate #endif /* VDSUSP */
106*7c478bd9Sstevel@tonic-gate #if defined(VREPRINT)
107*7c478bd9Sstevel@tonic-gate TTYCHAR(VREPRINT, 12)
108*7c478bd9Sstevel@tonic-gate #endif /* VREPRINT */
109*7c478bd9Sstevel@tonic-gate #if defined(VWERASE)
110*7c478bd9Sstevel@tonic-gate TTYCHAR(VWERASE, 13)
111*7c478bd9Sstevel@tonic-gate #endif /* VWERASE */
112*7c478bd9Sstevel@tonic-gate #if defined(VLNEXT)
113*7c478bd9Sstevel@tonic-gate TTYCHAR(VLNEXT, 14)
114*7c478bd9Sstevel@tonic-gate #endif /* VLNEXT */
115*7c478bd9Sstevel@tonic-gate #if defined(VFLUSH)
116*7c478bd9Sstevel@tonic-gate TTYCHAR(VFLUSH, 15)
117*7c478bd9Sstevel@tonic-gate #endif /* VFLUSH */
118*7c478bd9Sstevel@tonic-gate #ifdef VSWTCH
119*7c478bd9Sstevel@tonic-gate TTYCHAR(VSWTCH, 16)
120*7c478bd9Sstevel@tonic-gate #endif /* VSWTCH */
121*7c478bd9Sstevel@tonic-gate #if defined(VSTATUS)
122*7c478bd9Sstevel@tonic-gate TTYCHAR(VSTATUS, 17)
123*7c478bd9Sstevel@tonic-gate #endif /* VSTATUS */
124*7c478bd9Sstevel@tonic-gate #ifdef VDISCARD
125*7c478bd9Sstevel@tonic-gate TTYCHAR(VDISCARD, 18)
126*7c478bd9Sstevel@tonic-gate #endif /* VDISCARD */
127*7c478bd9Sstevel@tonic-gate 
128*7c478bd9Sstevel@tonic-gate /* name, field, op */
129*7c478bd9Sstevel@tonic-gate TTYMODE(IGNPAR,	c_iflag, 30)
130*7c478bd9Sstevel@tonic-gate TTYMODE(PARMRK,	c_iflag, 31)
131*7c478bd9Sstevel@tonic-gate TTYMODE(INPCK, 	c_iflag, 32)
132*7c478bd9Sstevel@tonic-gate TTYMODE(ISTRIP,	c_iflag, 33)
133*7c478bd9Sstevel@tonic-gate TTYMODE(INLCR, 	c_iflag, 34)
134*7c478bd9Sstevel@tonic-gate TTYMODE(IGNCR, 	c_iflag, 35)
135*7c478bd9Sstevel@tonic-gate TTYMODE(ICRNL, 	c_iflag, 36)
136*7c478bd9Sstevel@tonic-gate #if defined(IUCLC)
137*7c478bd9Sstevel@tonic-gate TTYMODE(IUCLC, 	c_iflag, 37)
138*7c478bd9Sstevel@tonic-gate #endif
139*7c478bd9Sstevel@tonic-gate TTYMODE(IXON,  	c_iflag, 38)
140*7c478bd9Sstevel@tonic-gate TTYMODE(IXANY, 	c_iflag, 39)
141*7c478bd9Sstevel@tonic-gate TTYMODE(IXOFF, 	c_iflag, 40)
142*7c478bd9Sstevel@tonic-gate #ifdef IMAXBEL
143*7c478bd9Sstevel@tonic-gate TTYMODE(IMAXBEL,c_iflag, 41)
144*7c478bd9Sstevel@tonic-gate #endif /* IMAXBEL */
145*7c478bd9Sstevel@tonic-gate 
146*7c478bd9Sstevel@tonic-gate TTYMODE(ISIG,	c_lflag, 50)
147*7c478bd9Sstevel@tonic-gate TTYMODE(ICANON,	c_lflag, 51)
148*7c478bd9Sstevel@tonic-gate #ifdef XCASE
149*7c478bd9Sstevel@tonic-gate TTYMODE(XCASE,	c_lflag, 52)
150*7c478bd9Sstevel@tonic-gate #endif
151*7c478bd9Sstevel@tonic-gate TTYMODE(ECHO,	c_lflag, 53)
152*7c478bd9Sstevel@tonic-gate TTYMODE(ECHOE,	c_lflag, 54)
153*7c478bd9Sstevel@tonic-gate TTYMODE(ECHOK,	c_lflag, 55)
154*7c478bd9Sstevel@tonic-gate TTYMODE(ECHONL,	c_lflag, 56)
155*7c478bd9Sstevel@tonic-gate TTYMODE(NOFLSH,	c_lflag, 57)
156*7c478bd9Sstevel@tonic-gate TTYMODE(TOSTOP,	c_lflag, 58)
157*7c478bd9Sstevel@tonic-gate #ifdef IEXTEN
158*7c478bd9Sstevel@tonic-gate TTYMODE(IEXTEN, c_lflag, 59)
159*7c478bd9Sstevel@tonic-gate #endif /* IEXTEN */
160*7c478bd9Sstevel@tonic-gate #if defined(ECHOCTL)
161*7c478bd9Sstevel@tonic-gate TTYMODE(ECHOCTL,c_lflag, 60)
162*7c478bd9Sstevel@tonic-gate #endif /* ECHOCTL */
163*7c478bd9Sstevel@tonic-gate #ifdef ECHOKE
164*7c478bd9Sstevel@tonic-gate TTYMODE(ECHOKE,	c_lflag, 61)
165*7c478bd9Sstevel@tonic-gate #endif /* ECHOKE */
166*7c478bd9Sstevel@tonic-gate #if defined(PENDIN)
167*7c478bd9Sstevel@tonic-gate TTYMODE(PENDIN,	c_lflag, 62)
168*7c478bd9Sstevel@tonic-gate #endif /* PENDIN */
169*7c478bd9Sstevel@tonic-gate 
170*7c478bd9Sstevel@tonic-gate TTYMODE(OPOST,	c_oflag, 70)
171*7c478bd9Sstevel@tonic-gate #if defined(OLCUC)
172*7c478bd9Sstevel@tonic-gate TTYMODE(OLCUC,	c_oflag, 71)
173*7c478bd9Sstevel@tonic-gate #endif
174*7c478bd9Sstevel@tonic-gate #ifdef ONLCR
175*7c478bd9Sstevel@tonic-gate TTYMODE(ONLCR,	c_oflag, 72)
176*7c478bd9Sstevel@tonic-gate #endif
177*7c478bd9Sstevel@tonic-gate #ifdef OCRNL
178*7c478bd9Sstevel@tonic-gate TTYMODE(OCRNL,	c_oflag, 73)
179*7c478bd9Sstevel@tonic-gate #endif
180*7c478bd9Sstevel@tonic-gate #ifdef ONOCR
181*7c478bd9Sstevel@tonic-gate TTYMODE(ONOCR,	c_oflag, 74)
182*7c478bd9Sstevel@tonic-gate #endif
183*7c478bd9Sstevel@tonic-gate #ifdef ONLRET
184*7c478bd9Sstevel@tonic-gate TTYMODE(ONLRET,	c_oflag, 75)
185*7c478bd9Sstevel@tonic-gate #endif
186*7c478bd9Sstevel@tonic-gate 
187*7c478bd9Sstevel@tonic-gate TTYMODE(CS7,	c_cflag, 90)
188*7c478bd9Sstevel@tonic-gate TTYMODE(CS8,	c_cflag, 91)
189*7c478bd9Sstevel@tonic-gate TTYMODE(PARENB,	c_cflag, 92)
190*7c478bd9Sstevel@tonic-gate TTYMODE(PARODD,	c_cflag, 93)
191