Path: blob/main/crypto/heimdal/appl/telnet/arpa/telnet.h
34879 views
/*1* Copyright (c) 1983, 19932* The Regents of the University of California. All rights reserved.3*4* Redistribution and use in source and binary forms, with or without5* modification, are permitted provided that the following conditions6* are met:7* 1. Redistributions of source code must retain the above copyright8* notice, this list of conditions and the following disclaimer.9* 2. Redistributions in binary form must reproduce the above copyright10* notice, this list of conditions and the following disclaimer in the11* documentation and/or other materials provided with the distribution.12* 3. All advertising materials mentioning features or use of this software13* must display the following acknowledgement:14* This product includes software developed by the University of15* California, Berkeley and its contributors.16* 4. Neither the name of the University nor the names of its contributors17* may be used to endorse or promote products derived from this software18* without specific prior written permission.19*20* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND21* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE22* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE23* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE24* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL25* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS26* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)27* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT28* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY29* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF30* SUCH DAMAGE.31*32* @(#)telnet.h 8.2 (Berkeley) 12/15/9333*/3435#ifndef _TELNET_H_36#define _TELNET_H_3738/*39* Definitions for the TELNET protocol.40*/41#define IAC 255 /* interpret as command: */42#define DONT 254 /* you are not to use option */43#define DO 253 /* please, you use option */44#define WONT 252 /* I won't use option */45#define WILL 251 /* I will use option */46#define SB 250 /* interpret as subnegotiation */47#define GA 249 /* you may reverse the line */48#define EL 248 /* erase the current line */49#define EC 247 /* erase the current character */50#define AYT 246 /* are you there */51#define AO 245 /* abort output--but let prog finish */52#define IP 244 /* interrupt process--permanently */53#define BREAK 243 /* break */54#define DM 242 /* data mark--for connect. cleaning */55#define NOP 241 /* nop */56#define SE 240 /* end sub negotiation */57#define EOR 239 /* end of record (transparent mode) */58#define ABORT 238 /* Abort process */59#define SUSP 237 /* Suspend process */60#define xEOF 236 /* End of file: EOF is already used... */6162#define SYNCH 242 /* for telfunc calls */6364#ifdef TELCMDS65char *telcmds[] = {66"EOF", "SUSP", "ABORT", "EOR",67"SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC",68"EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC", 0,69};70#else71extern char *telcmds[];72#endif7374#define TELCMD_FIRST xEOF75#define TELCMD_LAST IAC76#define TELCMD_OK(x) ((unsigned int)(x) <= TELCMD_LAST && \77(unsigned int)(x) >= TELCMD_FIRST)78#define TELCMD(x) telcmds[(x)-TELCMD_FIRST]7980/* telnet options */81#define TELOPT_BINARY 0 /* 8-bit data path */82#define TELOPT_ECHO 1 /* echo */83#define TELOPT_RCP 2 /* prepare to reconnect */84#define TELOPT_SGA 3 /* suppress go ahead */85#define TELOPT_NAMS 4 /* approximate message size */86#define TELOPT_STATUS 5 /* give status */87#define TELOPT_TM 6 /* timing mark */88#define TELOPT_RCTE 7 /* remote controlled transmission and echo */89#define TELOPT_NAOL 8 /* negotiate about output line width */90#define TELOPT_NAOP 9 /* negotiate about output page size */91#define TELOPT_NAOCRD 10 /* negotiate about CR disposition */92#define TELOPT_NAOHTS 11 /* negotiate about horizontal tabstops */93#define TELOPT_NAOHTD 12 /* negotiate about horizontal tab disposition */94#define TELOPT_NAOFFD 13 /* negotiate about formfeed disposition */95#define TELOPT_NAOVTS 14 /* negotiate about vertical tab stops */96#define TELOPT_NAOVTD 15 /* negotiate about vertical tab disposition */97#define TELOPT_NAOLFD 16 /* negotiate about output LF disposition */98#define TELOPT_XASCII 17 /* extended ascic character set */99#define TELOPT_LOGOUT 18 /* force logout */100#define TELOPT_BM 19 /* byte macro */101#define TELOPT_DET 20 /* data entry terminal */102#define TELOPT_SUPDUP 21 /* supdup protocol */103#define TELOPT_SUPDUPOUTPUT 22 /* supdup output */104#define TELOPT_SNDLOC 23 /* send location */105#define TELOPT_TTYPE 24 /* terminal type */106#define TELOPT_EOR 25 /* end or record */107#define TELOPT_TUID 26 /* TACACS user identification */108#define TELOPT_OUTMRK 27 /* output marking */109#define TELOPT_TTYLOC 28 /* terminal location number */110#define TELOPT_3270REGIME 29 /* 3270 regime */111#define TELOPT_X3PAD 30 /* X.3 PAD */112#define TELOPT_NAWS 31 /* window size */113#define TELOPT_TSPEED 32 /* terminal speed */114#define TELOPT_LFLOW 33 /* remote flow control */115#define TELOPT_LINEMODE 34 /* Linemode option */116#define TELOPT_XDISPLOC 35 /* X Display Location */117#define TELOPT_OLD_ENVIRON 36 /* Old - Environment variables */118#define TELOPT_AUTHENTICATION 37/* Authenticate */119#define TELOPT_ENCRYPT 38 /* Encryption option */120#define TELOPT_NEW_ENVIRON 39 /* New - Environment variables */121#define TELOPT_EXOPL 255 /* extended-options-list */122123124#define NTELOPTS (1+TELOPT_NEW_ENVIRON)125#ifdef TELOPTS126char *telopts[NTELOPTS+1] = {127"BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME",128"STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP",129"NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS",130"NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO",131"DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT",132"SEND LOCATION", "TERMINAL TYPE", "END OF RECORD",133"TACACS UID", "OUTPUT MARKING", "TTYLOC",134"3270 REGIME", "X.3 PAD", "NAWS", "TSPEED", "LFLOW",135"LINEMODE", "XDISPLOC", "OLD-ENVIRON", "AUTHENTICATION",136"ENCRYPT", "NEW-ENVIRON",1370,138};139#define TELOPT_FIRST TELOPT_BINARY140#define TELOPT_LAST TELOPT_NEW_ENVIRON141#define TELOPT_OK(x) ((unsigned int)(x) <= TELOPT_LAST)142#define TELOPT(x) telopts[(x)-TELOPT_FIRST]143#endif144145/* sub-option qualifiers */146#define TELQUAL_IS 0 /* option is... */147#define TELQUAL_SEND 1 /* send option */148#define TELQUAL_INFO 2 /* ENVIRON: informational version of IS */149#define TELQUAL_REPLY 2 /* AUTHENTICATION: client version of IS */150#define TELQUAL_NAME 3 /* AUTHENTICATION: client version of IS */151152#define LFLOW_OFF 0 /* Disable remote flow control */153#define LFLOW_ON 1 /* Enable remote flow control */154#define LFLOW_RESTART_ANY 2 /* Restart output on any char */155#define LFLOW_RESTART_XON 3 /* Restart output only on XON */156157/*158* LINEMODE suboptions159*/160161#define LM_MODE 1162#define LM_FORWARDMASK 2163#define LM_SLC 3164165#define MODE_EDIT 0x01166#define MODE_TRAPSIG 0x02167#define MODE_ACK 0x04168#define MODE_SOFT_TAB 0x08169#define MODE_LIT_ECHO 0x10170171#define MODE_MASK 0x1f172173/* Not part of protocol, but needed to simplify things... */174#define MODE_FLOW 0x0100175#define MODE_ECHO 0x0200176#define MODE_INBIN 0x0400177#define MODE_OUTBIN 0x0800178#define MODE_FORCE 0x1000179180#define SLC_SYNCH 1181#define SLC_BRK 2182#define SLC_IP 3183#define SLC_AO 4184#define SLC_AYT 5185#define SLC_EOR 6186#define SLC_ABORT 7187#define SLC_EOF 8188#define SLC_SUSP 9189#define SLC_EC 10190#define SLC_EL 11191#define SLC_EW 12192#define SLC_RP 13193#define SLC_LNEXT 14194#define SLC_XON 15195#define SLC_XOFF 16196#define SLC_FORW1 17197#define SLC_FORW2 18198199#define NSLC 18200201/*202* For backwards compatability, we define SLC_NAMES to be the203* list of names if SLC_NAMES is not defined.204*/205#define SLC_NAMELIST "0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \206"ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \207"LNEXT", "XON", "XOFF", "FORW1", "FORW2", 0,208#ifdef SLC_NAMES209char *slc_names[] = {210SLC_NAMELIST211};212#else213extern char *slc_names[];214#define SLC_NAMES SLC_NAMELIST215#endif216217#define SLC_NAME_OK(x) ((unsigned int)(x) <= NSLC)218#define SLC_NAME(x) slc_names[x]219220#define SLC_NOSUPPORT 0221#define SLC_CANTCHANGE 1222#define SLC_VARIABLE 2223#define SLC_DEFAULT 3224#define SLC_LEVELBITS 0x03225226#define SLC_FUNC 0227#define SLC_FLAGS 1228#define SLC_VALUE 2229230#define SLC_ACK 0x80231#define SLC_FLUSHIN 0x40232#define SLC_FLUSHOUT 0x20233234#define OLD_ENV_VAR 1235#define OLD_ENV_VALUE 0236#define NEW_ENV_VAR 0237#define NEW_ENV_VALUE 1238#define ENV_ESC 2239#define ENV_USERVAR 3240241/*242* AUTHENTICATION suboptions243*/244245/*246* Who is authenticating who ...247*/248#define AUTH_WHO_CLIENT 0 /* Client authenticating server */249#define AUTH_WHO_SERVER 1 /* Server authenticating client */250#define AUTH_WHO_MASK 1251252/*253* amount of authentication done254*/255#define AUTH_HOW_ONE_WAY 0256#define AUTH_HOW_MUTUAL 2257#define AUTH_HOW_MASK 2258259#define AUTHTYPE_NULL 0260#define AUTHTYPE_KERBEROS_V4 1261#define AUTHTYPE_KERBEROS_V5 2262#define AUTHTYPE_SPX 3263#define AUTHTYPE_MINK 4264#define AUTHTYPE_SRA 5265#define AUTHTYPE_CNT 6266/* #define AUTHTYPE_UNSECURE 6 */267268#define AUTHTYPE_TEST 99269270#ifdef AUTH_NAMES271char *authtype_names[] = {272"NULL", "KERBEROS_V4", "KERBEROS_V5", "SPX", "MINK",273"SRA", 0,274};275#else276extern char *authtype_names[];277#endif278279#define AUTHTYPE_NAME_OK(x) ((unsigned int)(x) < AUTHTYPE_CNT)280#define AUTHTYPE_NAME(x) authtype_names[x]281282/*283* ENCRYPTion suboptions284*/285#define ENCRYPT_IS 0 /* I pick encryption type ... */286#define ENCRYPT_SUPPORT 1 /* I support encryption types ... */287#define ENCRYPT_REPLY 2 /* Initial setup response */288#define ENCRYPT_START 3 /* Am starting to send encrypted */289#define ENCRYPT_END 4 /* Am ending encrypted */290#define ENCRYPT_REQSTART 5 /* Request you start encrypting */291#define ENCRYPT_REQEND 6 /* Request you send encrypting */292#define ENCRYPT_ENC_KEYID 7293#define ENCRYPT_DEC_KEYID 8294#define ENCRYPT_CNT 9295296#define ENCTYPE_ANY 0297#define ENCTYPE_DES_CFB64 1298#define ENCTYPE_DES_OFB64 2299#define ENCTYPE_CNT 3300301#ifdef ENCRYPT_NAMES302char *encrypt_names[] = {303"IS", "SUPPORT", "REPLY", "START", "END",304"REQUEST-START", "REQUEST-END", "ENC-KEYID", "DEC-KEYID",3050,306};307char *enctype_names[] = {308"ANY", "DES_CFB64", "DES_OFB64", 0,309};310#else311extern char *encrypt_names[];312extern char *enctype_names[];313#endif314315316#define ENCRYPT_NAME_OK(x) ((unsigned int)(x) < ENCRYPT_CNT)317#define ENCRYPT_NAME(x) encrypt_names[x]318319#define ENCTYPE_NAME_OK(x) ((unsigned int)(x) < ENCTYPE_CNT)320#define ENCTYPE_NAME(x) enctype_names[x]321322#endif /* !_TELNET_H_ */323324325