Subversion Repositories SvarDOS

Rev

Rev 616 | Details | Compare with Previous | Last modification | View Log | RSS feed

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