Make TELOPT_ENCRYPT 38, it's official option number.
[unix-history] / usr / src / include / arpa / telnet.h
CommitLineData
bb0cfa24
DF
1/*
2 * Copyright (c) 1983 Regents of the University of California.
fca22868 3 * All rights reserved.
bb0cfa24 4 *
269a7923 5 * %sccs.include.redist.c%
fca22868 6 *
5bf38209 7 * @(#)telnet.h 5.12 (Berkeley) %G%
bb0cfa24
DF
8 */
9
89e49f55
BJ
10/*
11 * Definitions for the TELNET protocol.
12 */
13#define IAC 255 /* interpret as command: */
14#define DONT 254 /* you are not to use option */
15#define DO 253 /* please, you use option */
16#define WONT 252 /* I won't use option */
17#define WILL 251 /* I will use option */
18#define SB 250 /* interpret as subnegotiation */
19#define GA 249 /* you may reverse the line */
20#define EL 248 /* erase the current line */
21#define EC 247 /* erase the current character */
22#define AYT 246 /* are you there */
23#define AO 245 /* abort output--but let prog finish */
24#define IP 244 /* interrupt process--permanently */
25#define BREAK 243 /* break */
26#define DM 242 /* data mark--for connect. cleaning */
27#define NOP 241 /* nop */
28#define SE 240 /* end sub negotiation */
529acda4 29#define EOR 239 /* end of record (transparent mode) */
d7635041
PB
30#define ABORT 238 /* Abort process */
31#define SUSP 237 /* Suspend process */
32#define xEOF 236 /* End of file: EOF is already used... */
89e49f55
BJ
33
34#define SYNCH 242 /* for telfunc calls */
35
6640dd4c
SL
36#ifdef TELCMDS
37char *telcmds[] = {
d7635041 38 "EOF", "SUSP", "ABORT", "EOR",
6640dd4c 39 "SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC",
d31f065b 40 "EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC", 0,
6640dd4c 41};
d31f065b
DB
42#else
43extern char *telcmds[];
44#endif
45
d7635041
PB
46#define TELCMD_FIRST xEOF
47#define TELCMD_LAST IAC
48#define TELCMD_OK(x) ((x) <= TELCMD_LAST && (x) >= TELCMD_FIRST)
49#define TELCMD(x) telcmds[(x)-TELCMD_FIRST]
89e49f55 50
6640dd4c 51/* telnet options */
89e49f55
BJ
52#define TELOPT_BINARY 0 /* 8-bit data path */
53#define TELOPT_ECHO 1 /* echo */
8f6b89f5
SL
54#define TELOPT_RCP 2 /* prepare to reconnect */
55#define TELOPT_SGA 3 /* suppress go ahead */
56#define TELOPT_NAMS 4 /* approximate message size */
57#define TELOPT_STATUS 5 /* give status */
58#define TELOPT_TM 6 /* timing mark */
59#define TELOPT_RCTE 7 /* remote controlled transmission and echo */
60#define TELOPT_NAOL 8 /* negotiate about output line width */
61#define TELOPT_NAOP 9 /* negotiate about output page size */
62#define TELOPT_NAOCRD 10 /* negotiate about CR disposition */
63#define TELOPT_NAOHTS 11 /* negotiate about horizontal tabstops */
64#define TELOPT_NAOHTD 12 /* negotiate about horizontal tab disposition */
65#define TELOPT_NAOFFD 13 /* negotiate about formfeed disposition */
66#define TELOPT_NAOVTS 14 /* negotiate about vertical tab stops */
67#define TELOPT_NAOVTD 15 /* negotiate about vertical tab disposition */
68#define TELOPT_NAOLFD 16 /* negotiate about output LF disposition */
69#define TELOPT_XASCII 17 /* extended ascic character set */
70#define TELOPT_LOGOUT 18 /* force logout */
71#define TELOPT_BM 19 /* byte macro */
72#define TELOPT_DET 20 /* data entry terminal */
73#define TELOPT_SUPDUP 21 /* supdup protocol */
6640dd4c
SL
74#define TELOPT_SUPDUPOUTPUT 22 /* supdup output */
75#define TELOPT_SNDLOC 23 /* send location */
3fd9f872 76#define TELOPT_TTYPE 24 /* terminal type */
6640dd4c 77#define TELOPT_EOR 25 /* end or record */
924182b1
GM
78#define TELOPT_TUID 26 /* TACACS user identification */
79#define TELOPT_OUTMRK 27 /* output marking */
80#define TELOPT_TTYLOC 28 /* terminal location number */
81#define TELOPT_3270REGIME 29 /* 3270 regime */
82#define TELOPT_X3PAD 30 /* X.3 PAD */
83#define TELOPT_NAWS 31 /* window size */
84#define TELOPT_TSPEED 32 /* terminal speed */
85#define TELOPT_LFLOW 33 /* remote flow control */
d7635041 86#define TELOPT_LINEMODE 34 /* Linemode option */
7b23ae18
PB
87#define TELOPT_XDISPLOC 35 /* X Display Location */
88#define TELOPT_ENVIRON 36 /* Environment variables */
d31f065b 89#define TELOPT_AUTHENTICATION 37/* Authenticate */
5bf38209 90#define TELOPT_ENCRYPT 38 /* Encryption option */
924182b1 91#define TELOPT_EXOPL 255 /* extended-options-list */
89e49f55 92
d31f065b
DB
93
94#define NTELOPTS (1+TELOPT_ENCRYPT)
1344037a 95#ifdef TELOPTS
d31f065b 96char *telopts[NTELOPTS+1] = {
89e49f55
BJ
97 "BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME",
98 "STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP",
99 "NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS",
8f6b89f5 100 "NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO",
529acda4
MK
101 "DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT",
102 "SEND LOCATION", "TERMINAL TYPE", "END OF RECORD",
924182b1
GM
103 "TACACS UID", "OUTPUT MARKING", "TTYLOC",
104 "3270 REGIME", "X.3 PAD", "NAWS", "TSPEED", "LFLOW",
d31f065b 105 "LINEMODE", "XDISPLOC", "ENVIRON", "AUTHENTICATION",
5bf38209 106 "ENCRYPT",
d31f065b 107 0,
89e49f55 108};
d7635041 109#define TELOPT_FIRST TELOPT_BINARY
d31f065b 110#define TELOPT_LAST TELOPT_ENCRYPT
d7635041
PB
111#define TELOPT_OK(x) ((x) <= TELOPT_LAST && (x) >= TELOPT_FIRST)
112#define TELOPT(x) telopts[(x)-TELOPT_FIRST]
89e49f55 113#endif
6640dd4c
SL
114
115/* sub-option qualifiers */
116#define TELQUAL_IS 0 /* option is... */
117#define TELQUAL_SEND 1 /* send option */
7b23ae18 118#define TELQUAL_INFO 2 /* ENVIRON: informational version of IS */
d31f065b 119#define TELQUAL_REPLY 2 /* AUTHENTICATION: client version of IS */
d7635041
PB
120
121/*
122 * LINEMODE suboptions
123 */
124
125#define LM_MODE 1
126#define LM_FORWARDMASK 2
127#define LM_SLC 3
128
129#define MODE_EDIT 0x01
130#define MODE_TRAPSIG 0x02
131#define MODE_ACK 0x04
7b23ae18
PB
132#define MODE_SOFT_TAB 0x08
133#define MODE_LIT_ECHO 0x10
d7635041 134
7b23ae18 135#define MODE_MASK 0x1f
d7635041
PB
136
137/* Not part of protocol, but needed to simplify things... */
8400d8f9
PB
138#define MODE_FLOW 0x0100
139#define MODE_ECHO 0x0200
140#define MODE_INBIN 0x0400
141#define MODE_OUTBIN 0x0800
142#define MODE_FORCE 0x1000
d7635041
PB
143
144#define SLC_SYNCH 1
145#define SLC_BRK 2
146#define SLC_IP 3
147#define SLC_AO 4
148#define SLC_AYT 5
149#define SLC_EOR 6
150#define SLC_ABORT 7
151#define SLC_EOF 8
152#define SLC_SUSP 9
153#define SLC_EC 10
154#define SLC_EL 11
155#define SLC_EW 12
156#define SLC_RP 13
157#define SLC_LNEXT 14
158#define SLC_XON 15
159#define SLC_XOFF 16
160#define SLC_FORW1 17
161#define SLC_FORW2 18
162
163#define NSLC 18
164
d31f065b
DB
165/*
166 * For backwards compatability, we define SLC_NAMES to be the
167 * list of names if SLC_NAMES is not defined.
168 */
169#define SLC_NAMELIST "0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \
d7635041 170 "ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \
d31f065b
DB
171 "LNEXT", "XON", "XOFF", "FORW1", "FORW2", 0,
172#ifdef SLC_NAMES
173char *slc_names[] = {
174 SLC_NAMELIST
175};
176#else
177extern char *slc_names[];
178#define SLC_NAMES SLC_NAMELIST
179#endif
180
181#define SLC_NAME_OK(x) ((x) >= 0 && (x) < NSLC)
182#define SLC_NAME(x) slc_names[x]
d7635041
PB
183
184#define SLC_NOSUPPORT 0
185#define SLC_CANTCHANGE 1
186#define SLC_VARIABLE 2
187#define SLC_DEFAULT 3
188#define SLC_LEVELBITS 0x03
189
190#define SLC_FUNC 0
191#define SLC_FLAGS 1
192#define SLC_VALUE 2
193
194#define SLC_ACK 0x80
195#define SLC_FLUSHIN 0x40
196#define SLC_FLUSHOUT 0x20
cab93fea 197
7b23ae18
PB
198#define ENV_VALUE 0
199#define ENV_VAR 1
200#define ENV_ESC 2
201
cab93fea
KF
202/*
203 * AUTHENTICATION suboptions
204 */
205
d31f065b
DB
206/*
207 * Who is authenticating who ...
208 */
209#define AUTH_WHO_CLIENT 0 /* Client authenticating server */
210#define AUTH_WHO_SERVER 1 /* Server authenticating client */
211#define AUTH_WHO_MASK 1
212
213/*
214 * amount of authentication done
215 */
216#define AUTH_HOW_ONE_WAY 0
217#define AUTH_HOW_MUTUAL 2
218#define AUTH_HOW_MASK 2
219
220#define AUTHTYPE_NULL 0
221#define AUTHTYPE_KERBEROS_V4 1
222#define AUTHTYPE_KERBEROS_V5 2
223#define AUTHTYPE_SPX 3
224#define AUTHTYPE_MINK 4
225#define AUTHTYPE_CNT 5
226
227#define AUTHTYPE_TEST 99
228
229#ifdef AUTH_NAMES
230char *authtype_names[] = {
231 "NULL", "KERBEROS_V4", "KERBEROS_V5", "SPX", "MINK", 0,
232};
233#else
234extern char *authtype_names[];
235#endif
236
237#define AUTHTYPE_NAME_OK(x) ((x) >= 0 && (x) < AUTHTYPE_CNT)
238#define AUTHTYPE_NAME(x) authtype_names[x]
239
240/*
241 * ENCRYPTion suboptions
242 */
243#define ENCRYPT_IS 0 /* I pick encryption type ... */
244#define ENCRYPT_SUPPORT 1 /* I support encryption types ... */
245#define ENCRYPT_REPLY 2 /* Initial setup response */
246#define ENCRYPT_START 3 /* Am starting to send encrypted */
247#define ENCRYPT_END 4 /* Am ending encrypted */
248#define ENCRYPT_REQSTART 5 /* Request you start encrypting */
249#define ENCRYPT_REQEND 6 /* Request you send encrypting */
250#define ENCRYPT_CNT 7
251
252#define ENCTYPE_ANY 0
253#define ENCTYPE_KRBDES 1
254#define ENCTYPE_CNT 2
255
256#ifdef ENCRYPT_NAMES
257char *encrypt_names[] = {
258 "IS", "SUPPORT", "REPLY", "START", "END",
259 "REQUEST-START", "REQUEST-END",
260 0,
261};
262char *enctype_names[] = {
263 "ANY", "KRBDES", 0,
264};
265#else
266extern char *encrypt_names[];
267extern char *enctype_names[];
268#endif
269
cab93fea 270
d31f065b
DB
271#define ENCRYPT_NAME_OK(x) ((x) >= 0 && (x) < ENCRYPT_CNT)
272#define ENCRYPT_NAME(x) encrypt_names[x]
cab93fea 273
d31f065b
DB
274#define ENCTYPE_NAME_OK(x) ((x) >= 0 && (x) < ENCTYPE_CNT)
275#define ENCTYPE_NAME(x) enctype_names[x]