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