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