148758Sbostic /*- 2*62336Sbostic * Copyright (c) 1983, 1993 3*62336Sbostic * The Regents of the University of California. All rights reserved. 431545Sminshall * 548758Sbostic * %sccs.include.redist.c% 633818Sbostic * 7*62336Sbostic * @(#)telnet.h 8.1 (Berkeley) 06/06/93 831545Sminshall */ 931545Sminshall 1031545Sminshall /* 1131545Sminshall * Definitions for the TELNET protocol. 1231545Sminshall */ 1331545Sminshall #define IAC 255 /* interpret as command: */ 1431545Sminshall #define DONT 254 /* you are not to use option */ 1531545Sminshall #define DO 253 /* please, you use option */ 1631545Sminshall #define WONT 252 /* I won't use option */ 1731545Sminshall #define WILL 251 /* I will use option */ 1831545Sminshall #define SB 250 /* interpret as subnegotiation */ 1931545Sminshall #define GA 249 /* you may reverse the line */ 2031545Sminshall #define EL 248 /* erase the current line */ 2131545Sminshall #define EC 247 /* erase the current character */ 2231545Sminshall #define AYT 246 /* are you there */ 2331545Sminshall #define AO 245 /* abort output--but let prog finish */ 2431545Sminshall #define IP 244 /* interrupt process--permanently */ 2531545Sminshall #define BREAK 243 /* break */ 2631545Sminshall #define DM 242 /* data mark--for connect. cleaning */ 2731545Sminshall #define NOP 241 /* nop */ 2831545Sminshall #define SE 240 /* end sub negotiation */ 2931545Sminshall #define EOR 239 /* end of record (transparent mode) */ 3038693Sborman #define ABORT 238 /* Abort process */ 3138693Sborman #define SUSP 237 /* Suspend process */ 3238693Sborman #define xEOF 236 /* End of file: EOF is already used... */ 3331545Sminshall 3431545Sminshall #define SYNCH 242 /* for telfunc calls */ 3531545Sminshall 3631545Sminshall #ifdef TELCMDS 3731545Sminshall char *telcmds[] = { 3838693Sborman "EOF", "SUSP", "ABORT", "EOR", 3931545Sminshall "SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC", 4031545Sminshall "EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC", 4131545Sminshall }; 4238693Sborman #define TELCMD_FIRST xEOF 4338693Sborman #define TELCMD_LAST IAC 4438693Sborman #define TELCMD_OK(x) ((x) <= TELCMD_LAST && (x) >= TELCMD_FIRST) 4538693Sborman #define TELCMD(x) telcmds[(x)-TELCMD_FIRST] 4631545Sminshall #endif 4731545Sminshall 4831545Sminshall /* telnet options */ 4931545Sminshall #define TELOPT_BINARY 0 /* 8-bit data path */ 5031545Sminshall #define TELOPT_ECHO 1 /* echo */ 5131545Sminshall #define TELOPT_RCP 2 /* prepare to reconnect */ 5231545Sminshall #define TELOPT_SGA 3 /* suppress go ahead */ 5331545Sminshall #define TELOPT_NAMS 4 /* approximate message size */ 5431545Sminshall #define TELOPT_STATUS 5 /* give status */ 5531545Sminshall #define TELOPT_TM 6 /* timing mark */ 5631545Sminshall #define TELOPT_RCTE 7 /* remote controlled transmission and echo */ 5731545Sminshall #define TELOPT_NAOL 8 /* negotiate about output line width */ 5831545Sminshall #define TELOPT_NAOP 9 /* negotiate about output page size */ 5931545Sminshall #define TELOPT_NAOCRD 10 /* negotiate about CR disposition */ 6031545Sminshall #define TELOPT_NAOHTS 11 /* negotiate about horizontal tabstops */ 6131545Sminshall #define TELOPT_NAOHTD 12 /* negotiate about horizontal tab disposition */ 6231545Sminshall #define TELOPT_NAOFFD 13 /* negotiate about formfeed disposition */ 6331545Sminshall #define TELOPT_NAOVTS 14 /* negotiate about vertical tab stops */ 6431545Sminshall #define TELOPT_NAOVTD 15 /* negotiate about vertical tab disposition */ 6531545Sminshall #define TELOPT_NAOLFD 16 /* negotiate about output LF disposition */ 6631545Sminshall #define TELOPT_XASCII 17 /* extended ascic character set */ 6731545Sminshall #define TELOPT_LOGOUT 18 /* force logout */ 6831545Sminshall #define TELOPT_BM 19 /* byte macro */ 6931545Sminshall #define TELOPT_DET 20 /* data entry terminal */ 7031545Sminshall #define TELOPT_SUPDUP 21 /* supdup protocol */ 7131545Sminshall #define TELOPT_SUPDUPOUTPUT 22 /* supdup output */ 7231545Sminshall #define TELOPT_SNDLOC 23 /* send location */ 7331545Sminshall #define TELOPT_TTYPE 24 /* terminal type */ 7431545Sminshall #define TELOPT_EOR 25 /* end or record */ 7537218Sminshall #define TELOPT_TUID 26 /* TACACS user identification */ 7637218Sminshall #define TELOPT_OUTMRK 27 /* output marking */ 7737218Sminshall #define TELOPT_TTYLOC 28 /* terminal location number */ 7837218Sminshall #define TELOPT_3270REGIME 29 /* 3270 regime */ 7937218Sminshall #define TELOPT_X3PAD 30 /* X.3 PAD */ 8037218Sminshall #define TELOPT_NAWS 31 /* window size */ 8137218Sminshall #define TELOPT_TSPEED 32 /* terminal speed */ 8237218Sminshall #define TELOPT_LFLOW 33 /* remote flow control */ 8338693Sborman #define TELOPT_LINEMODE 34 /* Linemode option */ 8437218Sminshall #define TELOPT_EXOPL 255 /* extended-options-list */ 8531545Sminshall 8638911Sborman #define NTELOPTS (1+TELOPT_LINEMODE) 8731545Sminshall #ifdef TELOPTS 8831545Sminshall char *telopts[NTELOPTS] = { 8931545Sminshall "BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME", 9031545Sminshall "STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP", 9131545Sminshall "NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS", 9231545Sminshall "NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO", 9331545Sminshall "DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT", 9431545Sminshall "SEND LOCATION", "TERMINAL TYPE", "END OF RECORD", 9537218Sminshall "TACACS UID", "OUTPUT MARKING", "TTYLOC", 9637218Sminshall "3270 REGIME", "X.3 PAD", "NAWS", "TSPEED", "LFLOW", 9738693Sborman "LINEMODE", 9831545Sminshall }; 9938693Sborman #define TELOPT_FIRST TELOPT_BINARY 10038693Sborman #define TELOPT_LAST TELOPT_LINEMODE 10138693Sborman #define TELOPT_OK(x) ((x) <= TELOPT_LAST && (x) >= TELOPT_FIRST) 10238693Sborman #define TELOPT(x) telopts[(x)-TELOPT_FIRST] 10331545Sminshall #endif 10431545Sminshall 10531545Sminshall /* sub-option qualifiers */ 10631545Sminshall #define TELQUAL_IS 0 /* option is... */ 10731545Sminshall #define TELQUAL_SEND 1 /* send option */ 10838693Sborman 10938693Sborman /* 11038693Sborman * LINEMODE suboptions 11138693Sborman */ 11238693Sborman 11338693Sborman #define LM_MODE 1 11438693Sborman #define LM_FORWARDMASK 2 11538693Sborman #define LM_SLC 3 11638693Sborman 11738693Sborman #define MODE_EDIT 0x01 11838693Sborman #define MODE_TRAPSIG 0x02 11938693Sborman #define MODE_ACK 0x04 12038693Sborman 12138693Sborman #define MODE_MASK (MODE_EDIT|MODE_TRAPSIG|MODE_ACK) 12238693Sborman 12338693Sborman /* Not part of protocol, but needed to simplify things... */ 12438693Sborman #define MODE_FLOW 0x40 12538693Sborman #define MODE_ECHO 0x80 12638693Sborman #define MODE_FORCE 0x20 12738693Sborman 12838693Sborman #define SLC_SYNCH 1 12938693Sborman #define SLC_BRK 2 13038693Sborman #define SLC_IP 3 13138693Sborman #define SLC_AO 4 13238693Sborman #define SLC_AYT 5 13338693Sborman #define SLC_EOR 6 13438693Sborman #define SLC_ABORT 7 13538693Sborman #define SLC_EOF 8 13638693Sborman #define SLC_SUSP 9 13738693Sborman #define SLC_EC 10 13838693Sborman #define SLC_EL 11 13938693Sborman #define SLC_EW 12 14038693Sborman #define SLC_RP 13 14138693Sborman #define SLC_LNEXT 14 14238693Sborman #define SLC_XON 15 14338693Sborman #define SLC_XOFF 16 14438693Sborman #define SLC_FORW1 17 14538693Sborman #define SLC_FORW2 18 14638693Sborman 14738693Sborman #define NSLC 18 14838693Sborman 14938693Sborman #define SLC_NAMES "0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \ 15038693Sborman "ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \ 15138693Sborman "LNEXT", "XON", "XOFF", "FORW1", "FORW2" 15238693Sborman 15338693Sborman #define SLC_NOSUPPORT 0 15438693Sborman #define SLC_CANTCHANGE 1 15538693Sborman #define SLC_VARIABLE 2 15638693Sborman #define SLC_DEFAULT 3 15738693Sborman #define SLC_LEVELBITS 0x03 15838693Sborman 15938693Sborman #define SLC_FUNC 0 16038693Sborman #define SLC_FLAGS 1 16138693Sborman #define SLC_VALUE 2 16238693Sborman 16338693Sborman #define SLC_ACK 0x80 16438693Sborman #define SLC_FLUSHIN 0x40 16538693Sborman #define SLC_FLUSHOUT 0x20 166