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