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