Deleted Added
full compact
telnet.h (109467) telnet.h (183004)
1/*
2 * Copyright (c) 1983, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
15 * This product includes software developed by the University of
16 * California, Berkeley and its contributors.
17 * 4. Neither the name of the University nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)telnet.h 8.2 (Berkeley) 12/15/93
1/*
2 * Copyright (c) 1983, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
15 * This product includes software developed by the University of
16 * California, Berkeley and its contributors.
17 * 4. Neither the name of the University nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)telnet.h 8.2 (Berkeley) 12/15/93
34 * $FreeBSD: head/include/arpa/telnet.h 109467 2003-01-18 06:13:57Z billf $
34 * $FreeBSD: head/include/arpa/telnet.h 183004 2008-09-13 17:46:50Z antoine $
35 */
36
37#ifndef _ARPA_TELNET_H_
38#define _ARPA_TELNET_H_
39
40/*
41 * Definitions for the TELNET protocol.
42 */
43#define IAC 255 /* interpret as command: */
44#define DONT 254 /* you are not to use option */
45#define DO 253 /* please, you use option */
46#define WONT 252 /* I won't use option */
47#define WILL 251 /* I will use option */
48#define SB 250 /* interpret as subnegotiation */
49#define GA 249 /* you may reverse the line */
50#define EL 248 /* erase the current line */
51#define EC 247 /* erase the current character */
52#define AYT 246 /* are you there */
53#define AO 245 /* abort output--but let prog finish */
54#define IP 244 /* interrupt process--permanently */
55#define BREAK 243 /* break */
56#define DM 242 /* data mark--for connect. cleaning */
57#define NOP 241 /* nop */
58#define SE 240 /* end sub negotiation */
59#define EOR 239 /* end of record (transparent mode) */
60#define ABORT 238 /* Abort process */
61#define SUSP 237 /* Suspend process */
62#define xEOF 236 /* End of file: EOF is already used... */
63
64#define SYNCH 242 /* for telfunc calls */
65
66#ifdef TELCMDS
67const char *telcmds[] = {
68 "EOF", "SUSP", "ABORT", "EOR",
69 "SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC",
70 "EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC",
71 0
72};
73#else
74extern char *telcmds[];
75#endif
76
77#define TELCMD_FIRST xEOF
78#define TELCMD_LAST IAC
79#define TELCMD_OK(x) ((unsigned int)(x) <= TELCMD_LAST && \
80 (unsigned int)(x) >= TELCMD_FIRST)
81#define TELCMD(x) telcmds[(x)-TELCMD_FIRST]
82
83/* telnet options */
84#define TELOPT_BINARY 0 /* 8-bit data path */
85#define TELOPT_ECHO 1 /* echo */
86#define TELOPT_RCP 2 /* prepare to reconnect */
87#define TELOPT_SGA 3 /* suppress go ahead */
88#define TELOPT_NAMS 4 /* approximate message size */
89#define TELOPT_STATUS 5 /* give status */
90#define TELOPT_TM 6 /* timing mark */
91#define TELOPT_RCTE 7 /* remote controlled transmission and echo */
92#define TELOPT_NAOL 8 /* negotiate about output line width */
93#define TELOPT_NAOP 9 /* negotiate about output page size */
94#define TELOPT_NAOCRD 10 /* negotiate about CR disposition */
95#define TELOPT_NAOHTS 11 /* negotiate about horizontal tabstops */
96#define TELOPT_NAOHTD 12 /* negotiate about horizontal tab disposition */
97#define TELOPT_NAOFFD 13 /* negotiate about formfeed disposition */
98#define TELOPT_NAOVTS 14 /* negotiate about vertical tab stops */
99#define TELOPT_NAOVTD 15 /* negotiate about vertical tab disposition */
100#define TELOPT_NAOLFD 16 /* negotiate about output LF disposition */
101#define TELOPT_XASCII 17 /* extended ascic character set */
102#define TELOPT_LOGOUT 18 /* force logout */
103#define TELOPT_BM 19 /* byte macro */
104#define TELOPT_DET 20 /* data entry terminal */
105#define TELOPT_SUPDUP 21 /* supdup protocol */
106#define TELOPT_SUPDUPOUTPUT 22 /* supdup output */
107#define TELOPT_SNDLOC 23 /* send location */
108#define TELOPT_TTYPE 24 /* terminal type */
109#define TELOPT_EOR 25 /* end or record */
110#define TELOPT_TUID 26 /* TACACS user identification */
111#define TELOPT_OUTMRK 27 /* output marking */
112#define TELOPT_TTYLOC 28 /* terminal location number */
113#define TELOPT_3270REGIME 29 /* 3270 regime */
114#define TELOPT_X3PAD 30 /* X.3 PAD */
115#define TELOPT_NAWS 31 /* window size */
116#define TELOPT_TSPEED 32 /* terminal speed */
117#define TELOPT_LFLOW 33 /* remote flow control */
118#define TELOPT_LINEMODE 34 /* Linemode option */
119#define TELOPT_XDISPLOC 35 /* X Display Location */
120#define TELOPT_OLD_ENVIRON 36 /* Old - Environment variables */
121#define TELOPT_AUTHENTICATION 37/* Authenticate */
122#define TELOPT_ENCRYPT 38 /* Encryption option */
123#define TELOPT_NEW_ENVIRON 39 /* New - Environment variables */
124#define TELOPT_TN3270E 40 /* RFC2355 - TN3270 Enhancements */
125#define TELOPT_CHARSET 42 /* RFC2066 - Charset */
126#define TELOPT_COMPORT 44 /* RFC2217 - Com Port Control */
127#define TELOPT_KERMIT 47 /* RFC2840 - Kermit */
128#define TELOPT_EXOPL 255 /* extended-options-list */
129
130
131#define NTELOPTS (1+TELOPT_KERMIT)
132#ifdef TELOPTS
133const char *telopts[NTELOPTS+1] = {
134 "BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME",
135 "STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP",
136 "NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS",
137 "NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO",
138 "DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT",
139 "SEND LOCATION", "TERMINAL TYPE", "END OF RECORD",
140 "TACACS UID", "OUTPUT MARKING", "TTYLOC",
141 "3270 REGIME", "X.3 PAD", "NAWS", "TSPEED", "LFLOW",
142 "LINEMODE", "XDISPLOC", "OLD-ENVIRON", "AUTHENTICATION",
35 */
36
37#ifndef _ARPA_TELNET_H_
38#define _ARPA_TELNET_H_
39
40/*
41 * Definitions for the TELNET protocol.
42 */
43#define IAC 255 /* interpret as command: */
44#define DONT 254 /* you are not to use option */
45#define DO 253 /* please, you use option */
46#define WONT 252 /* I won't use option */
47#define WILL 251 /* I will use option */
48#define SB 250 /* interpret as subnegotiation */
49#define GA 249 /* you may reverse the line */
50#define EL 248 /* erase the current line */
51#define EC 247 /* erase the current character */
52#define AYT 246 /* are you there */
53#define AO 245 /* abort output--but let prog finish */
54#define IP 244 /* interrupt process--permanently */
55#define BREAK 243 /* break */
56#define DM 242 /* data mark--for connect. cleaning */
57#define NOP 241 /* nop */
58#define SE 240 /* end sub negotiation */
59#define EOR 239 /* end of record (transparent mode) */
60#define ABORT 238 /* Abort process */
61#define SUSP 237 /* Suspend process */
62#define xEOF 236 /* End of file: EOF is already used... */
63
64#define SYNCH 242 /* for telfunc calls */
65
66#ifdef TELCMDS
67const char *telcmds[] = {
68 "EOF", "SUSP", "ABORT", "EOR",
69 "SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC",
70 "EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC",
71 0
72};
73#else
74extern char *telcmds[];
75#endif
76
77#define TELCMD_FIRST xEOF
78#define TELCMD_LAST IAC
79#define TELCMD_OK(x) ((unsigned int)(x) <= TELCMD_LAST && \
80 (unsigned int)(x) >= TELCMD_FIRST)
81#define TELCMD(x) telcmds[(x)-TELCMD_FIRST]
82
83/* telnet options */
84#define TELOPT_BINARY 0 /* 8-bit data path */
85#define TELOPT_ECHO 1 /* echo */
86#define TELOPT_RCP 2 /* prepare to reconnect */
87#define TELOPT_SGA 3 /* suppress go ahead */
88#define TELOPT_NAMS 4 /* approximate message size */
89#define TELOPT_STATUS 5 /* give status */
90#define TELOPT_TM 6 /* timing mark */
91#define TELOPT_RCTE 7 /* remote controlled transmission and echo */
92#define TELOPT_NAOL 8 /* negotiate about output line width */
93#define TELOPT_NAOP 9 /* negotiate about output page size */
94#define TELOPT_NAOCRD 10 /* negotiate about CR disposition */
95#define TELOPT_NAOHTS 11 /* negotiate about horizontal tabstops */
96#define TELOPT_NAOHTD 12 /* negotiate about horizontal tab disposition */
97#define TELOPT_NAOFFD 13 /* negotiate about formfeed disposition */
98#define TELOPT_NAOVTS 14 /* negotiate about vertical tab stops */
99#define TELOPT_NAOVTD 15 /* negotiate about vertical tab disposition */
100#define TELOPT_NAOLFD 16 /* negotiate about output LF disposition */
101#define TELOPT_XASCII 17 /* extended ascic character set */
102#define TELOPT_LOGOUT 18 /* force logout */
103#define TELOPT_BM 19 /* byte macro */
104#define TELOPT_DET 20 /* data entry terminal */
105#define TELOPT_SUPDUP 21 /* supdup protocol */
106#define TELOPT_SUPDUPOUTPUT 22 /* supdup output */
107#define TELOPT_SNDLOC 23 /* send location */
108#define TELOPT_TTYPE 24 /* terminal type */
109#define TELOPT_EOR 25 /* end or record */
110#define TELOPT_TUID 26 /* TACACS user identification */
111#define TELOPT_OUTMRK 27 /* output marking */
112#define TELOPT_TTYLOC 28 /* terminal location number */
113#define TELOPT_3270REGIME 29 /* 3270 regime */
114#define TELOPT_X3PAD 30 /* X.3 PAD */
115#define TELOPT_NAWS 31 /* window size */
116#define TELOPT_TSPEED 32 /* terminal speed */
117#define TELOPT_LFLOW 33 /* remote flow control */
118#define TELOPT_LINEMODE 34 /* Linemode option */
119#define TELOPT_XDISPLOC 35 /* X Display Location */
120#define TELOPT_OLD_ENVIRON 36 /* Old - Environment variables */
121#define TELOPT_AUTHENTICATION 37/* Authenticate */
122#define TELOPT_ENCRYPT 38 /* Encryption option */
123#define TELOPT_NEW_ENVIRON 39 /* New - Environment variables */
124#define TELOPT_TN3270E 40 /* RFC2355 - TN3270 Enhancements */
125#define TELOPT_CHARSET 42 /* RFC2066 - Charset */
126#define TELOPT_COMPORT 44 /* RFC2217 - Com Port Control */
127#define TELOPT_KERMIT 47 /* RFC2840 - Kermit */
128#define TELOPT_EXOPL 255 /* extended-options-list */
129
130
131#define NTELOPTS (1+TELOPT_KERMIT)
132#ifdef TELOPTS
133const char *telopts[NTELOPTS+1] = {
134 "BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME",
135 "STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP",
136 "NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS",
137 "NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO",
138 "DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT",
139 "SEND LOCATION", "TERMINAL TYPE", "END OF RECORD",
140 "TACACS UID", "OUTPUT MARKING", "TTYLOC",
141 "3270 REGIME", "X.3 PAD", "NAWS", "TSPEED", "LFLOW",
142 "LINEMODE", "XDISPLOC", "OLD-ENVIRON", "AUTHENTICATION",
143 "ENCRYPT", "NEW-ENVIRON", "TN3270E", "CHARSET", "COM-PORT",
144 "KERMIT",
143 "ENCRYPT", "NEW-ENVIRON", "TN3270E", "XAUTH", "CHARSET",
144 "RSP", "COM-PORT", "SLE", "STARTTLS", "KERMIT",
145 0
146};
147#define TELOPT_FIRST TELOPT_BINARY
148#define TELOPT_LAST TELOPT_KERMIT
149#define TELOPT_OK(x) ((unsigned int)(x) <= TELOPT_LAST)
150#define TELOPT(x) telopts[(x)-TELOPT_FIRST]
151#endif
152
153/* sub-option qualifiers */
154#define TELQUAL_IS 0 /* option is... */
155#define TELQUAL_SEND 1 /* send option */
156#define TELQUAL_INFO 2 /* ENVIRON: informational version of IS */
157#define TELQUAL_REPLY 2 /* AUTHENTICATION: client version of IS */
158#define TELQUAL_NAME 3 /* AUTHENTICATION: client version of IS */
159
160#define LFLOW_OFF 0 /* Disable remote flow control */
161#define LFLOW_ON 1 /* Enable remote flow control */
162#define LFLOW_RESTART_ANY 2 /* Restart output on any char */
163#define LFLOW_RESTART_XON 3 /* Restart output only on XON */
164
165/*
166 * LINEMODE suboptions
167 */
168
169#define LM_MODE 1
170#define LM_FORWARDMASK 2
171#define LM_SLC 3
172
173#define MODE_EDIT 0x01
174#define MODE_TRAPSIG 0x02
175#define MODE_ACK 0x04
176#define MODE_SOFT_TAB 0x08
177#define MODE_LIT_ECHO 0x10
178
179#define MODE_MASK 0x1f
180
181/* Not part of protocol, but needed to simplify things... */
182#define MODE_FLOW 0x0100
183#define MODE_ECHO 0x0200
184#define MODE_INBIN 0x0400
185#define MODE_OUTBIN 0x0800
186#define MODE_FORCE 0x1000
187
188#define SLC_SYNCH 1
189#define SLC_BRK 2
190#define SLC_IP 3
191#define SLC_AO 4
192#define SLC_AYT 5
193#define SLC_EOR 6
194#define SLC_ABORT 7
195#define SLC_EOF 8
196#define SLC_SUSP 9
197#define SLC_EC 10
198#define SLC_EL 11
199#define SLC_EW 12
200#define SLC_RP 13
201#define SLC_LNEXT 14
202#define SLC_XON 15
203#define SLC_XOFF 16
204#define SLC_FORW1 17
205#define SLC_FORW2 18
206#define SLC_MCL 19
207#define SLC_MCR 20
208#define SLC_MCWL 21
209#define SLC_MCWR 22
210#define SLC_MCBOL 23
211#define SLC_MCEOL 24
212#define SLC_INSRT 25
213#define SLC_OVER 26
214#define SLC_ECR 27
215#define SLC_EWR 28
216#define SLC_EBOL 29
217#define SLC_EEOL 30
218
219#define NSLC 30
220
221/*
222 * For backwards compatibility, we define SLC_NAMES to be the
223 * list of names if SLC_NAMES is not defined.
224 */
225#define SLC_NAMELIST "0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \
226 "ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \
227 "LNEXT", "XON", "XOFF", "FORW1", "FORW2", \
228 "MCL", "MCR", "MCWL", "MCWR", "MCBOL", \
229 "MCEOL", "INSRT", "OVER", "ECR", "EWR", \
230 "EBOL", "EEOL", \
231 0
232
233#ifdef SLC_NAMES
234const char *slc_names[] = {
235 SLC_NAMELIST
236};
237#else
238extern char *slc_names[];
239#define SLC_NAMES SLC_NAMELIST
240#endif
241
242#define SLC_NAME_OK(x) ((unsigned int)(x) <= NSLC)
243#define SLC_NAME(x) slc_names[x]
244
245#define SLC_NOSUPPORT 0
246#define SLC_CANTCHANGE 1
247#define SLC_VARIABLE 2
248#define SLC_DEFAULT 3
249#define SLC_LEVELBITS 0x03
250
251#define SLC_FUNC 0
252#define SLC_FLAGS 1
253#define SLC_VALUE 2
254
255#define SLC_ACK 0x80
256#define SLC_FLUSHIN 0x40
257#define SLC_FLUSHOUT 0x20
258
259#define OLD_ENV_VAR 1
260#define OLD_ENV_VALUE 0
261#define NEW_ENV_VAR 0
262#define NEW_ENV_VALUE 1
263#define ENV_ESC 2
264#define ENV_USERVAR 3
265
266/*
267 * AUTHENTICATION suboptions
268 */
269
270/*
271 * Who is authenticating who ...
272 */
273#define AUTH_WHO_CLIENT 0 /* Client authenticating server */
274#define AUTH_WHO_SERVER 1 /* Server authenticating client */
275#define AUTH_WHO_MASK 1
276
277/*
278 * amount of authentication done
279 */
280#define AUTH_HOW_ONE_WAY 0
281#define AUTH_HOW_MUTUAL 2
282#define AUTH_HOW_MASK 2
283
284#define AUTHTYPE_NULL 0
285#define AUTHTYPE_KERBEROS_V4 1
286#define AUTHTYPE_KERBEROS_V5 2
287#define AUTHTYPE_SPX 3
288#define AUTHTYPE_MINK 4
289#define AUTHTYPE_SRA 6
290#define AUTHTYPE_CNT 7
291
292#define AUTHTYPE_TEST 99
293
294#ifdef AUTH_NAMES
295const char *authtype_names[] = {
296 "NULL", "KERBEROS_V4", "KERBEROS_V5", "SPX", "MINK", NULL, "SRA",
297 0
298};
299#else
300extern char *authtype_names[];
301#endif
302
303#define AUTHTYPE_NAME_OK(x) ((unsigned int)(x) < AUTHTYPE_CNT)
304#define AUTHTYPE_NAME(x) authtype_names[x]
305
306/*
307 * ENCRYPTion suboptions
308 */
309#define ENCRYPT_IS 0 /* I pick encryption type ... */
310#define ENCRYPT_SUPPORT 1 /* I support encryption types ... */
311#define ENCRYPT_REPLY 2 /* Initial setup response */
312#define ENCRYPT_START 3 /* Am starting to send encrypted */
313#define ENCRYPT_END 4 /* Am ending encrypted */
314#define ENCRYPT_REQSTART 5 /* Request you start encrypting */
315#define ENCRYPT_REQEND 6 /* Request you end encrypting */
316#define ENCRYPT_ENC_KEYID 7
317#define ENCRYPT_DEC_KEYID 8
318#define ENCRYPT_CNT 9
319
320#define ENCTYPE_ANY 0
321#define ENCTYPE_DES_CFB64 1
322#define ENCTYPE_DES_OFB64 2
323#define ENCTYPE_CNT 3
324
325#ifdef ENCRYPT_NAMES
326const char *encrypt_names[] = {
327 "IS", "SUPPORT", "REPLY", "START", "END",
328 "REQUEST-START", "REQUEST-END", "ENC-KEYID", "DEC-KEYID",
329 0
330};
331const char *enctype_names[] = {
332 "ANY", "DES_CFB64", "DES_OFB64",
333 0
334};
335#else
336extern char *encrypt_names[];
337extern char *enctype_names[];
338#endif
339
340
341#define ENCRYPT_NAME_OK(x) ((unsigned int)(x) < ENCRYPT_CNT)
342#define ENCRYPT_NAME(x) encrypt_names[x]
343
344#define ENCTYPE_NAME_OK(x) ((unsigned int)(x) < ENCTYPE_CNT)
345#define ENCTYPE_NAME(x) enctype_names[x]
346
347#endif /* !_TELNET_H_ */
145 0
146};
147#define TELOPT_FIRST TELOPT_BINARY
148#define TELOPT_LAST TELOPT_KERMIT
149#define TELOPT_OK(x) ((unsigned int)(x) <= TELOPT_LAST)
150#define TELOPT(x) telopts[(x)-TELOPT_FIRST]
151#endif
152
153/* sub-option qualifiers */
154#define TELQUAL_IS 0 /* option is... */
155#define TELQUAL_SEND 1 /* send option */
156#define TELQUAL_INFO 2 /* ENVIRON: informational version of IS */
157#define TELQUAL_REPLY 2 /* AUTHENTICATION: client version of IS */
158#define TELQUAL_NAME 3 /* AUTHENTICATION: client version of IS */
159
160#define LFLOW_OFF 0 /* Disable remote flow control */
161#define LFLOW_ON 1 /* Enable remote flow control */
162#define LFLOW_RESTART_ANY 2 /* Restart output on any char */
163#define LFLOW_RESTART_XON 3 /* Restart output only on XON */
164
165/*
166 * LINEMODE suboptions
167 */
168
169#define LM_MODE 1
170#define LM_FORWARDMASK 2
171#define LM_SLC 3
172
173#define MODE_EDIT 0x01
174#define MODE_TRAPSIG 0x02
175#define MODE_ACK 0x04
176#define MODE_SOFT_TAB 0x08
177#define MODE_LIT_ECHO 0x10
178
179#define MODE_MASK 0x1f
180
181/* Not part of protocol, but needed to simplify things... */
182#define MODE_FLOW 0x0100
183#define MODE_ECHO 0x0200
184#define MODE_INBIN 0x0400
185#define MODE_OUTBIN 0x0800
186#define MODE_FORCE 0x1000
187
188#define SLC_SYNCH 1
189#define SLC_BRK 2
190#define SLC_IP 3
191#define SLC_AO 4
192#define SLC_AYT 5
193#define SLC_EOR 6
194#define SLC_ABORT 7
195#define SLC_EOF 8
196#define SLC_SUSP 9
197#define SLC_EC 10
198#define SLC_EL 11
199#define SLC_EW 12
200#define SLC_RP 13
201#define SLC_LNEXT 14
202#define SLC_XON 15
203#define SLC_XOFF 16
204#define SLC_FORW1 17
205#define SLC_FORW2 18
206#define SLC_MCL 19
207#define SLC_MCR 20
208#define SLC_MCWL 21
209#define SLC_MCWR 22
210#define SLC_MCBOL 23
211#define SLC_MCEOL 24
212#define SLC_INSRT 25
213#define SLC_OVER 26
214#define SLC_ECR 27
215#define SLC_EWR 28
216#define SLC_EBOL 29
217#define SLC_EEOL 30
218
219#define NSLC 30
220
221/*
222 * For backwards compatibility, we define SLC_NAMES to be the
223 * list of names if SLC_NAMES is not defined.
224 */
225#define SLC_NAMELIST "0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \
226 "ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \
227 "LNEXT", "XON", "XOFF", "FORW1", "FORW2", \
228 "MCL", "MCR", "MCWL", "MCWR", "MCBOL", \
229 "MCEOL", "INSRT", "OVER", "ECR", "EWR", \
230 "EBOL", "EEOL", \
231 0
232
233#ifdef SLC_NAMES
234const char *slc_names[] = {
235 SLC_NAMELIST
236};
237#else
238extern char *slc_names[];
239#define SLC_NAMES SLC_NAMELIST
240#endif
241
242#define SLC_NAME_OK(x) ((unsigned int)(x) <= NSLC)
243#define SLC_NAME(x) slc_names[x]
244
245#define SLC_NOSUPPORT 0
246#define SLC_CANTCHANGE 1
247#define SLC_VARIABLE 2
248#define SLC_DEFAULT 3
249#define SLC_LEVELBITS 0x03
250
251#define SLC_FUNC 0
252#define SLC_FLAGS 1
253#define SLC_VALUE 2
254
255#define SLC_ACK 0x80
256#define SLC_FLUSHIN 0x40
257#define SLC_FLUSHOUT 0x20
258
259#define OLD_ENV_VAR 1
260#define OLD_ENV_VALUE 0
261#define NEW_ENV_VAR 0
262#define NEW_ENV_VALUE 1
263#define ENV_ESC 2
264#define ENV_USERVAR 3
265
266/*
267 * AUTHENTICATION suboptions
268 */
269
270/*
271 * Who is authenticating who ...
272 */
273#define AUTH_WHO_CLIENT 0 /* Client authenticating server */
274#define AUTH_WHO_SERVER 1 /* Server authenticating client */
275#define AUTH_WHO_MASK 1
276
277/*
278 * amount of authentication done
279 */
280#define AUTH_HOW_ONE_WAY 0
281#define AUTH_HOW_MUTUAL 2
282#define AUTH_HOW_MASK 2
283
284#define AUTHTYPE_NULL 0
285#define AUTHTYPE_KERBEROS_V4 1
286#define AUTHTYPE_KERBEROS_V5 2
287#define AUTHTYPE_SPX 3
288#define AUTHTYPE_MINK 4
289#define AUTHTYPE_SRA 6
290#define AUTHTYPE_CNT 7
291
292#define AUTHTYPE_TEST 99
293
294#ifdef AUTH_NAMES
295const char *authtype_names[] = {
296 "NULL", "KERBEROS_V4", "KERBEROS_V5", "SPX", "MINK", NULL, "SRA",
297 0
298};
299#else
300extern char *authtype_names[];
301#endif
302
303#define AUTHTYPE_NAME_OK(x) ((unsigned int)(x) < AUTHTYPE_CNT)
304#define AUTHTYPE_NAME(x) authtype_names[x]
305
306/*
307 * ENCRYPTion suboptions
308 */
309#define ENCRYPT_IS 0 /* I pick encryption type ... */
310#define ENCRYPT_SUPPORT 1 /* I support encryption types ... */
311#define ENCRYPT_REPLY 2 /* Initial setup response */
312#define ENCRYPT_START 3 /* Am starting to send encrypted */
313#define ENCRYPT_END 4 /* Am ending encrypted */
314#define ENCRYPT_REQSTART 5 /* Request you start encrypting */
315#define ENCRYPT_REQEND 6 /* Request you end encrypting */
316#define ENCRYPT_ENC_KEYID 7
317#define ENCRYPT_DEC_KEYID 8
318#define ENCRYPT_CNT 9
319
320#define ENCTYPE_ANY 0
321#define ENCTYPE_DES_CFB64 1
322#define ENCTYPE_DES_OFB64 2
323#define ENCTYPE_CNT 3
324
325#ifdef ENCRYPT_NAMES
326const char *encrypt_names[] = {
327 "IS", "SUPPORT", "REPLY", "START", "END",
328 "REQUEST-START", "REQUEST-END", "ENC-KEYID", "DEC-KEYID",
329 0
330};
331const char *enctype_names[] = {
332 "ANY", "DES_CFB64", "DES_OFB64",
333 0
334};
335#else
336extern char *encrypt_names[];
337extern char *enctype_names[];
338#endif
339
340
341#define ENCRYPT_NAME_OK(x) ((unsigned int)(x) < ENCRYPT_CNT)
342#define ENCRYPT_NAME(x) encrypt_names[x]
343
344#define ENCTYPE_NAME_OK(x) ((unsigned int)(x) < ENCTYPE_CNT)
345#define ENCTYPE_NAME(x) enctype_names[x]
346
347#endif /* !_TELNET_H_ */