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