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