epoc32/include/libc/arpa/telnet.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:27:01 +0100
branchSymbian2
changeset 3 e1b950c65cb4
parent 0 061f57f2323e
child 4 837f303aceeb
permissions -rw-r--r--
Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
     1 /* TELNET.H
     2  * 
     3  * Portions copyright (c) 1993-1999 Symbian Ltd.  All rights reserved.
     4  */
     5 
     6 /** @file
     7 @publishedAll
     8 @released
     9 */
    10 
    11 /*
    12  * Copyright (c) 1983, 1993
    13  *	The Regents of the University of California.  All rights reserved.
    14  *
    15  * Redistribution and use in source and binary forms, with or without
    16  * modification, are permitted provided that the following conditions
    17  * are met:
    18  * 1. Redistributions of source code must retain the above copyright
    19  *    notice, this list of conditions and the following disclaimer.
    20  * 2. Redistributions in binary form must reproduce the above copyright
    21  *    notice, this list of conditions and the following disclaimer in the
    22  *    documentation and/or other materials provided with the distribution.
    23  * 3. All advertising materials mentioning features or use of this software
    24  *    must display the following acknowledgement:
    25  *	This product includes software developed by the University of
    26  *	California, Berkeley and its contributors.
    27  * 4. Neither the name of the University nor the names of its contributors
    28  *    may be used to endorse or promote products derived from this software
    29  *    without specific prior written permission.
    30  *
    31  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
    32  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    33  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    34  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
    35  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    36  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    37  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    38  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    39  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    40  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    41  * SUCH DAMAGE.
    42  *
    43  *	@(#)telnet.h	8.2 (Berkeley) 12/15/93
    44  */
    45 
    46 #ifndef _ARPA_TELNET_H_
    47 #define	_ARPA_TELNET_H_
    48 
    49 /**
    50 Definitions for the TELNET protocol.
    51 */
    52 #define	IAC	255		/* interpret as command: */
    53 #define	DONT	254		/* you are not to use option */
    54 #define	DO	253		/* please, you use option */
    55 #define	WONT	252		/* I won't use option */
    56 #define	WILL	251		/* I will use option */
    57 #define	SB	250		/* interpret as subnegotiation */
    58 #define	GA	249		/* you may reverse the line */
    59 #define	EL	248		/* erase the current line */
    60 #define	EC	247		/* erase the current character */
    61 #define	AYT	246		/* are you there */
    62 #define	AO	245		/* abort output--but let prog finish */
    63 #define	IP	244		/* interrupt process--permanently */
    64 #define	BREAK	243		/* break */
    65 #define	DM	242		/* data mark--for connect. cleaning */
    66 #define	NOP	241		/* nop */
    67 #define	SE	240		/* end sub negotiation */
    68 #define EOR     239             /* end of record (transparent mode) */
    69 #define	ABORT	238		/* Abort process */
    70 #define	SUSP	237		/* Suspend process */
    71 #define	xEOF	236		/* End of file: EOF is already used... */
    72 
    73 #define SYNCH	242		/* for telfunc calls */
    74 
    75 #ifdef TELCMDS
    76 char *telcmds[] = {
    77 	"EOF", "SUSP", "ABORT", "EOR",
    78 	"SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC",
    79 	"EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC",
    80 	0
    81 };
    82 #else
    83 extern char *telcmds[];
    84 #endif
    85 
    86 #define	TELCMD_FIRST	xEOF
    87 #define	TELCMD_LAST	IAC
    88 #define	TELCMD_OK(x)	((unsigned int)(x) <= TELCMD_LAST && \
    89 			 (unsigned int)(x) >= TELCMD_FIRST)
    90 #define	TELCMD(x)	telcmds[(x)-TELCMD_FIRST]
    91 
    92 /**
    93 telnet options 
    94 */
    95 #define TELOPT_BINARY	0	/* 8-bit data path */
    96 #define TELOPT_ECHO	1	/* echo */
    97 #define	TELOPT_RCP	2	/* prepare to reconnect */
    98 #define	TELOPT_SGA	3	/* suppress go ahead */
    99 #define	TELOPT_NAMS	4	/* approximate message size */
   100 #define	TELOPT_STATUS	5	/* give status */
   101 #define	TELOPT_TM	6	/* timing mark */
   102 #define	TELOPT_RCTE	7	/* remote controlled transmission and echo */
   103 #define TELOPT_NAOL 	8	/* negotiate about output line width */
   104 #define TELOPT_NAOP 	9	/* negotiate about output page size */
   105 #define TELOPT_NAOCRD	10	/* negotiate about CR disposition */
   106 #define TELOPT_NAOHTS	11	/* negotiate about horizontal tabstops */
   107 #define TELOPT_NAOHTD	12	/* negotiate about horizontal tab disposition */
   108 #define TELOPT_NAOFFD	13	/* negotiate about formfeed disposition */
   109 #define TELOPT_NAOVTS	14	/* negotiate about vertical tab stops */
   110 #define TELOPT_NAOVTD	15	/* negotiate about vertical tab disposition */
   111 #define TELOPT_NAOLFD	16	/* negotiate about output LF disposition */
   112 #define TELOPT_XASCII	17	/* extended ascic character set */
   113 #define	TELOPT_LOGOUT	18	/* force logout */
   114 #define	TELOPT_BM	19	/* byte macro */
   115 #define	TELOPT_DET	20	/* data entry terminal */
   116 #define	TELOPT_SUPDUP	21	/* supdup protocol */
   117 #define	TELOPT_SUPDUPOUTPUT 22	/* supdup output */
   118 #define	TELOPT_SNDLOC	23	/* send location */
   119 #define	TELOPT_TTYPE	24	/* terminal type */
   120 #define	TELOPT_EOR	25	/* end or record */
   121 #define	TELOPT_TUID	26	/* TACACS user identification */
   122 #define	TELOPT_OUTMRK	27	/* output marking */
   123 #define	TELOPT_TTYLOC	28	/* terminal location number */
   124 #define	TELOPT_3270REGIME 29	/* 3270 regime */
   125 #define	TELOPT_X3PAD	30	/* X.3 PAD */
   126 #define	TELOPT_NAWS	31	/* window size */
   127 #define	TELOPT_TSPEED	32	/* terminal speed */
   128 #define	TELOPT_LFLOW	33	/* remote flow control */
   129 #define TELOPT_LINEMODE	34	/* Linemode option */
   130 #define TELOPT_XDISPLOC	35	/* X Display Location */
   131 #define TELOPT_OLD_ENVIRON 36	/* Old - Environment variables */
   132 #define	TELOPT_AUTHENTICATION 37/* Authenticate */
   133 #define	TELOPT_ENCRYPT	38	/* Encryption option */
   134 #define TELOPT_NEW_ENVIRON 39	/* New - Environment variables */
   135 #define	TELOPT_EXOPL	255	/* extended-options-list */
   136 
   137 #define	NTELOPTS	(1+TELOPT_NEW_ENVIRON)
   138 #ifdef TELOPTS
   139 char *telopts[NTELOPTS+1] = {
   140 	"BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME",
   141 	"STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP",
   142 	"NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS",
   143 	"NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO",
   144 	"DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT",
   145 	"SEND LOCATION", "TERMINAL TYPE", "END OF RECORD",
   146 	"TACACS UID", "OUTPUT MARKING", "TTYLOC",
   147 	"3270 REGIME", "X.3 PAD", "NAWS", "TSPEED", "LFLOW",
   148 	"LINEMODE", "XDISPLOC", "OLD-ENVIRON", "AUTHENTICATION",
   149 	"ENCRYPT", "NEW-ENVIRON",
   150 	0
   151 };
   152 
   153 #define	TELOPT_FIRST	TELOPT_BINARY
   154 #define	TELOPT_LAST	TELOPT_NEW_ENVIRON
   155 #define	TELOPT_OK(x)	((unsigned int)(x) <= TELOPT_LAST)
   156 #define	TELOPT(x)	telopts[(x)-TELOPT_FIRST]
   157 #endif
   158 
   159 /** 
   160 sub-option qualifiers 
   161 */
   162 #define	TELQUAL_IS	0	/* option is... */
   163 #define	TELQUAL_SEND	1	/* send option */
   164 #define	TELQUAL_INFO	2	/* ENVIRON: informational version of IS */
   165 #define	TELQUAL_REPLY	2	/* AUTHENTICATION: client version of IS */
   166 #define	TELQUAL_NAME	3	/* AUTHENTICATION: client version of IS */
   167 
   168 #define	LFLOW_OFF		0	/* Disable remote flow control */
   169 #define	LFLOW_ON		1	/* Enable remote flow control */
   170 #define	LFLOW_RESTART_ANY	2	/* Restart output on any char */
   171 #define	LFLOW_RESTART_XON	3	/* Restart output only on XON */
   172 
   173 /**
   174 LINEMODE suboptions
   175 */
   176 #define	LM_MODE		1
   177 #define	LM_FORWARDMASK	2
   178 #define	LM_SLC		3
   179 
   180 #define	MODE_EDIT	0x01
   181 #define	MODE_TRAPSIG	0x02
   182 #define	MODE_ACK	0x04
   183 #define MODE_SOFT_TAB	0x08
   184 #define MODE_LIT_ECHO	0x10
   185 
   186 #define	MODE_MASK	0x1f
   187 
   188 /** 
   189 Not part of protocol, but needed to simplify things... 
   190 */
   191 #define MODE_FLOW		0x0100
   192 #define MODE_ECHO		0x0200
   193 #define MODE_INBIN		0x0400
   194 #define MODE_OUTBIN		0x0800
   195 #define MODE_FORCE		0x1000
   196 
   197 #define	SLC_SYNCH	1
   198 #define	SLC_BRK		2
   199 #define	SLC_IP		3
   200 #define	SLC_AO		4
   201 #define	SLC_AYT		5
   202 #define	SLC_EOR		6
   203 #define	SLC_ABORT	7
   204 #define	SLC_EOF		8
   205 #define	SLC_SUSP	9
   206 #define	SLC_EC		10
   207 #define	SLC_EL		11
   208 #define	SLC_EW		12
   209 #define	SLC_RP		13
   210 #define	SLC_LNEXT	14
   211 #define	SLC_XON		15
   212 #define	SLC_XOFF	16
   213 #define	SLC_FORW1	17
   214 #define	SLC_FORW2	18
   215 #define SLC_MCL         19
   216 #define SLC_MCR         20
   217 #define SLC_MCWL        21
   218 #define SLC_MCWR        22
   219 #define SLC_MCBOL       23
   220 #define SLC_MCEOL       24
   221 #define SLC_INSRT       25
   222 #define SLC_OVER        26
   223 #define SLC_ECR         27
   224 #define SLC_EWR         28
   225 #define SLC_EBOL        29
   226 #define SLC_EEOL        30
   227 
   228 #define	NSLC		30
   229 
   230 /**
   231 For backwards compatability, we define SLC_NAMES to be the
   232 list of names if SLC_NAMES is not defined.
   233 */
   234 #define	SLC_NAMELIST	"0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR",	\
   235 			"ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP",	\
   236 			"LNEXT", "XON", "XOFF", "FORW1", "FORW2",	\
   237 			"MCL", "MCR", "MCWL", "MCWR", "MCBOL",		\
   238 			"MCEOL", "INSRT", "OVER", "ECR", "EWR",		\
   239 			"EBOL", "EEOL",					\
   240 			0
   241 
   242 #ifdef	SLC_NAMES
   243 char *slc_names[] = {
   244 	SLC_NAMELIST
   245 };
   246 #else
   247 extern char *slc_names[];
   248 #define	SLC_NAMES SLC_NAMELIST
   249 #endif
   250 
   251 #define	SLC_NAME_OK(x)	((unsigned int)(x) <= NSLC)
   252 #define SLC_NAME(x)	slc_names[x]
   253 
   254 #define	SLC_NOSUPPORT	0
   255 #define	SLC_CANTCHANGE	1
   256 #define	SLC_VARIABLE	2
   257 #define	SLC_DEFAULT	3
   258 #define	SLC_LEVELBITS	0x03
   259 
   260 #define	SLC_FUNC	0
   261 #define	SLC_FLAGS	1
   262 #define	SLC_VALUE	2
   263 
   264 #define	SLC_ACK		0x80
   265 #define	SLC_FLUSHIN	0x40
   266 #define	SLC_FLUSHOUT	0x20
   267 
   268 #define	OLD_ENV_VAR	1
   269 #define	OLD_ENV_VALUE	0
   270 #define	NEW_ENV_VAR	0
   271 #define	NEW_ENV_VALUE	1
   272 #define	ENV_ESC		2
   273 #define ENV_USERVAR	3
   274 
   275 /*
   276  * AUTHENTICATION suboptions
   277  */
   278 
   279 /**
   280 Who is authenticating who ...
   281 */
   282 #define	AUTH_WHO_CLIENT		0	/* Client authenticating server */
   283 #define	AUTH_WHO_SERVER		1	/* Server authenticating client */
   284 #define	AUTH_WHO_MASK		1
   285 
   286 /**
   287 amount of authentication done
   288 */
   289 #define	AUTH_HOW_ONE_WAY	0
   290 #define	AUTH_HOW_MUTUAL		2
   291 #define	AUTH_HOW_MASK		2
   292 
   293 #define	AUTHTYPE_NULL		0
   294 #define	AUTHTYPE_KERBEROS_V4	1
   295 #define	AUTHTYPE_KERBEROS_V5	2
   296 #define	AUTHTYPE_SPX		3
   297 #define	AUTHTYPE_MINK		4
   298 #define	AUTHTYPE_CNT		5
   299 
   300 #define	AUTHTYPE_TEST		99
   301 
   302 #ifdef	AUTH_NAMES
   303 char *authtype_names[] = {
   304 	"NULL", "KERBEROS_V4", "KERBEROS_V5", "SPX", "MINK",
   305 	0
   306 };
   307 #else
   308 extern char *authtype_names[];
   309 #endif
   310 
   311 #define	AUTHTYPE_NAME_OK(x)	((unsigned int)(x) < AUTHTYPE_CNT)
   312 #define	AUTHTYPE_NAME(x)	authtype_names[x]
   313 
   314 /**
   315 ENCRYPTion suboptions
   316 */
   317 #define	ENCRYPT_IS		0	/* I pick encryption type ... */
   318 #define	ENCRYPT_SUPPORT		1	/* I support encryption types ... */
   319 #define	ENCRYPT_REPLY		2	/* Initial setup response */
   320 #define	ENCRYPT_START		3	/* Am starting to send encrypted */
   321 #define	ENCRYPT_END		4	/* Am ending encrypted */
   322 #define	ENCRYPT_REQSTART	5	/* Request you start encrypting */
   323 #define	ENCRYPT_REQEND		6	/* Request you end encrypting */
   324 #define	ENCRYPT_ENC_KEYID	7
   325 #define	ENCRYPT_DEC_KEYID	8
   326 #define	ENCRYPT_CNT		9
   327 #define	ENCTYPE_ANY		0
   328 #define	ENCTYPE_DES_CFB64	1
   329 #define	ENCTYPE_DES_OFB64	2
   330 #define	ENCTYPE_CNT		3
   331 
   332 #ifdef	ENCRYPT_NAMES
   333 char *encrypt_names[] = {
   334 	"IS", "SUPPORT", "REPLY", "START", "END",
   335 	"REQUEST-START", "REQUEST-END", "ENC-KEYID", "DEC-KEYID",
   336 	0
   337 };
   338 char *enctype_names[] = {
   339 	"ANY", "DES_CFB64",  "DES_OFB64",
   340 	0
   341 };
   342 #else
   343 extern char *encrypt_names[];
   344 extern char *enctype_names[];
   345 #endif
   346 
   347 #define	ENCRYPT_NAME_OK(x)	((unsigned int)(x) < ENCRYPT_CNT)
   348 #define	ENCRYPT_NAME(x)		encrypt_names[x]
   349 
   350 #define	ENCTYPE_NAME_OK(x)	((unsigned int)(x) < ENCTYPE_CNT)
   351 #define	ENCTYPE_NAME(x)		enctype_names[x]
   352 
   353 #endif /* !_TELNET_H_ */