]>
git.saurik.com Git - apple/libc.git/blob - include/arpa/telnet.h
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
24 * Copyright (c) 1983, 1993
25 * The Regents of the University of California. All rights reserved.
27 * Redistribution and use in source and binary forms, with or without
28 * modification, are permitted provided that the following conditions
30 * 1. Redistributions of source code must retain the above copyright
31 * notice, this list of conditions and the following disclaimer.
32 * 2. Redistributions in binary form must reproduce the above copyright
33 * notice, this list of conditions and the following disclaimer in the
34 * documentation and/or other materials provided with the distribution.
35 * 3. All advertising materials mentioning features or use of this software
36 * must display the following acknowledgement:
37 * This product includes software developed by the University of
38 * California, Berkeley and its contributors.
39 * 4. Neither the name of the University nor the names of its contributors
40 * may be used to endorse or promote products derived from this software
41 * without specific prior written permission.
43 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
44 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
45 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
46 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
47 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
48 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
49 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
50 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
51 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
52 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
55 * @(#)telnet.h 8.2 (Berkeley) 12/15/93
62 * Definitions for the TELNET protocol.
64 #define IAC 255 /* interpret as command: */
65 #define DONT 254 /* you are not to use option */
66 #define DO 253 /* please, you use option */
67 #define WONT 252 /* I won't use option */
68 #define WILL 251 /* I will use option */
69 #define SB 250 /* interpret as subnegotiation */
70 #define GA 249 /* you may reverse the line */
71 #define EL 248 /* erase the current line */
72 #define EC 247 /* erase the current character */
73 #define AYT 246 /* are you there */
74 #define AO 245 /* abort output--but let prog finish */
75 #define IP 244 /* interrupt process--permanently */
76 #define BREAK 243 /* break */
77 #define DM 242 /* data mark--for connect. cleaning */
78 #define NOP 241 /* nop */
79 #define SE 240 /* end sub negotiation */
80 #define EOR 239 /* end of record (transparent mode) */
81 #define ABORT 238 /* Abort process */
82 #define SUSP 237 /* Suspend process */
83 #define xEOF 236 /* End of file: EOF is already used... */
85 #define SYNCH 242 /* for telfunc calls */
89 "EOF", "SUSP", "ABORT", "EOR",
90 "SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC",
91 "EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC", 0,
94 extern char *telcmds
[];
97 #define TELCMD_FIRST xEOF
98 #define TELCMD_LAST IAC
99 #define TELCMD_OK(x) ((unsigned int)(x) <= TELCMD_LAST && \
100 (unsigned int)(x) >= TELCMD_FIRST)
101 #define TELCMD(x) telcmds[(x)-TELCMD_FIRST]
104 #define TELOPT_BINARY 0 /* 8-bit data path */
105 #define TELOPT_ECHO 1 /* echo */
106 #define TELOPT_RCP 2 /* prepare to reconnect */
107 #define TELOPT_SGA 3 /* suppress go ahead */
108 #define TELOPT_NAMS 4 /* approximate message size */
109 #define TELOPT_STATUS 5 /* give status */
110 #define TELOPT_TM 6 /* timing mark */
111 #define TELOPT_RCTE 7 /* remote controlled transmission and echo */
112 #define TELOPT_NAOL 8 /* negotiate about output line width */
113 #define TELOPT_NAOP 9 /* negotiate about output page size */
114 #define TELOPT_NAOCRD 10 /* negotiate about CR disposition */
115 #define TELOPT_NAOHTS 11 /* negotiate about horizontal tabstops */
116 #define TELOPT_NAOHTD 12 /* negotiate about horizontal tab disposition */
117 #define TELOPT_NAOFFD 13 /* negotiate about formfeed disposition */
118 #define TELOPT_NAOVTS 14 /* negotiate about vertical tab stops */
119 #define TELOPT_NAOVTD 15 /* negotiate about vertical tab disposition */
120 #define TELOPT_NAOLFD 16 /* negotiate about output LF disposition */
121 #define TELOPT_XASCII 17 /* extended ascic character set */
122 #define TELOPT_LOGOUT 18 /* force logout */
123 #define TELOPT_BM 19 /* byte macro */
124 #define TELOPT_DET 20 /* data entry terminal */
125 #define TELOPT_SUPDUP 21 /* supdup protocol */
126 #define TELOPT_SUPDUPOUTPUT 22 /* supdup output */
127 #define TELOPT_SNDLOC 23 /* send location */
128 #define TELOPT_TTYPE 24 /* terminal type */
129 #define TELOPT_EOR 25 /* end or record */
130 #define TELOPT_TUID 26 /* TACACS user identification */
131 #define TELOPT_OUTMRK 27 /* output marking */
132 #define TELOPT_TTYLOC 28 /* terminal location number */
133 #define TELOPT_3270REGIME 29 /* 3270 regime */
134 #define TELOPT_X3PAD 30 /* X.3 PAD */
135 #define TELOPT_NAWS 31 /* window size */
136 #define TELOPT_TSPEED 32 /* terminal speed */
137 #define TELOPT_LFLOW 33 /* remote flow control */
138 #define TELOPT_LINEMODE 34 /* Linemode option */
139 #define TELOPT_XDISPLOC 35 /* X Display Location */
140 #define TELOPT_OLD_ENVIRON 36 /* Old - Environment variables */
141 #define TELOPT_AUTHENTICATION 37/* Authenticate */
142 #define TELOPT_ENCRYPT 38 /* Encryption option */
143 #define TELOPT_NEW_ENVIRON 39 /* New - Environment variables */
144 #define TELOPT_EXOPL 255 /* extended-options-list */
147 #define NTELOPTS (1+TELOPT_NEW_ENVIRON)
149 char *telopts
[NTELOPTS
+1] = {
150 "BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME",
151 "STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP",
152 "NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS",
153 "NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO",
154 "DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT",
155 "SEND LOCATION", "TERMINAL TYPE", "END OF RECORD",
156 "TACACS UID", "OUTPUT MARKING", "TTYLOC",
157 "3270 REGIME", "X.3 PAD", "NAWS", "TSPEED", "LFLOW",
158 "LINEMODE", "XDISPLOC", "OLD-ENVIRON", "AUTHENTICATION",
159 "ENCRYPT", "NEW-ENVIRON",
162 #define TELOPT_FIRST TELOPT_BINARY
163 #define TELOPT_LAST TELOPT_NEW_ENVIRON
164 #define TELOPT_OK(x) ((unsigned int)(x) <= TELOPT_LAST)
165 #define TELOPT(x) telopts[(x)-TELOPT_FIRST]
168 /* sub-option qualifiers */
169 #define TELQUAL_IS 0 /* option is... */
170 #define TELQUAL_SEND 1 /* send option */
171 #define TELQUAL_INFO 2 /* ENVIRON: informational version of IS */
172 #define TELQUAL_REPLY 2 /* AUTHENTICATION: client version of IS */
173 #define TELQUAL_NAME 3 /* AUTHENTICATION: client version of IS */
175 #define LFLOW_OFF 0 /* Disable remote flow control */
176 #define LFLOW_ON 1 /* Enable remote flow control */
177 #define LFLOW_RESTART_ANY 2 /* Restart output on any char */
178 #define LFLOW_RESTART_XON 3 /* Restart output only on XON */
181 * LINEMODE suboptions
185 #define LM_FORWARDMASK 2
188 #define MODE_EDIT 0x01
189 #define MODE_TRAPSIG 0x02
190 #define MODE_ACK 0x04
191 #define MODE_SOFT_TAB 0x08
192 #define MODE_LIT_ECHO 0x10
194 #define MODE_MASK 0x1f
196 /* Not part of protocol, but needed to simplify things... */
197 #define MODE_FLOW 0x0100
198 #define MODE_ECHO 0x0200
199 #define MODE_INBIN 0x0400
200 #define MODE_OUTBIN 0x0800
201 #define MODE_FORCE 0x1000
225 * For backwards compatability, we define SLC_NAMES to be the
226 * list of names if SLC_NAMES is not defined.
228 #define SLC_NAMELIST "0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \
229 "ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \
230 "LNEXT", "XON", "XOFF", "FORW1", "FORW2", 0,
232 char *slc_names
[] = {
236 extern char *slc_names
[];
237 #define SLC_NAMES SLC_NAMELIST
240 #define SLC_NAME_OK(x) ((unsigned int)(x) <= NSLC)
241 #define SLC_NAME(x) slc_names[x]
243 #define SLC_NOSUPPORT 0
244 #define SLC_CANTCHANGE 1
245 #define SLC_VARIABLE 2
246 #define SLC_DEFAULT 3
247 #define SLC_LEVELBITS 0x03
254 #define SLC_FLUSHIN 0x40
255 #define SLC_FLUSHOUT 0x20
257 #define OLD_ENV_VAR 1
258 #define OLD_ENV_VALUE 0
259 #define NEW_ENV_VAR 0
260 #define NEW_ENV_VALUE 1
262 #define ENV_USERVAR 3
265 * AUTHENTICATION suboptions
269 * Who is authenticating who ...
271 #define AUTH_WHO_CLIENT 0 /* Client authenticating server */
272 #define AUTH_WHO_SERVER 1 /* Server authenticating client */
273 #define AUTH_WHO_MASK 1
276 * amount of authentication done
278 #define AUTH_HOW_ONE_WAY 0
279 #define AUTH_HOW_MUTUAL 2
280 #define AUTH_HOW_MASK 2
282 #define AUTHTYPE_NULL 0
283 #define AUTHTYPE_KERBEROS_V4 1
284 #define AUTHTYPE_KERBEROS_V5 2
285 #define AUTHTYPE_SPX 3
286 #define AUTHTYPE_MINK 4
287 #define AUTHTYPE_CNT 5
289 #define AUTHTYPE_TEST 99
292 char *authtype_names
[] = {
293 "NULL", "KERBEROS_V4", "KERBEROS_V5", "SPX", "MINK", 0,
296 extern char *authtype_names
[];
299 #define AUTHTYPE_NAME_OK(x) ((unsigned int)(x) < AUTHTYPE_CNT)
300 #define AUTHTYPE_NAME(x) authtype_names[x]
303 * ENCRYPTion suboptions
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 */
311 #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
316 #define ENCTYPE_ANY 0
317 #define ENCTYPE_DES_CFB64 1
318 #define ENCTYPE_DES_OFB64 2
319 #define ENCTYPE_CNT 3
322 char *encrypt_names
[] = {
323 "IS", "SUPPORT", "REPLY", "START", "END",
324 "REQUEST-START", "REQUEST-END", "ENC-KEYID", "DEC-KEYID",
327 char *enctype_names
[] = {
328 "ANY", "DES_CFB64", "DES_OFB64", 0,
331 extern char *encrypt_names
[];
332 extern char *enctype_names
[];
336 #define ENCRYPT_NAME_OK(x) ((unsigned int)(x) < ENCRYPT_CNT)
337 #define ENCRYPT_NAME(x) encrypt_names[x]
339 #define ENCTYPE_NAME_OK(x) ((unsigned int)(x) < ENCTYPE_CNT)
340 #define ENCTYPE_NAME(x) enctype_names[x]
342 #endif /* !_TELNET_H_ */