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