Subversion Repositories Kolibri OS

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
4680 right-hear 1
/*
2
 * Copyright (c) 1988, 1990, 1993
3
 *	The Regents of the University of California.  All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 * 4. Neither the name of the University nor the names of its contributors
14
 *    may be used to endorse or promote products derived from this software
15
 *    without specific prior written permission.
16
 *
17
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27
 * SUCH DAMAGE.
28
 *
29
 *	@(#)externs.h	8.3 (Berkeley) 5/30/95
30
 */
31
 
32
#ifndef	BSD
33
# define BSD 43
34
#endif
35
 
36
#ifdef HAVE_TERMIOS_H
37
#define USE_TERMIO
38
#else /* !HAVE_TERMIOS_H */
39
#ifdef HAVE_TERMIO_H
40
#define USE_TERMIO
41
#define SYSV_TERMIO
42
#endif
43
#endif /* HAVE_TERMIOS_H */
44
 
45
/*
46
 * ucb stdio.h defines BSD as something wierd
47
 */
48
#if defined(sun) && defined(__svr4__)
49
#define BSD 43
50
#endif
51
 
52
#ifndef	USE_TERMIO
53
# if BSD > 43 || defined(SYSV_TERMIO)
54
#  define USE_TERMIO
55
# endif
56
#endif
57
 
58
#include 
59
#include 
60
#if defined(CRAY) && !defined(NO_BSD_SETJMP)
61
#include 
62
#endif
63
#include 
64
#ifdef HAVE_SYS_FILIO_H
65
#include 
66
#endif
67
#ifdef CRAY
68
# include 
69
#endif /* CRAY */
70
#ifdef	USE_TERMIO
71
# ifndef	VINTR
72
#  ifdef SYSV_TERMIO
73
#   include 
74
#  else
75
#   include 
76
#  endif
77
# endif
78
#endif
79
#if defined(NO_CC_T) || !defined(USE_TERMIO)
80
# if !defined(USE_TERMIO)
81
typedef char cc_t;
82
# else
83
typedef unsigned char cc_t;
84
# endif
85
#endif
86
 
87
#if defined (USE_TERMIO) && !defined (SYSV_TERMIO)
88
# define termio termios
89
#endif
90
 
91
#ifndef	NO_STRING_H
92
#include 
93
#else
94
#include 
95
#endif
96
 
97
#ifndef	_POSIX_VDISABLE
98
# ifdef sun
99
#  include 	/* pick up VDISABLE definition, maybe */
100
# endif
101
# ifdef VDISABLE
102
#  define _POSIX_VDISABLE VDISABLE
103
# else
104
#  define _POSIX_VDISABLE ((cc_t)'\377')
105
# endif
106
#endif
107
 
108
#define	SUBBUFSIZE	256
109
 
110
#ifndef CRAY
111
# ifndef errno
112
extern int errno;		/* outside this world */
113
# endif
114
#endif /* !CRAY */
115
 
116
#ifndef __P
117
# ifdef	__STDC__
118
#  define	__P(x)	x
119
# else
120
#  define	__P(x)	()
121
# endif
122
#endif
123
 
124
extern int
125
    autologin,		/* Autologin enabled */
126
    skiprc,		/* Don't process the ~/.telnetrc file */
127
    eight,		/* use eight bit mode (binary in and/or out */
128
    flushout,		/* flush output */
129
    connected,		/* Are we connected to the other side? */
130
    globalmode,		/* Mode tty should be in */
131
    In3270,			/* Are we in 3270 mode? */
132
    telnetport,		/* Are we connected to the telnet port? */
133
    localflow,		/* Flow control handled locally */
134
    restartany,		/* If flow control, restart output on any character */
135
    localchars,		/* we recognize interrupt/quit */
136
    donelclchars,		/* the user has set "localchars" */
137
    showoptions,
138
    net,		/* Network file descriptor */
139
    tin,		/* Terminal input file descriptor */
140
    tout,		/* Terminal output file descriptor */
141
    crlf,		/* Should '\r' be mapped to  (or )? */
142
    autoflush,		/* flush output when interrupting? */
143
    autosynch,		/* send interrupt characters with SYNCH? */
144
    SYNCHing,		/* Is the stream in telnet SYNCH mode? */
145
    donebinarytoggle,	/* the user has put us in binary */
146
    dontlecho,		/* do we suppress local echoing right now? */
147
    crmod,
148
    netdata,		/* Print out network data flow */
149
    prettydump,		/* Print "netdata" output in user readable format */
150
#if	defined(TN3270)
151
    cursesdata,		/* Print out curses data flow */
152
    apitrace,		/* Trace API transactions */
153
#endif	/* defined(TN3270) */
154
    termdata,		/* Print out terminal data flow */
155
    debug;		/* Debug level */
156
 
157
extern cc_t escape;	/* Escape to command mode */
158
extern cc_t rlogin;	/* Rlogin mode escape character */
159
#ifdef	KLUDGELINEMODE
160
extern cc_t echoc;	/* Toggle local echoing */
161
#endif
162
 
163
extern char
164
    *prompt;		/* Prompt for command. */
165
 
166
extern char
167
    doopt[],
168
    dont[],
169
    will[],
170
    wont[],
171
    options[],		/* All the little options */
172
    *hostname;		/* Who are we connected to? */
173
#ifdef	ENCRYPTION
174
extern void (*encrypt_output) P((unsigned char *, int));
175
extern int (*decrypt_input) P((int));
176
#endif	/* ENCRYPTION */
177
 
178
/*
179
 * We keep track of each side of the option negotiation.
180
 */
181
 
182
#define	MY_STATE_WILL		0x01
183
#define	MY_WANT_STATE_WILL	0x02
184
#define	MY_STATE_DO		0x04
185
#define	MY_WANT_STATE_DO	0x08
186
 
187
/*
188
 * Macros to check the current state of things
189
 */
190
 
191
#define	my_state_is_do(opt)		(options[opt]&MY_STATE_DO)
192
#define	my_state_is_will(opt)		(options[opt]&MY_STATE_WILL)
193
#define my_want_state_is_do(opt)	(options[opt]&MY_WANT_STATE_DO)
194
#define my_want_state_is_will(opt)	(options[opt]&MY_WANT_STATE_WILL)
195
 
196
#define	my_state_is_dont(opt)		(!my_state_is_do(opt))
197
#define	my_state_is_wont(opt)		(!my_state_is_will(opt))
198
#define my_want_state_is_dont(opt)	(!my_want_state_is_do(opt))
199
#define my_want_state_is_wont(opt)	(!my_want_state_is_will(opt))
200
 
201
#define	set_my_state_do(opt)		{options[opt] |= MY_STATE_DO;}
202
#define	set_my_state_will(opt)		{options[opt] |= MY_STATE_WILL;}
203
#define	set_my_want_state_do(opt)	{options[opt] |= MY_WANT_STATE_DO;}
204
#define	set_my_want_state_will(opt)	{options[opt] |= MY_WANT_STATE_WILL;}
205
 
206
#define	set_my_state_dont(opt)		{options[opt] &= ~MY_STATE_DO;}
207
#define	set_my_state_wont(opt)		{options[opt] &= ~MY_STATE_WILL;}
208
#define	set_my_want_state_dont(opt)	{options[opt] &= ~MY_WANT_STATE_DO;}
209
#define	set_my_want_state_wont(opt)	{options[opt] &= ~MY_WANT_STATE_WILL;}
210
 
211
/*
212
 * Make everything symetrical
213
 */
214
 
215
#define	HIS_STATE_WILL			MY_STATE_DO
216
#define	HIS_WANT_STATE_WILL		MY_WANT_STATE_DO
217
#define HIS_STATE_DO			MY_STATE_WILL
218
#define HIS_WANT_STATE_DO		MY_WANT_STATE_WILL
219
 
220
#define	his_state_is_do			my_state_is_will
221
#define	his_state_is_will		my_state_is_do
222
#define his_want_state_is_do		my_want_state_is_will
223
#define his_want_state_is_will		my_want_state_is_do
224
 
225
#define	his_state_is_dont		my_state_is_wont
226
#define	his_state_is_wont		my_state_is_dont
227
#define his_want_state_is_dont		my_want_state_is_wont
228
#define his_want_state_is_wont		my_want_state_is_dont
229
 
230
#define	set_his_state_do		set_my_state_will
231
#define	set_his_state_will		set_my_state_do
232
#define	set_his_want_state_do		set_my_want_state_will
233
#define	set_his_want_state_will		set_my_want_state_do
234
 
235
#define	set_his_state_dont		set_my_state_wont
236
#define	set_his_state_wont		set_my_state_dont
237
#define	set_his_want_state_dont		set_my_want_state_wont
238
#define	set_his_want_state_wont		set_my_want_state_dont
239
 
240
 
241
extern FILE
242
    *NetTrace;		/* Where debugging output goes */
243
extern unsigned char
244
    NetTraceFile[];	/* Name of file where debugging output goes */
245
extern void
246
    SetNetTrace __P((char *));	/* Function to change where debugging goes */
247
 
248
extern jmp_buf
249
    peerdied,
250
    toplevel;		/* For error conditions. */
251
 
252
extern void
253
    command __P((int, char *, int)),
254
    Dump __P((char, unsigned char *, int)),
255
    init_3270 __P((void)),
256
    printoption __P((char *, int, int)),
257
    printsub __P((char, unsigned char *, int)),
258
    sendnaws __P((void)),
259
    setconnmode __P((int)),
260
    setcommandmode __P((void)),
261
    setneturg __P((void)),
262
    sys_telnet_init __P((void)),
263
    telnet __P((char *)),
264
    tel_enter_binary __P((int)),
265
    TerminalFlushOutput __P((void)),
266
    TerminalNewMode __P((int)),
267
    TerminalRestoreState __P((void)),
268
    TerminalSaveState __P((void)),
269
    tninit __P((void)),
270
    upcase __P((char *)),
271
    willoption __P((int)),
272
    wontoption __P((int));
273
 
274
extern void
275
    send_do __P((int, int)),
276
    send_dont __P((int, int)),
277
    send_will __P((int, int)),
278
    send_wont __P((int, int));
279
 
280
extern void
281
    lm_will __P((unsigned char *, int)),
282
    lm_wont __P((unsigned char *, int)),
283
    lm_do __P((unsigned char *, int)),
284
    lm_dont __P((unsigned char *, int)),
285
    lm_mode __P((unsigned char *, int, int));
286
 
287
extern void
288
    slc_init __P((void)),
289
    slcstate __P((void)),
290
    slc_mode_export __P((void)),
291
    slc_mode_import __P((int)),
292
    slc_import __P((int)),
293
    slc_export __P((void)),
294
    slc __P((unsigned char *, int)),
295
    slc_check __P((void)),
296
    slc_start_reply __P((void)),
297
    slc_add_reply __P((unsigned char, unsigned char, cc_t)),
298
    slc_end_reply __P((void));
299
extern int
300
    slc_update __P((void));
301
 
302
extern void
303
    env_opt __P((unsigned char *, int)),
304
    env_opt_start __P((void)),
305
    env_opt_start_info __P((void)),
306
    env_opt_add __P((unsigned char *)),
307
    env_opt_end __P((int));
308
 
309
extern unsigned char
310
    *env_default __P((int, int)),
311
    *env_getvalue __P((unsigned char *));
312
 
313
extern int
314
    get_status __P((void)),
315
    dosynch __P((void));
316
 
317
extern cc_t
318
    *tcval __P((int));
319
 
320
#ifndef	USE_TERMIO
321
 
322
extern struct	tchars ntc;
323
extern struct	ltchars nltc;
324
extern struct	sgttyb nttyb;
325
 
326
# define termEofChar		ntc.t_eofc
327
# define termEraseChar		nttyb.sg_erase
328
# define termFlushChar		nltc.t_flushc
329
# define termIntChar		ntc.t_intrc
330
# define termKillChar		nttyb.sg_kill
331
# define termLiteralNextChar	nltc.t_lnextc
332
# define termQuitChar		ntc.t_quitc
333
# define termSuspChar		nltc.t_suspc
334
# define termRprntChar		nltc.t_rprntc
335
# define termWerasChar		nltc.t_werasc
336
# define termStartChar		ntc.t_startc
337
# define termStopChar		ntc.t_stopc
338
# define termForw1Char		ntc.t_brkc
339
extern cc_t termForw2Char;
340
extern cc_t termAytChar;
341
 
342
# define termEofCharp		(cc_t *)&ntc.t_eofc
343
# define termEraseCharp		(cc_t *)&nttyb.sg_erase
344
# define termFlushCharp		(cc_t *)&nltc.t_flushc
345
# define termIntCharp		(cc_t *)&ntc.t_intrc
346
# define termKillCharp		(cc_t *)&nttyb.sg_kill
347
# define termLiteralNextCharp	(cc_t *)&nltc.t_lnextc
348
# define termQuitCharp		(cc_t *)&ntc.t_quitc
349
# define termSuspCharp		(cc_t *)&nltc.t_suspc
350
# define termRprntCharp		(cc_t *)&nltc.t_rprntc
351
# define termWerasCharp		(cc_t *)&nltc.t_werasc
352
# define termStartCharp		(cc_t *)&ntc.t_startc
353
# define termStopCharp		(cc_t *)&ntc.t_stopc
354
# define termForw1Charp		(cc_t *)&ntc.t_brkc
355
# define termForw2Charp		(cc_t *)&termForw2Char
356
# define termAytCharp		(cc_t *)&termAytChar
357
 
358
# else
359
 
360
extern struct	termio new_tc;
361
 
362
# define termEofChar		new_tc.c_cc[VEOF]
363
# define termEraseChar		new_tc.c_cc[VERASE]
364
# define termIntChar		new_tc.c_cc[VINTR]
365
# define termKillChar		new_tc.c_cc[VKILL]
366
# define termQuitChar		new_tc.c_cc[VQUIT]
367
 
368
# ifndef	VSUSP
369
extern cc_t termSuspChar;
370
# else
371
#  define termSuspChar		new_tc.c_cc[VSUSP]
372
# endif
373
# if	defined(VFLUSHO) && !defined(VDISCARD)
374
#  define VDISCARD VFLUSHO
375
# endif
376
# ifndef	VDISCARD
377
extern cc_t termFlushChar;
378
# else
379
#  define termFlushChar		new_tc.c_cc[VDISCARD]
380
# endif
381
# ifndef VWERASE
382
extern cc_t termWerasChar;
383
# else
384
#  define termWerasChar		new_tc.c_cc[VWERASE]
385
# endif
386
# ifndef	VREPRINT
387
extern cc_t termRprntChar;
388
# else
389
#  define termRprntChar		new_tc.c_cc[VREPRINT]
390
# endif
391
# ifndef	VLNEXT
392
extern cc_t termLiteralNextChar;
393
# else
394
#  define termLiteralNextChar	new_tc.c_cc[VLNEXT]
395
# endif
396
# ifndef	VSTART
397
extern cc_t termStartChar;
398
# else
399
#  define termStartChar		new_tc.c_cc[VSTART]
400
# endif
401
# ifndef	VSTOP
402
extern cc_t termStopChar;
403
# else
404
#  define termStopChar		new_tc.c_cc[VSTOP]
405
# endif
406
# ifndef	VEOL
407
extern cc_t termForw1Char;
408
# else
409
#  define termForw1Char		new_tc.c_cc[VEOL]
410
# endif
411
# ifndef	VEOL2
412
extern cc_t termForw2Char;
413
# else
414
#  define termForw2Char		new_tc.c_cc[VEOL]
415
# endif
416
# ifndef	VSTATUS
417
extern cc_t termAytChar;
418
#else
419
#  define termAytChar		new_tc.c_cc[VSTATUS]
420
#endif
421
 
422
# if !defined(CRAY) || defined(__STDC__)
423
#  define termEofCharp		&termEofChar
424
#  define termEraseCharp	&termEraseChar
425
#  define termIntCharp		&termIntChar
426
#  define termKillCharp		&termKillChar
427
#  define termQuitCharp		&termQuitChar
428
#  define termSuspCharp		&termSuspChar
429
#  define termFlushCharp	&termFlushChar
430
#  define termWerasCharp	&termWerasChar
431
#  define termRprntCharp	&termRprntChar
432
#  define termLiteralNextCharp	&termLiteralNextChar
433
#  define termStartCharp	&termStartChar
434
#  define termStopCharp		&termStopChar
435
#  define termForw1Charp	&termForw1Char
436
#  define termForw2Charp	&termForw2Char
437
#  define termAytCharp		&termAytChar
438
# else
439
	/* Work around a compiler bug */
440
#  define termEofCharp		0
441
#  define termEraseCharp	0
442
#  define termIntCharp		0
443
#  define termKillCharp		0
444
#  define termQuitCharp		0
445
#  define termSuspCharp		0
446
#  define termFlushCharp	0
447
#  define termWerasCharp	0
448
#  define termRprntCharp	0
449
#  define termLiteralNextCharp	0
450
#  define termStartCharp	0
451
#  define termStopCharp		0
452
#  define termForw1Charp	0
453
#  define termForw2Charp	0
454
#  define termAytCharp		0
455
# endif
456
#endif
457
 
458
 
459
/* Ring buffer structures which are shared */
460
 
461
extern Ring
462
    netoring,
463
    netiring,
464
    ttyoring,
465
    ttyiring;
466
 
467
/* Tn3270 section */
468
#if	defined(TN3270)
469
 
470
extern int
471
    HaveInput,		/* Whether an asynchronous I/O indication came in */
472
    noasynchtty,	/* Don't do signals on I/O (SIGURG, SIGIO) */
473
    noasynchnet,	/* Don't do signals on I/O (SIGURG, SIGIO) */
474
    sigiocount,		/* Count of SIGIO receptions */
475
    shell_active;	/* Subshell is active */
476
 
477
extern char
478
    *Ibackp,		/* Oldest byte of 3270 data */
479
    Ibuf[],		/* 3270 buffer */
480
    *Ifrontp,		/* Where next 3270 byte goes */
481
    tline[],
482
    *transcom;		/* Transparent command */
483
 
484
extern int
485
    settranscom __P((int, char**));
486
 
487
extern void
488
    inputAvailable __P((int));
489
#endif	/* defined(TN3270) */