sl@0: /* TELNET.H sl@0: * sl@0: * Portions Copyright (c) 1993-1999 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: */ sl@0: sl@0: /** @file sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: sl@0: /* sl@0: * Copyright (c) 1983, 1993 sl@0: * The Regents of the University of California. All rights reserved. sl@0: * sl@0: * Redistribution and use in source and binary forms, with or without sl@0: * modification, are permitted provided that the following conditions sl@0: * are met: sl@0: * 1. Redistributions of source code must retain the above copyright sl@0: * notice, this list of conditions and the following disclaimer. sl@0: * 2. Redistributions in binary form must reproduce the above copyright sl@0: * notice, this list of conditions and the following disclaimer in the sl@0: * documentation and/or other materials provided with the distribution. sl@0: * 3. All advertising materials mentioning features or use of this software sl@0: * must display the following acknowledgement: sl@0: * This product includes software developed by the University of sl@0: * California, Berkeley and its contributors. sl@0: * 4. Neither the name of the University nor the names of its contributors sl@0: * may be used to endorse or promote products derived from this software sl@0: * without specific prior written permission. sl@0: * sl@0: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND sl@0: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE sl@0: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE sl@0: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE sl@0: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL sl@0: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS sl@0: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) sl@0: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT sl@0: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY sl@0: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF sl@0: * SUCH DAMAGE. sl@0: * sl@0: * @(#)telnet.h 8.2 (Berkeley) 12/15/93 sl@0: */ sl@0: sl@0: #ifndef _ARPA_TELNET_H_ sl@0: #define _ARPA_TELNET_H_ sl@0: sl@0: /** sl@0: Definitions for the TELNET protocol. sl@0: */ sl@0: #define IAC 255 /* interpret as command: */ sl@0: #define DONT 254 /* you are not to use option */ sl@0: #define DO 253 /* please, you use option */ sl@0: #define WONT 252 /* I won't use option */ sl@0: #define WILL 251 /* I will use option */ sl@0: #define SB 250 /* interpret as subnegotiation */ sl@0: #define GA 249 /* you may reverse the line */ sl@0: #define EL 248 /* erase the current line */ sl@0: #define EC 247 /* erase the current character */ sl@0: #define AYT 246 /* are you there */ sl@0: #define AO 245 /* abort output--but let prog finish */ sl@0: #define IP 244 /* interrupt process--permanently */ sl@0: #define BREAK 243 /* break */ sl@0: #define DM 242 /* data mark--for connect. cleaning */ sl@0: #define NOP 241 /* nop */ sl@0: #define SE 240 /* end sub negotiation */ sl@0: #define EOR 239 /* end of record (transparent mode) */ sl@0: #define ABORT 238 /* Abort process */ sl@0: #define SUSP 237 /* Suspend process */ sl@0: #define xEOF 236 /* End of file: EOF is already used... */ sl@0: sl@0: #define SYNCH 242 /* for telfunc calls */ sl@0: sl@0: #ifdef TELCMDS sl@0: char *telcmds[] = { sl@0: "EOF", "SUSP", "ABORT", "EOR", sl@0: "SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC", sl@0: "EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC", sl@0: 0 sl@0: }; sl@0: #else sl@0: extern char *telcmds[]; sl@0: #endif sl@0: sl@0: #define TELCMD_FIRST xEOF sl@0: #define TELCMD_LAST IAC sl@0: #define TELCMD_OK(x) ((unsigned int)(x) <= TELCMD_LAST && \ sl@0: (unsigned int)(x) >= TELCMD_FIRST) sl@0: #define TELCMD(x) telcmds[(x)-TELCMD_FIRST] sl@0: sl@0: /** sl@0: telnet options sl@0: */ sl@0: #define TELOPT_BINARY 0 /* 8-bit data path */ sl@0: #define TELOPT_ECHO 1 /* echo */ sl@0: #define TELOPT_RCP 2 /* prepare to reconnect */ sl@0: #define TELOPT_SGA 3 /* suppress go ahead */ sl@0: #define TELOPT_NAMS 4 /* approximate message size */ sl@0: #define TELOPT_STATUS 5 /* give status */ sl@0: #define TELOPT_TM 6 /* timing mark */ sl@0: #define TELOPT_RCTE 7 /* remote controlled transmission and echo */ sl@0: #define TELOPT_NAOL 8 /* negotiate about output line width */ sl@0: #define TELOPT_NAOP 9 /* negotiate about output page size */ sl@0: #define TELOPT_NAOCRD 10 /* negotiate about CR disposition */ sl@0: #define TELOPT_NAOHTS 11 /* negotiate about horizontal tabstops */ sl@0: #define TELOPT_NAOHTD 12 /* negotiate about horizontal tab disposition */ sl@0: #define TELOPT_NAOFFD 13 /* negotiate about formfeed disposition */ sl@0: #define TELOPT_NAOVTS 14 /* negotiate about vertical tab stops */ sl@0: #define TELOPT_NAOVTD 15 /* negotiate about vertical tab disposition */ sl@0: #define TELOPT_NAOLFD 16 /* negotiate about output LF disposition */ sl@0: #define TELOPT_XASCII 17 /* extended ascic character set */ sl@0: #define TELOPT_LOGOUT 18 /* force logout */ sl@0: #define TELOPT_BM 19 /* byte macro */ sl@0: #define TELOPT_DET 20 /* data entry terminal */ sl@0: #define TELOPT_SUPDUP 21 /* supdup protocol */ sl@0: #define TELOPT_SUPDUPOUTPUT 22 /* supdup output */ sl@0: #define TELOPT_SNDLOC 23 /* send location */ sl@0: #define TELOPT_TTYPE 24 /* terminal type */ sl@0: #define TELOPT_EOR 25 /* end or record */ sl@0: #define TELOPT_TUID 26 /* TACACS user identification */ sl@0: #define TELOPT_OUTMRK 27 /* output marking */ sl@0: #define TELOPT_TTYLOC 28 /* terminal location number */ sl@0: #define TELOPT_3270REGIME 29 /* 3270 regime */ sl@0: #define TELOPT_X3PAD 30 /* X.3 PAD */ sl@0: #define TELOPT_NAWS 31 /* window size */ sl@0: #define TELOPT_TSPEED 32 /* terminal speed */ sl@0: #define TELOPT_LFLOW 33 /* remote flow control */ sl@0: #define TELOPT_LINEMODE 34 /* Linemode option */ sl@0: #define TELOPT_XDISPLOC 35 /* X Display Location */ sl@0: #define TELOPT_OLD_ENVIRON 36 /* Old - Environment variables */ sl@0: #define TELOPT_AUTHENTICATION 37/* Authenticate */ sl@0: #define TELOPT_ENCRYPT 38 /* Encryption option */ sl@0: #define TELOPT_NEW_ENVIRON 39 /* New - Environment variables */ sl@0: #define TELOPT_EXOPL 255 /* extended-options-list */ sl@0: sl@0: #define NTELOPTS (1+TELOPT_NEW_ENVIRON) sl@0: #ifdef TELOPTS sl@0: char *telopts[NTELOPTS+1] = { sl@0: "BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME", sl@0: "STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP", sl@0: "NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS", sl@0: "NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO", sl@0: "DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT", sl@0: "SEND LOCATION", "TERMINAL TYPE", "END OF RECORD", sl@0: "TACACS UID", "OUTPUT MARKING", "TTYLOC", sl@0: "3270 REGIME", "X.3 PAD", "NAWS", "TSPEED", "LFLOW", sl@0: "LINEMODE", "XDISPLOC", "OLD-ENVIRON", "AUTHENTICATION", sl@0: "ENCRYPT", "NEW-ENVIRON", sl@0: 0 sl@0: }; sl@0: sl@0: #define TELOPT_FIRST TELOPT_BINARY sl@0: #define TELOPT_LAST TELOPT_NEW_ENVIRON sl@0: #define TELOPT_OK(x) ((unsigned int)(x) <= TELOPT_LAST) sl@0: #define TELOPT(x) telopts[(x)-TELOPT_FIRST] sl@0: #endif sl@0: sl@0: /** sl@0: sub-option qualifiers sl@0: */ sl@0: #define TELQUAL_IS 0 /* option is... */ sl@0: #define TELQUAL_SEND 1 /* send option */ sl@0: #define TELQUAL_INFO 2 /* ENVIRON: informational version of IS */ sl@0: #define TELQUAL_REPLY 2 /* AUTHENTICATION: client version of IS */ sl@0: #define TELQUAL_NAME 3 /* AUTHENTICATION: client version of IS */ sl@0: sl@0: #define LFLOW_OFF 0 /* Disable remote flow control */ sl@0: #define LFLOW_ON 1 /* Enable remote flow control */ sl@0: #define LFLOW_RESTART_ANY 2 /* Restart output on any char */ sl@0: #define LFLOW_RESTART_XON 3 /* Restart output only on XON */ sl@0: sl@0: /** sl@0: LINEMODE suboptions sl@0: */ sl@0: #define LM_MODE 1 sl@0: #define LM_FORWARDMASK 2 sl@0: #define LM_SLC 3 sl@0: sl@0: #define MODE_EDIT 0x01 sl@0: #define MODE_TRAPSIG 0x02 sl@0: #define MODE_ACK 0x04 sl@0: #define MODE_SOFT_TAB 0x08 sl@0: #define MODE_LIT_ECHO 0x10 sl@0: sl@0: #define MODE_MASK 0x1f sl@0: sl@0: /** sl@0: Not part of protocol, but needed to simplify things... sl@0: */ sl@0: #define MODE_FLOW 0x0100 sl@0: #define MODE_ECHO 0x0200 sl@0: #define MODE_INBIN 0x0400 sl@0: #define MODE_OUTBIN 0x0800 sl@0: #define MODE_FORCE 0x1000 sl@0: sl@0: #define SLC_SYNCH 1 sl@0: #define SLC_BRK 2 sl@0: #define SLC_IP 3 sl@0: #define SLC_AO 4 sl@0: #define SLC_AYT 5 sl@0: #define SLC_EOR 6 sl@0: #define SLC_ABORT 7 sl@0: #define SLC_EOF 8 sl@0: #define SLC_SUSP 9 sl@0: #define SLC_EC 10 sl@0: #define SLC_EL 11 sl@0: #define SLC_EW 12 sl@0: #define SLC_RP 13 sl@0: #define SLC_LNEXT 14 sl@0: #define SLC_XON 15 sl@0: #define SLC_XOFF 16 sl@0: #define SLC_FORW1 17 sl@0: #define SLC_FORW2 18 sl@0: #define SLC_MCL 19 sl@0: #define SLC_MCR 20 sl@0: #define SLC_MCWL 21 sl@0: #define SLC_MCWR 22 sl@0: #define SLC_MCBOL 23 sl@0: #define SLC_MCEOL 24 sl@0: #define SLC_INSRT 25 sl@0: #define SLC_OVER 26 sl@0: #define SLC_ECR 27 sl@0: #define SLC_EWR 28 sl@0: #define SLC_EBOL 29 sl@0: #define SLC_EEOL 30 sl@0: sl@0: #define NSLC 30 sl@0: sl@0: /** sl@0: For backwards compatability, we define SLC_NAMES to be the sl@0: list of names if SLC_NAMES is not defined. sl@0: */ sl@0: #define SLC_NAMELIST "0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \ sl@0: "ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \ sl@0: "LNEXT", "XON", "XOFF", "FORW1", "FORW2", \ sl@0: "MCL", "MCR", "MCWL", "MCWR", "MCBOL", \ sl@0: "MCEOL", "INSRT", "OVER", "ECR", "EWR", \ sl@0: "EBOL", "EEOL", \ sl@0: 0 sl@0: sl@0: #ifdef SLC_NAMES sl@0: char *slc_names[] = { sl@0: SLC_NAMELIST sl@0: }; sl@0: #else sl@0: extern char *slc_names[]; sl@0: #define SLC_NAMES SLC_NAMELIST sl@0: #endif sl@0: sl@0: #define SLC_NAME_OK(x) ((unsigned int)(x) <= NSLC) sl@0: #define SLC_NAME(x) slc_names[x] sl@0: sl@0: #define SLC_NOSUPPORT 0 sl@0: #define SLC_CANTCHANGE 1 sl@0: #define SLC_VARIABLE 2 sl@0: #define SLC_DEFAULT 3 sl@0: #define SLC_LEVELBITS 0x03 sl@0: sl@0: #define SLC_FUNC 0 sl@0: #define SLC_FLAGS 1 sl@0: #define SLC_VALUE 2 sl@0: sl@0: #define SLC_ACK 0x80 sl@0: #define SLC_FLUSHIN 0x40 sl@0: #define SLC_FLUSHOUT 0x20 sl@0: sl@0: #define OLD_ENV_VAR 1 sl@0: #define OLD_ENV_VALUE 0 sl@0: #define NEW_ENV_VAR 0 sl@0: #define NEW_ENV_VALUE 1 sl@0: #define ENV_ESC 2 sl@0: #define ENV_USERVAR 3 sl@0: sl@0: /* sl@0: * AUTHENTICATION suboptions sl@0: */ sl@0: sl@0: /** sl@0: Who is authenticating who ... sl@0: */ sl@0: #define AUTH_WHO_CLIENT 0 /* Client authenticating server */ sl@0: #define AUTH_WHO_SERVER 1 /* Server authenticating client */ sl@0: #define AUTH_WHO_MASK 1 sl@0: sl@0: /** sl@0: amount of authentication done sl@0: */ sl@0: #define AUTH_HOW_ONE_WAY 0 sl@0: #define AUTH_HOW_MUTUAL 2 sl@0: #define AUTH_HOW_MASK 2 sl@0: sl@0: #define AUTHTYPE_NULL 0 sl@0: #define AUTHTYPE_KERBEROS_V4 1 sl@0: #define AUTHTYPE_KERBEROS_V5 2 sl@0: #define AUTHTYPE_SPX 3 sl@0: #define AUTHTYPE_MINK 4 sl@0: #define AUTHTYPE_CNT 5 sl@0: sl@0: #define AUTHTYPE_TEST 99 sl@0: sl@0: #ifdef AUTH_NAMES sl@0: char *authtype_names[] = { sl@0: "NULL", "KERBEROS_V4", "KERBEROS_V5", "SPX", "MINK", sl@0: 0 sl@0: }; sl@0: #else sl@0: extern char *authtype_names[]; sl@0: #endif sl@0: sl@0: #define AUTHTYPE_NAME_OK(x) ((unsigned int)(x) < AUTHTYPE_CNT) sl@0: #define AUTHTYPE_NAME(x) authtype_names[x] sl@0: sl@0: /** sl@0: ENCRYPTion suboptions sl@0: */ sl@0: #define ENCRYPT_IS 0 /* I pick encryption type ... */ sl@0: #define ENCRYPT_SUPPORT 1 /* I support encryption types ... */ sl@0: #define ENCRYPT_REPLY 2 /* Initial setup response */ sl@0: #define ENCRYPT_START 3 /* Am starting to send encrypted */ sl@0: #define ENCRYPT_END 4 /* Am ending encrypted */ sl@0: #define ENCRYPT_REQSTART 5 /* Request you start encrypting */ sl@0: #define ENCRYPT_REQEND 6 /* Request you end encrypting */ sl@0: #define ENCRYPT_ENC_KEYID 7 sl@0: #define ENCRYPT_DEC_KEYID 8 sl@0: #define ENCRYPT_CNT 9 sl@0: #define ENCTYPE_ANY 0 sl@0: #define ENCTYPE_DES_CFB64 1 sl@0: #define ENCTYPE_DES_OFB64 2 sl@0: #define ENCTYPE_CNT 3 sl@0: sl@0: #ifdef ENCRYPT_NAMES sl@0: char *encrypt_names[] = { sl@0: "IS", "SUPPORT", "REPLY", "START", "END", sl@0: "REQUEST-START", "REQUEST-END", "ENC-KEYID", "DEC-KEYID", sl@0: 0 sl@0: }; sl@0: char *enctype_names[] = { sl@0: "ANY", "DES_CFB64", "DES_OFB64", sl@0: 0 sl@0: }; sl@0: #else sl@0: extern char *encrypt_names[]; sl@0: extern char *enctype_names[]; sl@0: #endif sl@0: sl@0: #define ENCRYPT_NAME_OK(x) ((unsigned int)(x) < ENCRYPT_CNT) sl@0: #define ENCRYPT_NAME(x) encrypt_names[x] sl@0: sl@0: #define ENCTYPE_NAME_OK(x) ((unsigned int)(x) < ENCTYPE_CNT) sl@0: #define ENCTYPE_NAME(x) enctype_names[x] sl@0: sl@0: #endif /* !_TELNET_H_ */