telnet.h
001:
002:
003:
004:
005:
006:
007:
008:
009:
010:
011:
012:
013:
014:
015:
016:
017:
018:
019:
020:
021:
022:
023:
024:
025:
026:
027:
028:
029:
030:
031:
032: #ifndef _ARPA_TELNET_H
033: #define _ARPA_TELNET_H 1
034:
035:
036:
037:
038: #define IAC 255
039: #define DONT 254
040: #define DO 253
041: #define WONT 252
042: #define WILL 251
043: #define SB 250
044: #define GA 249
045: #define EL 248
046: #define EC 247
047: #define AYT 246
048: #define AO 245
049: #define IP 244
050: #define BREAK 243
051: #define DM 242
052: #define NOP 241
053: #define SE 240
054: #define EOR 239
055: #define ABORT 238
056: #define SUSP 237
057: #define xEOF 236
058:
059: #define SYNCH 242
060:
061: #ifdef TELCMDS
062: char *telcmds[] = {
063: "EOF", "SUSP", "ABORT", "EOR",
064: "SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC",
065: "EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC", 0,
066: };
067: #else
068: extern char *telcmds[];
069: #endif
070:
071: #define TELCMD_FIRST xEOF
072: #define TELCMD_LAST IAC
073: #define TELCMD_OK(x) ((unsigned int)(x) <= TELCMD_LAST && \
074: (unsigned int)(x) >= TELCMD_FIRST)
075: #define TELCMD(x) telcmds[(x)-TELCMD_FIRST]
076:
077:
078: #define TELOPT_BINARY 0
079: #define TELOPT_ECHO 1
080: #define TELOPT_RCP 2
081: #define TELOPT_SGA 3
082: #define TELOPT_NAMS 4
083: #define TELOPT_STATUS 5
084: #define TELOPT_TM 6
085: #define TELOPT_RCTE 7
086: #define TELOPT_NAOL 8
087: #define TELOPT_NAOP 9
088: #define TELOPT_NAOCRD 10
089: #define TELOPT_NAOHTS 11
090: #define TELOPT_NAOHTD 12
091: #define TELOPT_NAOFFD 13
092: #define TELOPT_NAOVTS 14
093: #define TELOPT_NAOVTD 15
094: #define TELOPT_NAOLFD 16
095: #define TELOPT_XASCII 17
096: #define TELOPT_LOGOUT 18
097: #define TELOPT_BM 19
098: #define TELOPT_DET 20
099: #define TELOPT_SUPDUP 21
100: #define TELOPT_SUPDUPOUTPUT 22
101: #define TELOPT_SNDLOC 23
102: #define TELOPT_TTYPE 24
103: #define TELOPT_EOR 25
104: #define TELOPT_TUID 26
105: #define TELOPT_OUTMRK 27
106: #define TELOPT_TTYLOC 28
107: #define TELOPT_3270REGIME 29
108: #define TELOPT_X3PAD 30
109: #define TELOPT_NAWS 31
110: #define TELOPT_TSPEED 32
111: #define TELOPT_LFLOW 33
112: #define TELOPT_LINEMODE 34
113: #define TELOPT_XDISPLOC 35
114: #define TELOPT_OLD_ENVIRON 36
115: #define TELOPT_AUTHENTICATION 37
116: #define TELOPT_ENCRYPT 38
117: #define TELOPT_NEW_ENVIRON 39
118: #define TELOPT_EXOPL 255
119:
120:
121: #define NTELOPTS (1+TELOPT_NEW_ENVIRON)
122: #ifdef TELOPTS
123: char *telopts[NTELOPTS+1] = {
124: "BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME",
125: "STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP",
126: "NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS",
127: "NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO",
128: "DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT",
129: "SEND LOCATION", "TERMINAL TYPE", "END OF RECORD",
130: "TACACS UID", "OUTPUT MARKING", "TTYLOC",
131: "3270 REGIME", "X.3 PAD", "NAWS", "TSPEED", "LFLOW",
132: "LINEMODE", "XDISPLOC", "OLD-ENVIRON", "AUTHENTICATION",
133: "ENCRYPT", "NEW-ENVIRON",
134: 0,
135: };
136: #define TELOPT_FIRST TELOPT_BINARY
137: #define TELOPT_LAST TELOPT_NEW_ENVIRON
138: #define TELOPT_OK(x) ((unsigned int)(x) <= TELOPT_LAST)
139: #define TELOPT(x) telopts[(x)-TELOPT_FIRST]
140: #endif
141:
142:
143: #define TELQUAL_IS 0
144: #define TELQUAL_SEND 1
145: #define TELQUAL_INFO 2
146: #define TELQUAL_REPLY 2
147: #define TELQUAL_NAME 3
148:
149: #define LFLOW_OFF 0
150: #define LFLOW_ON 1
151: #define LFLOW_RESTART_ANY 2
152: #define LFLOW_RESTART_XON 3
153:
154:
155:
156:
157:
158: #define LM_MODE 1
159: #define LM_FORWARDMASK 2
160: #define LM_SLC 3
161:
162: #define MODE_EDIT 0x01
163: #define MODE_TRAPSIG 0x02
164: #define MODE_ACK 0x04
165: #define MODE_SOFT_TAB 0x08
166: #define MODE_LIT_ECHO 0x10
167:
168: #define MODE_MASK 0x1f
169:
170:
171: #define MODE_FLOW 0x0100
172: #define MODE_ECHO 0x0200
173: #define MODE_INBIN 0x0400
174: #define MODE_OUTBIN 0x0800
175: #define MODE_FORCE 0x1000
176:
177: #define SLC_SYNCH 1
178: #define SLC_BRK 2
179: #define SLC_IP 3
180: #define SLC_AO 4
181: #define SLC_AYT 5
182: #define SLC_EOR 6
183: #define SLC_ABORT 7
184: #define SLC_EOF 8
185: #define SLC_SUSP 9
186: #define SLC_EC 10
187: #define SLC_EL 11
188: #define SLC_EW 12
189: #define SLC_RP 13
190: #define SLC_LNEXT 14
191: #define SLC_XON 15
192: #define SLC_XOFF 16
193: #define SLC_FORW1 17
194: #define SLC_FORW2 18
195:
196: #define NSLC 18
197:
198:
199:
200:
201:
202: #define SLC_NAMELIST "0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \
203: "ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \
204: "LNEXT", "XON", "XOFF", "FORW1", "FORW2", 0,
205: #ifdef SLC_NAMES
206: char *slc_names[] = {
207: SLC_NAMELIST
208: };
209: #else
210: extern char *slc_names[];
211: #define SLC_NAMES SLC_NAMELIST
212: #endif
213:
214: #define SLC_NAME_OK(x) ((unsigned int)(x) <= NSLC)
215: #define SLC_NAME(x) slc_names[x]
216:
217: #define SLC_NOSUPPORT 0
218: #define SLC_CANTCHANGE 1
219: #define SLC_VARIABLE 2
220: #define SLC_DEFAULT 3
221: #define SLC_LEVELBITS 0x03
222:
223: #define SLC_FUNC 0
224: #define SLC_FLAGS 1
225: #define SLC_VALUE 2
226:
227: #define SLC_ACK 0x80
228: #define SLC_FLUSHIN 0x40
229: #define SLC_FLUSHOUT 0x20
230:
231: #define OLD_ENV_VAR 1
232: #define OLD_ENV_VALUE 0
233: #define NEW_ENV_VAR 0
234: #define NEW_ENV_VALUE 1
235: #define ENV_ESC 2
236: #define ENV_USERVAR 3
237:
238:
239:
240:
241:
242:
243:
244:
245: #define AUTH_WHO_CLIENT 0
246: #define AUTH_WHO_SERVER 1
247: #define AUTH_WHO_MASK 1
248:
249:
250:
251:
252: #define AUTH_HOW_ONE_WAY 0
253: #define AUTH_HOW_MUTUAL 2
254: #define AUTH_HOW_MASK 2
255:
256: #define AUTHTYPE_NULL 0
257: #define AUTHTYPE_KERBEROS_V4 1
258: #define AUTHTYPE_KERBEROS_V5 2
259: #define AUTHTYPE_SPX 3
260: #define AUTHTYPE_MINK 4
261: #define AUTHTYPE_CNT 5
262:
263: #define AUTHTYPE_TEST 99
264:
265: #ifdef AUTH_NAMES
266: char *authtype_names[] = {
267: "NULL", "KERBEROS_V4", "KERBEROS_V5", "SPX", "MINK", 0,
268: };
269: #else
270: extern char *authtype_names[];
271: #endif
272:
273: #define AUTHTYPE_NAME_OK(x) ((unsigned int)(x) < AUTHTYPE_CNT)
274: #define AUTHTYPE_NAME(x) authtype_names[x]
275:
276:
277:
278:
279: #define ENCRYPT_IS 0
280: #define ENCRYPT_SUPPORT 1
281: #define ENCRYPT_REPLY 2
282: #define ENCRYPT_START 3
283: #define ENCRYPT_END 4
284: #define ENCRYPT_REQSTART 5
285: #define ENCRYPT_REQEND 6
286: #define ENCRYPT_ENC_KEYID 7
287: #define ENCRYPT_DEC_KEYID 8
288: #define ENCRYPT_CNT 9
289:
290: #define ENCTYPE_ANY 0
291: #define ENCTYPE_DES_CFB64 1
292: #define ENCTYPE_DES_OFB64 2
293: #define ENCTYPE_CNT 3
294:
295: #ifdef ENCRYPT_NAMES
296: char *encrypt_names[] = {
297: "IS", "SUPPORT", "REPLY", "START", "END",
298: "REQUEST-START", "REQUEST-END", "ENC-KEYID", "DEC-KEYID",
299: 0,
300: };
301: char *enctype_names[] = {
302: "ANY", "DES_CFB64", "DES_OFB64", 0,
303: };
304: #else
305: extern char *encrypt_names[];
306: extern char *enctype_names[];
307: #endif
308:
309:
310: #define ENCRYPT_NAME_OK(x) ((unsigned int)(x) < ENCRYPT_CNT)
311: #define ENCRYPT_NAME(x) encrypt_names[x]
312:
313: #define ENCTYPE_NAME_OK(x) ((unsigned int)(x) < ENCTYPE_CNT)
314: #define ENCTYPE_NAME(x) enctype_names[x]
315:
316: #endif
317:
© Andrew Scott 2006 -
2025,
All Rights Reserved