telnet.h (2cca9f8f681f640ab25c82bfc46f10f4a352e412) telnet.h (59deaec541ae8baaa58daf6c5a2196ea7de180c3)
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.
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. Neither the name of the University nor the names of its contributors
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
14 * may be used to endorse or promote products derived from this software
15 * without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * @(#)telnet.h 8.2 (Berkeley) 12/15/93
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
30 * $FreeBSD$
31 */
32
34 */
35
33#ifndef _ARPA_TELNET_H_
34#define _ARPA_TELNET_H_
36#ifndef _TELNET_H_
37#define _TELNET_H_
35
36/*
37 * Definitions for the TELNET protocol.
38 */
39#define IAC 255 /* interpret as command: */
40#define DONT 254 /* you are not to use option */
41#define DO 253 /* please, you use option */
42#define WONT 252 /* I won't use option */

--- 12 unchanged lines hidden (view full) ---

55#define EOR 239 /* end of record (transparent mode) */
56#define ABORT 238 /* Abort process */
57#define SUSP 237 /* Suspend process */
58#define xEOF 236 /* End of file: EOF is already used... */
59
60#define SYNCH 242 /* for telfunc calls */
61
62#ifdef TELCMDS
38
39/*
40 * Definitions for the TELNET protocol.
41 */
42#define IAC 255 /* interpret as command: */
43#define DONT 254 /* you are not to use option */
44#define DO 253 /* please, you use option */
45#define WONT 252 /* I won't use option */

--- 12 unchanged lines hidden (view full) ---

58#define EOR 239 /* end of record (transparent mode) */
59#define ABORT 238 /* Abort process */
60#define SUSP 237 /* Suspend process */
61#define xEOF 236 /* End of file: EOF is already used... */
62
63#define SYNCH 242 /* for telfunc calls */
64
65#ifdef TELCMDS
63const char *telcmds[] = {
66char *telcmds[] = {
64 "EOF", "SUSP", "ABORT", "EOR",
65 "SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC",
67 "EOF", "SUSP", "ABORT", "EOR",
68 "SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC",
66 "EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC",
67 0
69 "EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC", 0,
68};
69#else
70extern char *telcmds[];
71#endif
72
73#define TELCMD_FIRST xEOF
74#define TELCMD_LAST IAC
75#define TELCMD_OK(x) ((unsigned int)(x) <= TELCMD_LAST && \

--- 36 unchanged lines hidden (view full) ---

112#define TELOPT_TSPEED 32 /* terminal speed */
113#define TELOPT_LFLOW 33 /* remote flow control */
114#define TELOPT_LINEMODE 34 /* Linemode option */
115#define TELOPT_XDISPLOC 35 /* X Display Location */
116#define TELOPT_OLD_ENVIRON 36 /* Old - Environment variables */
117#define TELOPT_AUTHENTICATION 37/* Authenticate */
118#define TELOPT_ENCRYPT 38 /* Encryption option */
119#define TELOPT_NEW_ENVIRON 39 /* New - Environment variables */
70};
71#else
72extern char *telcmds[];
73#endif
74
75#define TELCMD_FIRST xEOF
76#define TELCMD_LAST IAC
77#define TELCMD_OK(x) ((unsigned int)(x) <= TELCMD_LAST && \

--- 36 unchanged lines hidden (view full) ---

114#define TELOPT_TSPEED 32 /* terminal speed */
115#define TELOPT_LFLOW 33 /* remote flow control */
116#define TELOPT_LINEMODE 34 /* Linemode option */
117#define TELOPT_XDISPLOC 35 /* X Display Location */
118#define TELOPT_OLD_ENVIRON 36 /* Old - Environment variables */
119#define TELOPT_AUTHENTICATION 37/* Authenticate */
120#define TELOPT_ENCRYPT 38 /* Encryption option */
121#define TELOPT_NEW_ENVIRON 39 /* New - Environment variables */
120#define TELOPT_TN3270E 40 /* RFC2355 - TN3270 Enhancements */
121#define TELOPT_CHARSET 42 /* RFC2066 - Charset */
122#define TELOPT_COMPORT 44 /* RFC2217 - Com Port Control */
123#define TELOPT_KERMIT 47 /* RFC2840 - Kermit */
124#define TELOPT_EXOPL 255 /* extended-options-list */
125
126
122#define TELOPT_EXOPL 255 /* extended-options-list */
123
124
127#define NTELOPTS (1+TELOPT_KERMIT)
125#define NTELOPTS (1+TELOPT_NEW_ENVIRON)
128#ifdef TELOPTS
126#ifdef TELOPTS
129const char *telopts[NTELOPTS+1] = {
127char *telopts[NTELOPTS+1] = {
130 "BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME",
131 "STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP",
132 "NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS",
133 "NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO",
134 "DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT",
135 "SEND LOCATION", "TERMINAL TYPE", "END OF RECORD",
136 "TACACS UID", "OUTPUT MARKING", "TTYLOC",
137 "3270 REGIME", "X.3 PAD", "NAWS", "TSPEED", "LFLOW",
138 "LINEMODE", "XDISPLOC", "OLD-ENVIRON", "AUTHENTICATION",
128 "BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME",
129 "STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP",
130 "NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS",
131 "NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO",
132 "DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT",
133 "SEND LOCATION", "TERMINAL TYPE", "END OF RECORD",
134 "TACACS UID", "OUTPUT MARKING", "TTYLOC",
135 "3270 REGIME", "X.3 PAD", "NAWS", "TSPEED", "LFLOW",
136 "LINEMODE", "XDISPLOC", "OLD-ENVIRON", "AUTHENTICATION",
139 "ENCRYPT", "NEW-ENVIRON", "TN3270E", "XAUTH", "CHARSET",
140 "RSP", "COM-PORT", "SLE", "STARTTLS", "KERMIT",
141 0
137 "ENCRYPT", "NEW-ENVIRON",
138 0,
142};
143#define TELOPT_FIRST TELOPT_BINARY
139};
140#define TELOPT_FIRST TELOPT_BINARY
144#define TELOPT_LAST TELOPT_KERMIT
141#define TELOPT_LAST TELOPT_NEW_ENVIRON
145#define TELOPT_OK(x) ((unsigned int)(x) <= TELOPT_LAST)
146#define TELOPT(x) telopts[(x)-TELOPT_FIRST]
147#endif
148
149/* sub-option qualifiers */
150#define TELQUAL_IS 0 /* option is... */
151#define TELQUAL_SEND 1 /* send option */
152#define TELQUAL_INFO 2 /* ENVIRON: informational version of IS */

--- 41 unchanged lines hidden (view full) ---

194#define SLC_EL 11
195#define SLC_EW 12
196#define SLC_RP 13
197#define SLC_LNEXT 14
198#define SLC_XON 15
199#define SLC_XOFF 16
200#define SLC_FORW1 17
201#define SLC_FORW2 18
142#define TELOPT_OK(x) ((unsigned int)(x) <= TELOPT_LAST)
143#define TELOPT(x) telopts[(x)-TELOPT_FIRST]
144#endif
145
146/* sub-option qualifiers */
147#define TELQUAL_IS 0 /* option is... */
148#define TELQUAL_SEND 1 /* send option */
149#define TELQUAL_INFO 2 /* ENVIRON: informational version of IS */

--- 41 unchanged lines hidden (view full) ---

191#define SLC_EL 11
192#define SLC_EW 12
193#define SLC_RP 13
194#define SLC_LNEXT 14
195#define SLC_XON 15
196#define SLC_XOFF 16
197#define SLC_FORW1 17
198#define SLC_FORW2 18
202#define SLC_MCL 19
203#define SLC_MCR 20
204#define SLC_MCWL 21
205#define SLC_MCWR 22
206#define SLC_MCBOL 23
207#define SLC_MCEOL 24
208#define SLC_INSRT 25
209#define SLC_OVER 26
210#define SLC_ECR 27
211#define SLC_EWR 28
212#define SLC_EBOL 29
213#define SLC_EEOL 30
214
199
215#define NSLC 30
200#define NSLC 18
216
217/*
201
202/*
218 * For backwards compatibility, we define SLC_NAMES to be the
203 * For backwards compatability, we define SLC_NAMES to be the
219 * list of names if SLC_NAMES is not defined.
220 */
204 * list of names if SLC_NAMES is not defined.
205 */
221#define SLC_NAMELIST "0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \
222 "ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \
223 "LNEXT", "XON", "XOFF", "FORW1", "FORW2", \
224 "MCL", "MCR", "MCWL", "MCWR", "MCBOL", \
225 "MCEOL", "INSRT", "OVER", "ECR", "EWR", \
226 "EBOL", "EEOL", \
227 0
228
206#define SLC_NAMELIST "0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \
207 "ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \
208 "LNEXT", "XON", "XOFF", "FORW1", "FORW2", 0,
229#ifdef SLC_NAMES
209#ifdef SLC_NAMES
230const char *slc_names[] = {
210char *slc_names[] = {
231 SLC_NAMELIST
232};
233#else
234extern char *slc_names[];
235#define SLC_NAMES SLC_NAMELIST
236#endif
237
238#define SLC_NAME_OK(x) ((unsigned int)(x) <= NSLC)

--- 38 unchanged lines hidden (view full) ---

277#define AUTH_HOW_MUTUAL 2
278#define AUTH_HOW_MASK 2
279
280#define AUTHTYPE_NULL 0
281#define AUTHTYPE_KERBEROS_V4 1
282#define AUTHTYPE_KERBEROS_V5 2
283#define AUTHTYPE_SPX 3
284#define AUTHTYPE_MINK 4
211 SLC_NAMELIST
212};
213#else
214extern char *slc_names[];
215#define SLC_NAMES SLC_NAMELIST
216#endif
217
218#define SLC_NAME_OK(x) ((unsigned int)(x) <= NSLC)

--- 38 unchanged lines hidden (view full) ---

257#define AUTH_HOW_MUTUAL 2
258#define AUTH_HOW_MASK 2
259
260#define AUTHTYPE_NULL 0
261#define AUTHTYPE_KERBEROS_V4 1
262#define AUTHTYPE_KERBEROS_V5 2
263#define AUTHTYPE_SPX 3
264#define AUTHTYPE_MINK 4
285#define AUTHTYPE_SRA 6
286#define AUTHTYPE_CNT 7
265#define AUTHTYPE_CNT 5
287
288#define AUTHTYPE_TEST 99
289
290#ifdef AUTH_NAMES
266
267#define AUTHTYPE_TEST 99
268
269#ifdef AUTH_NAMES
291const char *authtype_names[] = {
292 "NULL", "KERBEROS_V4", "KERBEROS_V5", "SPX", "MINK", NULL, "SRA",
293 0
270char *authtype_names[] = {
271 "NULL", "KERBEROS_V4", "KERBEROS_V5", "SPX", "MINK", 0,
294};
295#else
296extern char *authtype_names[];
297#endif
298
299#define AUTHTYPE_NAME_OK(x) ((unsigned int)(x) < AUTHTYPE_CNT)
300#define AUTHTYPE_NAME(x) authtype_names[x]
301
302/*
303 * ENCRYPTion suboptions
304 */
305#define ENCRYPT_IS 0 /* I pick encryption type ... */
306#define ENCRYPT_SUPPORT 1 /* I support encryption types ... */
307#define ENCRYPT_REPLY 2 /* Initial setup response */
308#define ENCRYPT_START 3 /* Am starting to send encrypted */
309#define ENCRYPT_END 4 /* Am ending encrypted */
310#define ENCRYPT_REQSTART 5 /* Request you start encrypting */
272};
273#else
274extern char *authtype_names[];
275#endif
276
277#define AUTHTYPE_NAME_OK(x) ((unsigned int)(x) < AUTHTYPE_CNT)
278#define AUTHTYPE_NAME(x) authtype_names[x]
279
280/*
281 * ENCRYPTion suboptions
282 */
283#define ENCRYPT_IS 0 /* I pick encryption type ... */
284#define ENCRYPT_SUPPORT 1 /* I support encryption types ... */
285#define ENCRYPT_REPLY 2 /* Initial setup response */
286#define ENCRYPT_START 3 /* Am starting to send encrypted */
287#define ENCRYPT_END 4 /* Am ending encrypted */
288#define ENCRYPT_REQSTART 5 /* Request you start encrypting */
311#define ENCRYPT_REQEND 6 /* Request you end encrypting */
289#define ENCRYPT_REQEND 6 /* Request you send encrypting */
312#define ENCRYPT_ENC_KEYID 7
313#define ENCRYPT_DEC_KEYID 8
314#define ENCRYPT_CNT 9
315
316#define ENCTYPE_ANY 0
317#define ENCTYPE_DES_CFB64 1
318#define ENCTYPE_DES_OFB64 2
319#define ENCTYPE_CNT 3
320
321#ifdef ENCRYPT_NAMES
290#define ENCRYPT_ENC_KEYID 7
291#define ENCRYPT_DEC_KEYID 8
292#define ENCRYPT_CNT 9
293
294#define ENCTYPE_ANY 0
295#define ENCTYPE_DES_CFB64 1
296#define ENCTYPE_DES_OFB64 2
297#define ENCTYPE_CNT 3
298
299#ifdef ENCRYPT_NAMES
322const char *encrypt_names[] = {
300char *encrypt_names[] = {
323 "IS", "SUPPORT", "REPLY", "START", "END",
324 "REQUEST-START", "REQUEST-END", "ENC-KEYID", "DEC-KEYID",
301 "IS", "SUPPORT", "REPLY", "START", "END",
302 "REQUEST-START", "REQUEST-END", "ENC-KEYID", "DEC-KEYID",
325 0
303 0,
326};
304};
327const char *enctype_names[] = {
328 "ANY", "DES_CFB64", "DES_OFB64",
329 0
305char *enctype_names[] = {
306 "ANY", "DES_CFB64", "DES_OFB64", 0,
330};
331#else
332extern char *encrypt_names[];
333extern char *enctype_names[];
334#endif
335
336
337#define ENCRYPT_NAME_OK(x) ((unsigned int)(x) < ENCRYPT_CNT)
338#define ENCRYPT_NAME(x) encrypt_names[x]
339
340#define ENCTYPE_NAME_OK(x) ((unsigned int)(x) < ENCTYPE_CNT)
341#define ENCTYPE_NAME(x) enctype_names[x]
342
343#endif /* !_TELNET_H_ */
307};
308#else
309extern char *encrypt_names[];
310extern char *enctype_names[];
311#endif
312
313
314#define ENCRYPT_NAME_OK(x) ((unsigned int)(x) < ENCRYPT_CNT)
315#define ENCRYPT_NAME(x) encrypt_names[x]
316
317#define ENCTYPE_NAME_OK(x) ((unsigned int)(x) < ENCTYPE_CNT)
318#define ENCTYPE_NAME(x) enctype_names[x]
319
320#endif /* !_TELNET_H_ */