|
|
1.1 root 1: /*
2: * Copyright (c) 1983 Regents of the University of California.
3: * All rights reserved.
4: *
5: * Redistribution and use in source and binary forms are permitted provided
6: * that: (1) source distributions retain this entire copyright notice and
7: * comment, and (2) distributions including binaries display the following
8: * acknowledgement: ``This product includes software developed by the
9: * University of California, Berkeley and its contributors'' in the
10: * documentation or other materials provided with the distribution and in
11: * all advertising materials mentioning features or use of this software.
12: * Neither the name of the University nor the names of its contributors may
13: * be used to endorse or promote products derived from this software without
14: * specific prior written permission.
15: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
16: * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
17: * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
18: *
19: * @(#)telnet.h 5.10 (Berkeley) 6/28/90
20: */
21:
22: /*
23: * Definitions for the TELNET protocol.
24: */
25: #define IAC 255 /* interpret as command: */
26: #define DONT 254 /* you are not to use option */
27: #define DO 253 /* please, you use option */
28: #define WONT 252 /* I won't use option */
29: #define WILL 251 /* I will use option */
30: #define SB 250 /* interpret as subnegotiation */
31: #define GA 249 /* you may reverse the line */
32: #define EL 248 /* erase the current line */
33: #define EC 247 /* erase the current character */
34: #define AYT 246 /* are you there */
35: #define AO 245 /* abort output--but let prog finish */
36: #define IP 244 /* interrupt process--permanently */
37: #define BREAK 243 /* break */
38: #define DM 242 /* data mark--for connect. cleaning */
39: #define NOP 241 /* nop */
40: #define SE 240 /* end sub negotiation */
41: #define EOR 239 /* end of record (transparent mode) */
42: #define ABORT 238 /* Abort process */
43: #define SUSP 237 /* Suspend process */
44: #define xEOF 236 /* End of file: EOF is already used... */
45:
46: #define SYNCH 242 /* for telfunc calls */
47:
48: #ifdef TELCMDS
49: char *telcmds[] = {
50: "EOF", "SUSP", "ABORT", "EOR",
51: "SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC",
52: "EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC",
53: };
54: #define TELCMD_FIRST xEOF
55: #define TELCMD_LAST IAC
56: #define TELCMD_OK(x) ((x) <= TELCMD_LAST && (x) >= TELCMD_FIRST)
57: #define TELCMD(x) telcmds[(x)-TELCMD_FIRST]
58: #endif
59:
60: /* telnet options */
61: #define TELOPT_BINARY 0 /* 8-bit data path */
62: #define TELOPT_ECHO 1 /* echo */
63: #define TELOPT_RCP 2 /* prepare to reconnect */
64: #define TELOPT_SGA 3 /* suppress go ahead */
65: #define TELOPT_NAMS 4 /* approximate message size */
66: #define TELOPT_STATUS 5 /* give status */
67: #define TELOPT_TM 6 /* timing mark */
68: #define TELOPT_RCTE 7 /* remote controlled transmission and echo */
69: #define TELOPT_NAOL 8 /* negotiate about output line width */
70: #define TELOPT_NAOP 9 /* negotiate about output page size */
71: #define TELOPT_NAOCRD 10 /* negotiate about CR disposition */
72: #define TELOPT_NAOHTS 11 /* negotiate about horizontal tabstops */
73: #define TELOPT_NAOHTD 12 /* negotiate about horizontal tab disposition */
74: #define TELOPT_NAOFFD 13 /* negotiate about formfeed disposition */
75: #define TELOPT_NAOVTS 14 /* negotiate about vertical tab stops */
76: #define TELOPT_NAOVTD 15 /* negotiate about vertical tab disposition */
77: #define TELOPT_NAOLFD 16 /* negotiate about output LF disposition */
78: #define TELOPT_XASCII 17 /* extended ascic character set */
79: #define TELOPT_LOGOUT 18 /* force logout */
80: #define TELOPT_BM 19 /* byte macro */
81: #define TELOPT_DET 20 /* data entry terminal */
82: #define TELOPT_SUPDUP 21 /* supdup protocol */
83: #define TELOPT_SUPDUPOUTPUT 22 /* supdup output */
84: #define TELOPT_SNDLOC 23 /* send location */
85: #define TELOPT_TTYPE 24 /* terminal type */
86: #define TELOPT_EOR 25 /* end or record */
87: #define TELOPT_TUID 26 /* TACACS user identification */
88: #define TELOPT_OUTMRK 27 /* output marking */
89: #define TELOPT_TTYLOC 28 /* terminal location number */
90: #define TELOPT_3270REGIME 29 /* 3270 regime */
91: #define TELOPT_X3PAD 30 /* X.3 PAD */
92: #define TELOPT_NAWS 31 /* window size */
93: #define TELOPT_TSPEED 32 /* terminal speed */
94: #define TELOPT_LFLOW 33 /* remote flow control */
95: #define TELOPT_LINEMODE 34 /* Linemode option */
96: #define TELOPT_XDISPLOC 35 /* X Display Location */
97: #define TELOPT_ENVIRON 36 /* Environment variables */
98: #define TELOPT_AUTHENTICATION 45 /* XXX Auto Authenticate */
99: #define TELOPT_EXOPL 255 /* extended-options-list */
100:
101: #define NTELOPTS (1+TELOPT_AUTHENTICATION)
102: #ifdef TELOPTS
103: char *telopts[NTELOPTS] = {
104: "BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME",
105: "STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP",
106: "NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS",
107: "NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO",
108: "DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT",
109: "SEND LOCATION", "TERMINAL TYPE", "END OF RECORD",
110: "TACACS UID", "OUTPUT MARKING", "TTYLOC",
111: "3270 REGIME", "X.3 PAD", "NAWS", "TSPEED", "LFLOW",
112: "LINEMODE", "XDISPLOC", "ENVIRON",
113: "UNKNOWN 37", "UNKNOWN 38", "UNKNOWN 39", "UNKNOWN 40", "UNKNOWN 41",
114: "UNKNOWN 42", "UNKNOWN 43", "UNKNOWN 44", "AUTHENTICATION",
115: };
116: #define TELOPT_FIRST TELOPT_BINARY
117: #define TELOPT_LAST TELOPT_AUTHENTICATION
118: #define TELOPT_OK(x) ((x) <= TELOPT_LAST && (x) >= TELOPT_FIRST)
119: #define TELOPT(x) telopts[(x)-TELOPT_FIRST]
120: #endif
121:
122: /* sub-option qualifiers */
123: #define TELQUAL_IS 0 /* option is... */
124: #define TELQUAL_SEND 1 /* send option */
125: #define TELQUAL_INFO 2 /* ENVIRON: informational version of IS */
126:
127: /*
128: * LINEMODE suboptions
129: */
130:
131: #define LM_MODE 1
132: #define LM_FORWARDMASK 2
133: #define LM_SLC 3
134:
135: #define MODE_EDIT 0x01
136: #define MODE_TRAPSIG 0x02
137: #define MODE_ACK 0x04
138: #define MODE_SOFT_TAB 0x08
139: #define MODE_LIT_ECHO 0x10
140:
141: #define MODE_MASK 0x1f
142:
143: /* Not part of protocol, but needed to simplify things... */
144: #define MODE_FLOW 0x0100
145: #define MODE_ECHO 0x0200
146: #define MODE_INBIN 0x0400
147: #define MODE_OUTBIN 0x0800
148: #define MODE_FORCE 0x1000
149:
150: #define SLC_SYNCH 1
151: #define SLC_BRK 2
152: #define SLC_IP 3
153: #define SLC_AO 4
154: #define SLC_AYT 5
155: #define SLC_EOR 6
156: #define SLC_ABORT 7
157: #define SLC_EOF 8
158: #define SLC_SUSP 9
159: #define SLC_EC 10
160: #define SLC_EL 11
161: #define SLC_EW 12
162: #define SLC_RP 13
163: #define SLC_LNEXT 14
164: #define SLC_XON 15
165: #define SLC_XOFF 16
166: #define SLC_FORW1 17
167: #define SLC_FORW2 18
168:
169: #define NSLC 18
170:
171: #define SLC_NAMES "0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \
172: "ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \
173: "LNEXT", "XON", "XOFF", "FORW1", "FORW2"
174:
175: #define SLC_NOSUPPORT 0
176: #define SLC_CANTCHANGE 1
177: #define SLC_VARIABLE 2
178: #define SLC_DEFAULT 3
179: #define SLC_LEVELBITS 0x03
180:
181: #define SLC_FUNC 0
182: #define SLC_FLAGS 1
183: #define SLC_VALUE 2
184:
185: #define SLC_ACK 0x80
186: #define SLC_FLUSHIN 0x40
187: #define SLC_FLUSHOUT 0x20
188:
189: #define ENV_VALUE 0
190: #define ENV_VAR 1
191: #define ENV_ESC 2
192:
193: /*
194: * AUTHENTICATION suboptions
195: */
196:
197: #define TELQUAL_AUTHTYPE_NONE 0
198: #define TELQUAL_AUTHTYPE_PRIVATE 1
199: #define TELQUAL_AUTHTYPE_KERBEROS 2
200:
201: /* Kerberos-specific */
202:
203: #define TELQUAL_AUTHTYPE_KERBEROS_V4 4
204: #define TELQUAL_AUTHTYPE_KERBEROS_V5 5
205: #define TELQUAL_AUTHTYPE_KERBEROS_USERNAME 1
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.