1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/genericopenlibs/cstdlib/LINCARPA/TELNET.H Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,354 @@
1.4 +/* TELNET.H
1.5 + *
1.6 + * Portions Copyright (c) 1993-1999 Nokia Corporation and/or its subsidiary(-ies).
1.7 + * All rights reserved.
1.8 + */
1.9 +
1.10 +/** @file
1.11 +@publishedAll
1.12 +@released
1.13 +*/
1.14 +
1.15 +/*
1.16 + * Copyright (c) 1983, 1993
1.17 + * The Regents of the University of California. All rights reserved.
1.18 + *
1.19 + * Redistribution and use in source and binary forms, with or without
1.20 + * modification, are permitted provided that the following conditions
1.21 + * are met:
1.22 + * 1. Redistributions of source code must retain the above copyright
1.23 + * notice, this list of conditions and the following disclaimer.
1.24 + * 2. Redistributions in binary form must reproduce the above copyright
1.25 + * notice, this list of conditions and the following disclaimer in the
1.26 + * documentation and/or other materials provided with the distribution.
1.27 + * 3. All advertising materials mentioning features or use of this software
1.28 + * must display the following acknowledgement:
1.29 + * This product includes software developed by the University of
1.30 + * California, Berkeley and its contributors.
1.31 + * 4. Neither the name of the University nor the names of its contributors
1.32 + * may be used to endorse or promote products derived from this software
1.33 + * without specific prior written permission.
1.34 + *
1.35 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1.36 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1.37 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1.38 + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
1.39 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1.40 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1.41 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1.42 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1.43 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1.44 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1.45 + * SUCH DAMAGE.
1.46 + *
1.47 + * @(#)telnet.h 8.2 (Berkeley) 12/15/93
1.48 + */
1.49 +
1.50 +#ifndef _ARPA_TELNET_H_
1.51 +#define _ARPA_TELNET_H_
1.52 +
1.53 +/**
1.54 +Definitions for the TELNET protocol.
1.55 +*/
1.56 +#define IAC 255 /* interpret as command: */
1.57 +#define DONT 254 /* you are not to use option */
1.58 +#define DO 253 /* please, you use option */
1.59 +#define WONT 252 /* I won't use option */
1.60 +#define WILL 251 /* I will use option */
1.61 +#define SB 250 /* interpret as subnegotiation */
1.62 +#define GA 249 /* you may reverse the line */
1.63 +#define EL 248 /* erase the current line */
1.64 +#define EC 247 /* erase the current character */
1.65 +#define AYT 246 /* are you there */
1.66 +#define AO 245 /* abort output--but let prog finish */
1.67 +#define IP 244 /* interrupt process--permanently */
1.68 +#define BREAK 243 /* break */
1.69 +#define DM 242 /* data mark--for connect. cleaning */
1.70 +#define NOP 241 /* nop */
1.71 +#define SE 240 /* end sub negotiation */
1.72 +#define EOR 239 /* end of record (transparent mode) */
1.73 +#define ABORT 238 /* Abort process */
1.74 +#define SUSP 237 /* Suspend process */
1.75 +#define xEOF 236 /* End of file: EOF is already used... */
1.76 +
1.77 +#define SYNCH 242 /* for telfunc calls */
1.78 +
1.79 +#ifdef TELCMDS
1.80 +char *telcmds[] = {
1.81 + "EOF", "SUSP", "ABORT", "EOR",
1.82 + "SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC",
1.83 + "EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC",
1.84 + 0
1.85 +};
1.86 +#else
1.87 +extern char *telcmds[];
1.88 +#endif
1.89 +
1.90 +#define TELCMD_FIRST xEOF
1.91 +#define TELCMD_LAST IAC
1.92 +#define TELCMD_OK(x) ((unsigned int)(x) <= TELCMD_LAST && \
1.93 + (unsigned int)(x) >= TELCMD_FIRST)
1.94 +#define TELCMD(x) telcmds[(x)-TELCMD_FIRST]
1.95 +
1.96 +/**
1.97 +telnet options
1.98 +*/
1.99 +#define TELOPT_BINARY 0 /* 8-bit data path */
1.100 +#define TELOPT_ECHO 1 /* echo */
1.101 +#define TELOPT_RCP 2 /* prepare to reconnect */
1.102 +#define TELOPT_SGA 3 /* suppress go ahead */
1.103 +#define TELOPT_NAMS 4 /* approximate message size */
1.104 +#define TELOPT_STATUS 5 /* give status */
1.105 +#define TELOPT_TM 6 /* timing mark */
1.106 +#define TELOPT_RCTE 7 /* remote controlled transmission and echo */
1.107 +#define TELOPT_NAOL 8 /* negotiate about output line width */
1.108 +#define TELOPT_NAOP 9 /* negotiate about output page size */
1.109 +#define TELOPT_NAOCRD 10 /* negotiate about CR disposition */
1.110 +#define TELOPT_NAOHTS 11 /* negotiate about horizontal tabstops */
1.111 +#define TELOPT_NAOHTD 12 /* negotiate about horizontal tab disposition */
1.112 +#define TELOPT_NAOFFD 13 /* negotiate about formfeed disposition */
1.113 +#define TELOPT_NAOVTS 14 /* negotiate about vertical tab stops */
1.114 +#define TELOPT_NAOVTD 15 /* negotiate about vertical tab disposition */
1.115 +#define TELOPT_NAOLFD 16 /* negotiate about output LF disposition */
1.116 +#define TELOPT_XASCII 17 /* extended ascic character set */
1.117 +#define TELOPT_LOGOUT 18 /* force logout */
1.118 +#define TELOPT_BM 19 /* byte macro */
1.119 +#define TELOPT_DET 20 /* data entry terminal */
1.120 +#define TELOPT_SUPDUP 21 /* supdup protocol */
1.121 +#define TELOPT_SUPDUPOUTPUT 22 /* supdup output */
1.122 +#define TELOPT_SNDLOC 23 /* send location */
1.123 +#define TELOPT_TTYPE 24 /* terminal type */
1.124 +#define TELOPT_EOR 25 /* end or record */
1.125 +#define TELOPT_TUID 26 /* TACACS user identification */
1.126 +#define TELOPT_OUTMRK 27 /* output marking */
1.127 +#define TELOPT_TTYLOC 28 /* terminal location number */
1.128 +#define TELOPT_3270REGIME 29 /* 3270 regime */
1.129 +#define TELOPT_X3PAD 30 /* X.3 PAD */
1.130 +#define TELOPT_NAWS 31 /* window size */
1.131 +#define TELOPT_TSPEED 32 /* terminal speed */
1.132 +#define TELOPT_LFLOW 33 /* remote flow control */
1.133 +#define TELOPT_LINEMODE 34 /* Linemode option */
1.134 +#define TELOPT_XDISPLOC 35 /* X Display Location */
1.135 +#define TELOPT_OLD_ENVIRON 36 /* Old - Environment variables */
1.136 +#define TELOPT_AUTHENTICATION 37/* Authenticate */
1.137 +#define TELOPT_ENCRYPT 38 /* Encryption option */
1.138 +#define TELOPT_NEW_ENVIRON 39 /* New - Environment variables */
1.139 +#define TELOPT_EXOPL 255 /* extended-options-list */
1.140 +
1.141 +#define NTELOPTS (1+TELOPT_NEW_ENVIRON)
1.142 +#ifdef TELOPTS
1.143 +char *telopts[NTELOPTS+1] = {
1.144 + "BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME",
1.145 + "STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP",
1.146 + "NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS",
1.147 + "NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO",
1.148 + "DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT",
1.149 + "SEND LOCATION", "TERMINAL TYPE", "END OF RECORD",
1.150 + "TACACS UID", "OUTPUT MARKING", "TTYLOC",
1.151 + "3270 REGIME", "X.3 PAD", "NAWS", "TSPEED", "LFLOW",
1.152 + "LINEMODE", "XDISPLOC", "OLD-ENVIRON", "AUTHENTICATION",
1.153 + "ENCRYPT", "NEW-ENVIRON",
1.154 + 0
1.155 +};
1.156 +
1.157 +#define TELOPT_FIRST TELOPT_BINARY
1.158 +#define TELOPT_LAST TELOPT_NEW_ENVIRON
1.159 +#define TELOPT_OK(x) ((unsigned int)(x) <= TELOPT_LAST)
1.160 +#define TELOPT(x) telopts[(x)-TELOPT_FIRST]
1.161 +#endif
1.162 +
1.163 +/**
1.164 +sub-option qualifiers
1.165 +*/
1.166 +#define TELQUAL_IS 0 /* option is... */
1.167 +#define TELQUAL_SEND 1 /* send option */
1.168 +#define TELQUAL_INFO 2 /* ENVIRON: informational version of IS */
1.169 +#define TELQUAL_REPLY 2 /* AUTHENTICATION: client version of IS */
1.170 +#define TELQUAL_NAME 3 /* AUTHENTICATION: client version of IS */
1.171 +
1.172 +#define LFLOW_OFF 0 /* Disable remote flow control */
1.173 +#define LFLOW_ON 1 /* Enable remote flow control */
1.174 +#define LFLOW_RESTART_ANY 2 /* Restart output on any char */
1.175 +#define LFLOW_RESTART_XON 3 /* Restart output only on XON */
1.176 +
1.177 +/**
1.178 +LINEMODE suboptions
1.179 +*/
1.180 +#define LM_MODE 1
1.181 +#define LM_FORWARDMASK 2
1.182 +#define LM_SLC 3
1.183 +
1.184 +#define MODE_EDIT 0x01
1.185 +#define MODE_TRAPSIG 0x02
1.186 +#define MODE_ACK 0x04
1.187 +#define MODE_SOFT_TAB 0x08
1.188 +#define MODE_LIT_ECHO 0x10
1.189 +
1.190 +#define MODE_MASK 0x1f
1.191 +
1.192 +/**
1.193 +Not part of protocol, but needed to simplify things...
1.194 +*/
1.195 +#define MODE_FLOW 0x0100
1.196 +#define MODE_ECHO 0x0200
1.197 +#define MODE_INBIN 0x0400
1.198 +#define MODE_OUTBIN 0x0800
1.199 +#define MODE_FORCE 0x1000
1.200 +
1.201 +#define SLC_SYNCH 1
1.202 +#define SLC_BRK 2
1.203 +#define SLC_IP 3
1.204 +#define SLC_AO 4
1.205 +#define SLC_AYT 5
1.206 +#define SLC_EOR 6
1.207 +#define SLC_ABORT 7
1.208 +#define SLC_EOF 8
1.209 +#define SLC_SUSP 9
1.210 +#define SLC_EC 10
1.211 +#define SLC_EL 11
1.212 +#define SLC_EW 12
1.213 +#define SLC_RP 13
1.214 +#define SLC_LNEXT 14
1.215 +#define SLC_XON 15
1.216 +#define SLC_XOFF 16
1.217 +#define SLC_FORW1 17
1.218 +#define SLC_FORW2 18
1.219 +#define SLC_MCL 19
1.220 +#define SLC_MCR 20
1.221 +#define SLC_MCWL 21
1.222 +#define SLC_MCWR 22
1.223 +#define SLC_MCBOL 23
1.224 +#define SLC_MCEOL 24
1.225 +#define SLC_INSRT 25
1.226 +#define SLC_OVER 26
1.227 +#define SLC_ECR 27
1.228 +#define SLC_EWR 28
1.229 +#define SLC_EBOL 29
1.230 +#define SLC_EEOL 30
1.231 +
1.232 +#define NSLC 30
1.233 +
1.234 +/**
1.235 +For backwards compatability, we define SLC_NAMES to be the
1.236 +list of names if SLC_NAMES is not defined.
1.237 +*/
1.238 +#define SLC_NAMELIST "0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \
1.239 + "ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \
1.240 + "LNEXT", "XON", "XOFF", "FORW1", "FORW2", \
1.241 + "MCL", "MCR", "MCWL", "MCWR", "MCBOL", \
1.242 + "MCEOL", "INSRT", "OVER", "ECR", "EWR", \
1.243 + "EBOL", "EEOL", \
1.244 + 0
1.245 +
1.246 +#ifdef SLC_NAMES
1.247 +char *slc_names[] = {
1.248 + SLC_NAMELIST
1.249 +};
1.250 +#else
1.251 +extern char *slc_names[];
1.252 +#define SLC_NAMES SLC_NAMELIST
1.253 +#endif
1.254 +
1.255 +#define SLC_NAME_OK(x) ((unsigned int)(x) <= NSLC)
1.256 +#define SLC_NAME(x) slc_names[x]
1.257 +
1.258 +#define SLC_NOSUPPORT 0
1.259 +#define SLC_CANTCHANGE 1
1.260 +#define SLC_VARIABLE 2
1.261 +#define SLC_DEFAULT 3
1.262 +#define SLC_LEVELBITS 0x03
1.263 +
1.264 +#define SLC_FUNC 0
1.265 +#define SLC_FLAGS 1
1.266 +#define SLC_VALUE 2
1.267 +
1.268 +#define SLC_ACK 0x80
1.269 +#define SLC_FLUSHIN 0x40
1.270 +#define SLC_FLUSHOUT 0x20
1.271 +
1.272 +#define OLD_ENV_VAR 1
1.273 +#define OLD_ENV_VALUE 0
1.274 +#define NEW_ENV_VAR 0
1.275 +#define NEW_ENV_VALUE 1
1.276 +#define ENV_ESC 2
1.277 +#define ENV_USERVAR 3
1.278 +
1.279 +/*
1.280 + * AUTHENTICATION suboptions
1.281 + */
1.282 +
1.283 +/**
1.284 +Who is authenticating who ...
1.285 +*/
1.286 +#define AUTH_WHO_CLIENT 0 /* Client authenticating server */
1.287 +#define AUTH_WHO_SERVER 1 /* Server authenticating client */
1.288 +#define AUTH_WHO_MASK 1
1.289 +
1.290 +/**
1.291 +amount of authentication done
1.292 +*/
1.293 +#define AUTH_HOW_ONE_WAY 0
1.294 +#define AUTH_HOW_MUTUAL 2
1.295 +#define AUTH_HOW_MASK 2
1.296 +
1.297 +#define AUTHTYPE_NULL 0
1.298 +#define AUTHTYPE_KERBEROS_V4 1
1.299 +#define AUTHTYPE_KERBEROS_V5 2
1.300 +#define AUTHTYPE_SPX 3
1.301 +#define AUTHTYPE_MINK 4
1.302 +#define AUTHTYPE_CNT 5
1.303 +
1.304 +#define AUTHTYPE_TEST 99
1.305 +
1.306 +#ifdef AUTH_NAMES
1.307 +char *authtype_names[] = {
1.308 + "NULL", "KERBEROS_V4", "KERBEROS_V5", "SPX", "MINK",
1.309 + 0
1.310 +};
1.311 +#else
1.312 +extern char *authtype_names[];
1.313 +#endif
1.314 +
1.315 +#define AUTHTYPE_NAME_OK(x) ((unsigned int)(x) < AUTHTYPE_CNT)
1.316 +#define AUTHTYPE_NAME(x) authtype_names[x]
1.317 +
1.318 +/**
1.319 +ENCRYPTion suboptions
1.320 +*/
1.321 +#define ENCRYPT_IS 0 /* I pick encryption type ... */
1.322 +#define ENCRYPT_SUPPORT 1 /* I support encryption types ... */
1.323 +#define ENCRYPT_REPLY 2 /* Initial setup response */
1.324 +#define ENCRYPT_START 3 /* Am starting to send encrypted */
1.325 +#define ENCRYPT_END 4 /* Am ending encrypted */
1.326 +#define ENCRYPT_REQSTART 5 /* Request you start encrypting */
1.327 +#define ENCRYPT_REQEND 6 /* Request you end encrypting */
1.328 +#define ENCRYPT_ENC_KEYID 7
1.329 +#define ENCRYPT_DEC_KEYID 8
1.330 +#define ENCRYPT_CNT 9
1.331 +#define ENCTYPE_ANY 0
1.332 +#define ENCTYPE_DES_CFB64 1
1.333 +#define ENCTYPE_DES_OFB64 2
1.334 +#define ENCTYPE_CNT 3
1.335 +
1.336 +#ifdef ENCRYPT_NAMES
1.337 +char *encrypt_names[] = {
1.338 + "IS", "SUPPORT", "REPLY", "START", "END",
1.339 + "REQUEST-START", "REQUEST-END", "ENC-KEYID", "DEC-KEYID",
1.340 + 0
1.341 +};
1.342 +char *enctype_names[] = {
1.343 + "ANY", "DES_CFB64", "DES_OFB64",
1.344 + 0
1.345 +};
1.346 +#else
1.347 +extern char *encrypt_names[];
1.348 +extern char *enctype_names[];
1.349 +#endif
1.350 +
1.351 +#define ENCRYPT_NAME_OK(x) ((unsigned int)(x) < ENCRYPT_CNT)
1.352 +#define ENCRYPT_NAME(x) encrypt_names[x]
1.353 +
1.354 +#define ENCTYPE_NAME_OK(x) ((unsigned int)(x) < ENCTYPE_CNT)
1.355 +#define ENCTYPE_NAME(x) enctype_names[x]
1.356 +
1.357 +#endif /* !_TELNET_H_ */