xref: /original-bsd/usr.bin/telnet/externs.h (revision a76afa45)
1 /*
2  * Copyright (c) 1988 Regents of the University of California.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms are permitted
6  * provided that the above copyright notice and this paragraph are
7  * duplicated in all such forms and that any documentation,
8  * advertising materials, and other materials related to such
9  * distribution and use acknowledge that the software was developed
10  * by the University of California, Berkeley.  The name of the
11  * University may not be used to endorse or promote products derived
12  * from this software without specific prior written permission.
13  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16  *
17  *	@(#)externs.h	1.15 (Berkeley) 03/21/89
18  */
19 
20 #include <stdio.h>
21 #include <setjmp.h>
22 
23 #define	SUBBUFSIZE	100
24 
25 extern int errno;		/* outside this world */
26 
27 extern char
28     *strcat(),
29     *strcpy();			/* outside this world */
30 
31 extern int
32     flushout,		/* flush output */
33     connected,		/* Are we connected to the other side? */
34     globalmode,		/* Mode tty should be in */
35     In3270,			/* Are we in 3270 mode? */
36     telnetport,		/* Are we connected to the telnet port? */
37     localflow,		/* Flow control handled locally */
38     localchars,		/* we recognize interrupt/quit */
39     donelclchars,		/* the user has set "localchars" */
40     showoptions,
41     net,		/* Network file descriptor */
42     tin,		/* Terminal input file descriptor */
43     tout,		/* Terminal output file descriptor */
44     crlf,		/* Should '\r' be mapped to <CR><LF> (or <CR><NUL>)? */
45     autoflush,		/* flush output when interrupting? */
46     autosynch,		/* send interrupt characters with SYNCH? */
47     SYNCHing,		/* Is the stream in telnet SYNCH mode? */
48     donebinarytoggle,	/* the user has put us in binary */
49     dontlecho,		/* do we suppress local echoing right now? */
50     crmod,
51     netdata,		/* Print out network data flow */
52     debug;			/* Debug level */
53 
54 extern char
55     echoc,			/* Toggle local echoing */
56     escape,			/* Escape to command mode */
57     doopt[],
58     dont[],
59     will[],
60     wont[],
61     options[],		/* All the little options */
62     *hostname,		/* Who are we connected to? */
63     *prompt;		/* Prompt for command. */
64 
65 /*
66  * We keep track of each side of the option negotiation.
67  */
68 
69 #define	OPT_HE_SAID_DO		0x01
70 #define	OPT_HE_SAID_WILL	0x02
71 #define	OPT_I_SAID_DO		0x04
72 #define	OPT_I_SAID_WILL		0x08
73 
74 /*
75  * Macros to check out what has been said.
76  */
77 
78 #define	did_he_say_do(opt)	(options[opt]&OPT_HE_SAID_DO)
79 #define	did_he_say_will(opt)	(options[opt]&OPT_HE_SAID_WILL)
80 #define	did_I_say_do(opt)	(options[opt]&OPT_I_SAID_DO)
81 #define	did_I_say_will(opt)	(options[opt]&OPT_I_SAID_WILL)
82 
83 #define	should_he(opt) \
84 	    (did_he_say_will(opt) && did_I_say_do(opt))
85 #define	should_I(opt) \
86 	    (did_I_say_will(opt) && did_he_say_do(opt))
87 
88 extern FILE
89     *NetTrace;		/* Where debugging output goes */
90 
91 extern jmp_buf
92     peerdied,
93     toplevel;		/* For error conditions. */
94 
95 extern void
96     command(),
97 #if	!defined(NOT43)
98     dosynch(),
99 #endif	/* !defined(NOT43) */
100     Dump(),
101     init_3270(),
102     printoption(),
103     printsub(),
104     sendnaws(),
105     setconnmode(),
106     setcommandmode(),
107     setneturg(),
108     sys_telnet_init(),
109     telnet(),
110     TerminalFlushOutput(),
111     TerminalNewMode(),
112     TerminalRestoreState(),
113     TerminalSaveState(),
114     tninit(),
115     upcase(),
116     willoption(),
117     wontoption();
118 
119 #if	defined(NOT43)
120 extern int
121     dosynch();
122 #endif	/* defined(NOT43) */
123 
124 extern char
125     termEofChar,
126     termEraseChar,
127     termFlushChar,
128     termIntChar,
129     termKillChar,
130     termLiteralNextChar,
131     termQuitChar;
132 
133 /* Ring buffer structures which are shared */
134 
135 extern Ring
136     netoring,
137     netiring,
138     ttyoring,
139     ttyiring;
140 
141 /* Tn3270 section */
142 #if	defined(TN3270)
143 
144 extern int
145     HaveInput,		/* Whether an asynchronous I/O indication came in */
146     noasynchtty,	/* Don't do signals on I/O (SIGURG, SIGIO) */
147     noasynchnet,	/* Don't do signals on I/O (SIGURG, SIGIO) */
148     sigiocount,		/* Count of SIGIO receptions */
149     shell_active;	/* Subshell is active */
150 
151 extern char
152     *Ibackp,		/* Oldest byte of 3270 data */
153     Ibuf[],		/* 3270 buffer */
154     *Ifrontp,		/* Where next 3270 byte goes */
155     tline[],
156     *transcom;		/* Transparent command */
157 
158 extern int
159     settranscom();
160 
161 extern void
162     inputAvailable();
163 #endif	/* defined(TN3270) */
164