master
  1#ifndef _ARPA_TELNET_H
  2#define	_ARPA_TELNET_H
  3
  4#define	IAC	255
  5#define	DONT	254
  6#define	DO	253
  7#define	WONT	252
  8#define	WILL	251
  9#define	SB	250
 10#define	GA	249
 11#define	EL	248
 12#define	EC	247
 13#define	AYT	246
 14#define	AO	245
 15#define	IP	244
 16#define	BREAK	243
 17#define	DM	242
 18#define	NOP	241
 19#define	SE	240
 20#define EOR     239
 21#define	ABORT	238
 22#define	SUSP	237
 23#define	xEOF	236
 24
 25#define SYNCH	242
 26
 27#define telcmds ((char [][6]){ "EOF", "SUSP", "ABORT", "EOR", "SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC", "EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC", 0 })
 28
 29#define	TELCMD_FIRST	xEOF
 30#define	TELCMD_LAST	IAC
 31#define	TELCMD_OK(x)	((unsigned int)(x) <= TELCMD_LAST && \
 32			 (unsigned int)(x) >= TELCMD_FIRST)
 33#define	TELCMD(x)	telcmds[(x)-TELCMD_FIRST]
 34
 35#define TELOPT_BINARY	0
 36#define TELOPT_ECHO	1
 37#define	TELOPT_RCP	2
 38#define	TELOPT_SGA	3
 39#define	TELOPT_NAMS	4
 40#define	TELOPT_STATUS	5
 41#define	TELOPT_TM	6
 42#define	TELOPT_RCTE	7
 43#define TELOPT_NAOL 	8
 44#define TELOPT_NAOP 	9
 45#define TELOPT_NAOCRD	10
 46#define TELOPT_NAOHTS	11
 47#define TELOPT_NAOHTD	12
 48#define TELOPT_NAOFFD	13
 49#define TELOPT_NAOVTS	14
 50#define TELOPT_NAOVTD	15
 51#define TELOPT_NAOLFD	16
 52#define TELOPT_XASCII	17
 53#define	TELOPT_LOGOUT	18
 54#define	TELOPT_BM	19
 55#define	TELOPT_DET	20
 56#define	TELOPT_SUPDUP	21
 57#define	TELOPT_SUPDUPOUTPUT 22
 58#define	TELOPT_SNDLOC	23
 59#define	TELOPT_TTYPE	24
 60#define	TELOPT_EOR	25
 61#define	TELOPT_TUID	26
 62#define	TELOPT_OUTMRK	27
 63#define	TELOPT_TTYLOC	28
 64#define	TELOPT_3270REGIME 29
 65#define	TELOPT_X3PAD	30
 66#define	TELOPT_NAWS	31
 67#define	TELOPT_TSPEED	32
 68#define	TELOPT_LFLOW	33
 69#define TELOPT_LINEMODE	34
 70#define TELOPT_XDISPLOC	35
 71#define TELOPT_OLD_ENVIRON 36
 72#define	TELOPT_AUTHENTICATION 37/* Authenticate */
 73#define	TELOPT_ENCRYPT	38
 74#define TELOPT_NEW_ENVIRON 39
 75#define	TELOPT_EXOPL	255
 76
 77
 78#define	NTELOPTS	(1+TELOPT_NEW_ENVIRON)
 79#ifdef TELOPTS
 80char *telopts[NTELOPTS+1] = {
 81	"BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME",
 82	"STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP",
 83	"NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS",
 84	"NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO",
 85	"DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT",
 86	"SEND LOCATION", "TERMINAL TYPE", "END OF RECORD",
 87	"TACACS UID", "OUTPUT MARKING", "TTYLOC",
 88	"3270 REGIME", "X.3 PAD", "NAWS", "TSPEED", "LFLOW",
 89	"LINEMODE", "XDISPLOC", "OLD-ENVIRON", "AUTHENTICATION",
 90	"ENCRYPT", "NEW-ENVIRON",
 91	0,
 92};
 93#define	TELOPT_FIRST	TELOPT_BINARY
 94#define	TELOPT_LAST	TELOPT_NEW_ENVIRON
 95#define	TELOPT_OK(x)	((unsigned int)(x) <= TELOPT_LAST)
 96#define	TELOPT(x)	telopts[(x)-TELOPT_FIRST]
 97#endif
 98
 99#define	TELQUAL_IS	0
100#define	TELQUAL_SEND	1
101#define	TELQUAL_INFO	2
102#define	TELQUAL_REPLY	2
103#define	TELQUAL_NAME	3
104
105#define	LFLOW_OFF		0
106#define	LFLOW_ON		1
107#define	LFLOW_RESTART_ANY	2
108#define	LFLOW_RESTART_XON	3
109
110
111#define	LM_MODE		1
112#define	LM_FORWARDMASK	2
113#define	LM_SLC		3
114
115#define	MODE_EDIT	0x01
116#define	MODE_TRAPSIG	0x02
117#define	MODE_ACK	0x04
118#define MODE_SOFT_TAB	0x08
119#define MODE_LIT_ECHO	0x10
120
121#define	MODE_MASK	0x1f
122
123#define MODE_FLOW		0x0100
124#define MODE_ECHO		0x0200
125#define MODE_INBIN		0x0400
126#define MODE_OUTBIN		0x0800
127#define MODE_FORCE		0x1000
128
129#define	SLC_SYNCH	1
130#define	SLC_BRK		2
131#define	SLC_IP		3
132#define	SLC_AO		4
133#define	SLC_AYT		5
134#define	SLC_EOR		6
135#define	SLC_ABORT	7
136#define	SLC_EOF		8
137#define	SLC_SUSP	9
138#define	SLC_EC		10
139#define	SLC_EL		11
140#define	SLC_EW		12
141#define	SLC_RP		13
142#define	SLC_LNEXT	14
143#define	SLC_XON		15
144#define	SLC_XOFF	16
145#define	SLC_FORW1	17
146#define	SLC_FORW2	18
147
148#define	NSLC		18
149
150#define	SLC_NAMELIST	"0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \
151			"ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \
152			"LNEXT", "XON", "XOFF", "FORW1", "FORW2", 0,
153#ifdef	SLC_NAMES
154char *slc_names[] = {
155	SLC_NAMELIST
156};
157#else
158extern char *slc_names[];
159#define	SLC_NAMES SLC_NAMELIST
160#endif
161
162#define	SLC_NAME_OK(x)	((unsigned int)(x) <= NSLC)
163#define SLC_NAME(x)	slc_names[x]
164
165#define	SLC_NOSUPPORT	0
166#define	SLC_CANTCHANGE	1
167#define	SLC_VARIABLE	2
168#define	SLC_DEFAULT	3
169#define	SLC_LEVELBITS	0x03
170
171#define	SLC_FUNC	0
172#define	SLC_FLAGS	1
173#define	SLC_VALUE	2
174
175#define	SLC_ACK		0x80
176#define	SLC_FLUSHIN	0x40
177#define	SLC_FLUSHOUT	0x20
178
179#define	OLD_ENV_VAR	1
180#define	OLD_ENV_VALUE	0
181#define	NEW_ENV_VAR	0
182#define	NEW_ENV_VALUE	1
183#define	ENV_ESC		2
184#define ENV_USERVAR	3
185
186#define	AUTH_WHO_CLIENT		0
187#define	AUTH_WHO_SERVER		1
188#define	AUTH_WHO_MASK		1
189
190#define	AUTH_HOW_ONE_WAY	0
191#define	AUTH_HOW_MUTUAL		2
192#define	AUTH_HOW_MASK		2
193
194#define	AUTHTYPE_NULL		0
195#define	AUTHTYPE_KERBEROS_V4	1
196#define	AUTHTYPE_KERBEROS_V5	2
197#define	AUTHTYPE_SPX		3
198#define	AUTHTYPE_MINK		4
199#define	AUTHTYPE_CNT		5
200
201#define	AUTHTYPE_TEST		99
202
203#ifdef	AUTH_NAMES
204char *authtype_names[] = {
205	"NULL", "KERBEROS_V4", "KERBEROS_V5", "SPX", "MINK", 0,
206};
207#else
208extern char *authtype_names[];
209#endif
210
211#define	AUTHTYPE_NAME_OK(x)	((unsigned int)(x) < AUTHTYPE_CNT)
212#define	AUTHTYPE_NAME(x)	authtype_names[x]
213
214#define	ENCRYPT_IS		0
215#define	ENCRYPT_SUPPORT		1
216#define	ENCRYPT_REPLY		2
217#define	ENCRYPT_START		3
218#define	ENCRYPT_END		4
219#define	ENCRYPT_REQSTART	5
220#define	ENCRYPT_REQEND		6
221#define	ENCRYPT_ENC_KEYID	7
222#define	ENCRYPT_DEC_KEYID	8
223#define	ENCRYPT_CNT		9
224
225#define	ENCTYPE_ANY		0
226#define	ENCTYPE_DES_CFB64	1
227#define	ENCTYPE_DES_OFB64	2
228#define	ENCTYPE_CNT		3
229
230#ifdef	ENCRYPT_NAMES
231char *encrypt_names[] = {
232	"IS", "SUPPORT", "REPLY", "START", "END",
233	"REQUEST-START", "REQUEST-END", "ENC-KEYID", "DEC-KEYID",
234	0,
235};
236char *enctype_names[] = {
237	"ANY", "DES_CFB64",  "DES_OFB64",  0,
238};
239#else
240extern char *encrypt_names[];
241extern char *enctype_names[];
242#endif
243
244
245#define	ENCRYPT_NAME_OK(x)	((unsigned int)(x) < ENCRYPT_CNT)
246#define	ENCRYPT_NAME(x)		encrypt_names[x]
247
248#define	ENCTYPE_NAME_OK(x)	((unsigned int)(x) < ENCTYPE_CNT)
249#define	ENCTYPE_NAME(x)		enctype_names[x]
250
251#endif