1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * Copyright 1994-2002 Sun Microsystems, Inc.  All rights reserved.
3*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
4*7c478bd9Sstevel@tonic-gate  */
5*7c478bd9Sstevel@tonic-gate 
6*7c478bd9Sstevel@tonic-gate /*
7*7c478bd9Sstevel@tonic-gate  * Copyright (c) 1988, 1990, 1993
8*7c478bd9Sstevel@tonic-gate  *	The Regents of the University of California.  All rights reserved.
9*7c478bd9Sstevel@tonic-gate  *
10*7c478bd9Sstevel@tonic-gate  * Redistribution and use in source and binary forms, with or without
11*7c478bd9Sstevel@tonic-gate  * modification, are permitted provided that the following conditions
12*7c478bd9Sstevel@tonic-gate  * are met:
13*7c478bd9Sstevel@tonic-gate  * 1. Redistributions of source code must retain the above copyright
14*7c478bd9Sstevel@tonic-gate  *    notice, this list of conditions and the following disclaimer.
15*7c478bd9Sstevel@tonic-gate  * 2. Redistributions in binary form must reproduce the above copyright
16*7c478bd9Sstevel@tonic-gate  *    notice, this list of conditions and the following disclaimer in the
17*7c478bd9Sstevel@tonic-gate  *    documentation and/or other materials provided with the distribution.
18*7c478bd9Sstevel@tonic-gate  * 3. All advertising materials mentioning features or use of this software
19*7c478bd9Sstevel@tonic-gate  *    must display the following acknowledgement:
20*7c478bd9Sstevel@tonic-gate  *	This product includes software developed by the University of
21*7c478bd9Sstevel@tonic-gate  *	California, Berkeley and its contributors.
22*7c478bd9Sstevel@tonic-gate  * 4. Neither the name of the University nor the names of its contributors
23*7c478bd9Sstevel@tonic-gate  *    may be used to endorse or promote products derived from this software
24*7c478bd9Sstevel@tonic-gate  *    without specific prior written permission.
25*7c478bd9Sstevel@tonic-gate  *
26*7c478bd9Sstevel@tonic-gate  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27*7c478bd9Sstevel@tonic-gate  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28*7c478bd9Sstevel@tonic-gate  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29*7c478bd9Sstevel@tonic-gate  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30*7c478bd9Sstevel@tonic-gate  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31*7c478bd9Sstevel@tonic-gate  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32*7c478bd9Sstevel@tonic-gate  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33*7c478bd9Sstevel@tonic-gate  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34*7c478bd9Sstevel@tonic-gate  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35*7c478bd9Sstevel@tonic-gate  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36*7c478bd9Sstevel@tonic-gate  * SUCH DAMAGE.
37*7c478bd9Sstevel@tonic-gate  *
38*7c478bd9Sstevel@tonic-gate  *	@(#)externs.h	8.1 (Berkeley) 6/6/93
39*7c478bd9Sstevel@tonic-gate  */
40*7c478bd9Sstevel@tonic-gate 
41*7c478bd9Sstevel@tonic-gate #ifndef _EXTERNS_H
42*7c478bd9Sstevel@tonic-gate #define	_EXTERNS_H
43*7c478bd9Sstevel@tonic-gate 
44*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
45*7c478bd9Sstevel@tonic-gate extern "C" {
46*7c478bd9Sstevel@tonic-gate #endif
47*7c478bd9Sstevel@tonic-gate 
48*7c478bd9Sstevel@tonic-gate #include <libintl.h>
49*7c478bd9Sstevel@tonic-gate #include <stdio.h>
50*7c478bd9Sstevel@tonic-gate #include <setjmp.h>
51*7c478bd9Sstevel@tonic-gate #include <sys/filio.h>
52*7c478bd9Sstevel@tonic-gate #ifdef	USE_TERMIO
53*7c478bd9Sstevel@tonic-gate #include <sys/termios.h>
54*7c478bd9Sstevel@tonic-gate #define	termio termios
55*7c478bd9Sstevel@tonic-gate #endif
56*7c478bd9Sstevel@tonic-gate #if defined(NO_CC_T) || !defined(USE_TERMIO)
57*7c478bd9Sstevel@tonic-gate #if !defined(USE_TERMIO)
58*7c478bd9Sstevel@tonic-gate typedef char cc_t;
59*7c478bd9Sstevel@tonic-gate #else
60*7c478bd9Sstevel@tonic-gate typedef unsigned char cc_t;
61*7c478bd9Sstevel@tonic-gate #endif
62*7c478bd9Sstevel@tonic-gate #endif
63*7c478bd9Sstevel@tonic-gate 
64*7c478bd9Sstevel@tonic-gate #include "auth.h"
65*7c478bd9Sstevel@tonic-gate #include "encrypt.h"
66*7c478bd9Sstevel@tonic-gate #include <profile/prof_int.h>
67*7c478bd9Sstevel@tonic-gate 
68*7c478bd9Sstevel@tonic-gate extern profile_options_boolean	config_file_options[];
69*7c478bd9Sstevel@tonic-gate #define	forwardable_flag_set	config_file_options[0].found
70*7c478bd9Sstevel@tonic-gate #define	forward_flag_set	config_file_options[1].found
71*7c478bd9Sstevel@tonic-gate #define	encrypt_flag_set	config_file_options[2].found
72*7c478bd9Sstevel@tonic-gate #define	autologin_set		config_file_options[3].found
73*7c478bd9Sstevel@tonic-gate 
74*7c478bd9Sstevel@tonic-gate #include <string.h>
75*7c478bd9Sstevel@tonic-gate 
76*7c478bd9Sstevel@tonic-gate #ifndef	_POSIX_VDISABLE
77*7c478bd9Sstevel@tonic-gate #include <sys/param.h>	/* pick up VDISABLE definition, mayby */
78*7c478bd9Sstevel@tonic-gate #ifdef VDISABLE
79*7c478bd9Sstevel@tonic-gate #define	_POSIX_VDISABLE VDISABLE
80*7c478bd9Sstevel@tonic-gate #else
81*7c478bd9Sstevel@tonic-gate #define	_POSIX_VDISABLE ((cc_t)'\377')
82*7c478bd9Sstevel@tonic-gate #endif
83*7c478bd9Sstevel@tonic-gate #endif
84*7c478bd9Sstevel@tonic-gate 
85*7c478bd9Sstevel@tonic-gate #include <wait.h>
86*7c478bd9Sstevel@tonic-gate #include <stdlib.h>
87*7c478bd9Sstevel@tonic-gate #include <unistd.h>
88*7c478bd9Sstevel@tonic-gate 
89*7c478bd9Sstevel@tonic-gate 
90*7c478bd9Sstevel@tonic-gate #define	SUBBUFSIZE	256
91*7c478bd9Sstevel@tonic-gate 
92*7c478bd9Sstevel@tonic-gate extern int autologin;	/* Autologin enabled */
93*7c478bd9Sstevel@tonic-gate extern int skiprc;	/* Don't process the ~/.telnetrc file */
94*7c478bd9Sstevel@tonic-gate extern int eight;	/* use eight bit mode (binary in and/or out */
95*7c478bd9Sstevel@tonic-gate extern int flushout;	/* flush output */
96*7c478bd9Sstevel@tonic-gate extern int connected;	/* Are we connected to the other side? */
97*7c478bd9Sstevel@tonic-gate extern int globalmode;	/* Mode tty should be in */
98*7c478bd9Sstevel@tonic-gate extern int telnetport;	/* Are we connected to the telnet port? */
99*7c478bd9Sstevel@tonic-gate extern int localflow;	/* Flow control handled locally */
100*7c478bd9Sstevel@tonic-gate extern int restartany;	/* If flow control, restart output on any character */
101*7c478bd9Sstevel@tonic-gate extern int localchars;	/* we recognize interrupt/quit */
102*7c478bd9Sstevel@tonic-gate extern int donelclchars; /* the user has set "localchars" */
103*7c478bd9Sstevel@tonic-gate extern int showoptions;
104*7c478bd9Sstevel@tonic-gate extern int net;		/* Network file descriptor */
105*7c478bd9Sstevel@tonic-gate extern int tout;	/* Terminal output file descriptor */
106*7c478bd9Sstevel@tonic-gate extern int crlf;	/* Should '\r' be mapped to <CR><LF> (or <CR><NUL>)? */
107*7c478bd9Sstevel@tonic-gate extern int autoflush;	/* flush output when interrupting? */
108*7c478bd9Sstevel@tonic-gate extern int autosynch;	/* send interrupt characters with SYNCH? */
109*7c478bd9Sstevel@tonic-gate extern int SYNCHing;	/* Is the stream in telnet SYNCH mode? */
110*7c478bd9Sstevel@tonic-gate extern int donebinarytoggle;	/* the user has put us in binary */
111*7c478bd9Sstevel@tonic-gate extern int dontlecho;	/* do we suppress local echoing right now? */
112*7c478bd9Sstevel@tonic-gate extern int crmod;
113*7c478bd9Sstevel@tonic-gate extern int netdata;	/* Print out network data flow */
114*7c478bd9Sstevel@tonic-gate extern int prettydump;	/* Print "netdata" output in user readable format */
115*7c478bd9Sstevel@tonic-gate extern int termdata;	/* Print out terminal data flow */
116*7c478bd9Sstevel@tonic-gate extern int eof_pending;	/* Received EOF in line mode, need to send IAC-xEOF */
117*7c478bd9Sstevel@tonic-gate extern int debug;	/* Debug level */
118*7c478bd9Sstevel@tonic-gate 
119*7c478bd9Sstevel@tonic-gate 
120*7c478bd9Sstevel@tonic-gate extern int krb5auth_flag;
121*7c478bd9Sstevel@tonic-gate extern char *RemoteHostName;
122*7c478bd9Sstevel@tonic-gate extern char *UserNameRequested;
123*7c478bd9Sstevel@tonic-gate extern int forwardable_flag;
124*7c478bd9Sstevel@tonic-gate extern int forward_flag;
125*7c478bd9Sstevel@tonic-gate extern boolean_t wantencryption;	/* User has requested encryption */
126*7c478bd9Sstevel@tonic-gate extern int encrypt_flag;		/* for reading config file for Krb5 */
127*7c478bd9Sstevel@tonic-gate 
128*7c478bd9Sstevel@tonic-gate extern boolean_t Ambiguous(void *);
129*7c478bd9Sstevel@tonic-gate extern boolean_t intr_happened;	/* for interrupt handling */
130*7c478bd9Sstevel@tonic-gate extern boolean_t intr_waiting;
131*7c478bd9Sstevel@tonic-gate 
132*7c478bd9Sstevel@tonic-gate extern cc_t escape;	/* Escape to command mode */
133*7c478bd9Sstevel@tonic-gate extern cc_t rlogin;	/* Rlogin mode escape character */
134*7c478bd9Sstevel@tonic-gate extern boolean_t escape_valid;
135*7c478bd9Sstevel@tonic-gate #ifdef	KLUDGELINEMODE
136*7c478bd9Sstevel@tonic-gate extern cc_t echoc;	/* Toggle local echoing */
137*7c478bd9Sstevel@tonic-gate #endif
138*7c478bd9Sstevel@tonic-gate 
139*7c478bd9Sstevel@tonic-gate extern char *prompt;	/* Prompt for command. */
140*7c478bd9Sstevel@tonic-gate 
141*7c478bd9Sstevel@tonic-gate extern char doopt[];
142*7c478bd9Sstevel@tonic-gate extern char dont[];
143*7c478bd9Sstevel@tonic-gate extern char will[];
144*7c478bd9Sstevel@tonic-gate extern char wont[];
145*7c478bd9Sstevel@tonic-gate extern char options[];	/* All the little options */
146*7c478bd9Sstevel@tonic-gate extern char *hostname;	/* Who are we connected to? */
147*7c478bd9Sstevel@tonic-gate extern void (*encrypt_output) (unsigned char *, int);
148*7c478bd9Sstevel@tonic-gate extern int (*decrypt_input) (int);
149*7c478bd9Sstevel@tonic-gate 
150*7c478bd9Sstevel@tonic-gate /*
151*7c478bd9Sstevel@tonic-gate  * We keep track of each side of the option negotiation.
152*7c478bd9Sstevel@tonic-gate  */
153*7c478bd9Sstevel@tonic-gate 
154*7c478bd9Sstevel@tonic-gate #define	MY_STATE_WILL		0x01
155*7c478bd9Sstevel@tonic-gate #define	MY_WANT_STATE_WILL	0x02
156*7c478bd9Sstevel@tonic-gate #define	MY_STATE_DO		0x04
157*7c478bd9Sstevel@tonic-gate #define	MY_WANT_STATE_DO	0x08
158*7c478bd9Sstevel@tonic-gate 
159*7c478bd9Sstevel@tonic-gate /*
160*7c478bd9Sstevel@tonic-gate  * Macros to check the current state of things
161*7c478bd9Sstevel@tonic-gate  */
162*7c478bd9Sstevel@tonic-gate 
163*7c478bd9Sstevel@tonic-gate #define	my_state_is_do(opt)		(options[opt]&MY_STATE_DO)
164*7c478bd9Sstevel@tonic-gate #define	my_state_is_will(opt)		(options[opt]&MY_STATE_WILL)
165*7c478bd9Sstevel@tonic-gate #define	my_want_state_is_do(opt)	(options[opt]&MY_WANT_STATE_DO)
166*7c478bd9Sstevel@tonic-gate #define	my_want_state_is_will(opt)	(options[opt]&MY_WANT_STATE_WILL)
167*7c478bd9Sstevel@tonic-gate 
168*7c478bd9Sstevel@tonic-gate #define	my_state_is_dont(opt)		(!my_state_is_do(opt))
169*7c478bd9Sstevel@tonic-gate #define	my_state_is_wont(opt)		(!my_state_is_will(opt))
170*7c478bd9Sstevel@tonic-gate #define	my_want_state_is_dont(opt)	(!my_want_state_is_do(opt))
171*7c478bd9Sstevel@tonic-gate #define	my_want_state_is_wont(opt)	(!my_want_state_is_will(opt))
172*7c478bd9Sstevel@tonic-gate 
173*7c478bd9Sstevel@tonic-gate #define	set_my_state_do(opt)		{options[opt] |= MY_STATE_DO; }
174*7c478bd9Sstevel@tonic-gate #define	set_my_state_will(opt)		{options[opt] |= MY_STATE_WILL; }
175*7c478bd9Sstevel@tonic-gate #define	set_my_want_state_do(opt)	{options[opt] |= MY_WANT_STATE_DO; }
176*7c478bd9Sstevel@tonic-gate #define	set_my_want_state_will(opt)	{options[opt] |= MY_WANT_STATE_WILL; }
177*7c478bd9Sstevel@tonic-gate 
178*7c478bd9Sstevel@tonic-gate #define	set_my_state_dont(opt)		{options[opt] &= ~MY_STATE_DO; }
179*7c478bd9Sstevel@tonic-gate #define	set_my_state_wont(opt)		{options[opt] &= ~MY_STATE_WILL; }
180*7c478bd9Sstevel@tonic-gate #define	set_my_want_state_dont(opt)	{options[opt] &= ~MY_WANT_STATE_DO; }
181*7c478bd9Sstevel@tonic-gate #define	set_my_want_state_wont(opt)	{options[opt] &= ~MY_WANT_STATE_WILL; }
182*7c478bd9Sstevel@tonic-gate 
183*7c478bd9Sstevel@tonic-gate /*
184*7c478bd9Sstevel@tonic-gate  * Make everything symetrical
185*7c478bd9Sstevel@tonic-gate  */
186*7c478bd9Sstevel@tonic-gate 
187*7c478bd9Sstevel@tonic-gate #define	HIS_STATE_WILL			MY_STATE_DO
188*7c478bd9Sstevel@tonic-gate #define	HIS_WANT_STATE_WILL		MY_WANT_STATE_DO
189*7c478bd9Sstevel@tonic-gate #define	HIS_STATE_DO			MY_STATE_WILL
190*7c478bd9Sstevel@tonic-gate #define	HIS_WANT_STATE_DO		MY_WANT_STATE_WILL
191*7c478bd9Sstevel@tonic-gate 
192*7c478bd9Sstevel@tonic-gate #define	his_state_is_do			my_state_is_will
193*7c478bd9Sstevel@tonic-gate #define	his_state_is_will		my_state_is_do
194*7c478bd9Sstevel@tonic-gate #define	his_want_state_is_do		my_want_state_is_will
195*7c478bd9Sstevel@tonic-gate #define	his_want_state_is_will		my_want_state_is_do
196*7c478bd9Sstevel@tonic-gate 
197*7c478bd9Sstevel@tonic-gate #define	his_state_is_dont		my_state_is_wont
198*7c478bd9Sstevel@tonic-gate #define	his_state_is_wont		my_state_is_dont
199*7c478bd9Sstevel@tonic-gate #define	his_want_state_is_dont		my_want_state_is_wont
200*7c478bd9Sstevel@tonic-gate #define	his_want_state_is_wont		my_want_state_is_dont
201*7c478bd9Sstevel@tonic-gate 
202*7c478bd9Sstevel@tonic-gate #define	set_his_state_do		set_my_state_will
203*7c478bd9Sstevel@tonic-gate #define	set_his_state_will		set_my_state_do
204*7c478bd9Sstevel@tonic-gate #define	set_his_want_state_do		set_my_want_state_will
205*7c478bd9Sstevel@tonic-gate #define	set_his_want_state_will		set_my_want_state_do
206*7c478bd9Sstevel@tonic-gate 
207*7c478bd9Sstevel@tonic-gate #define	set_his_state_dont		set_my_state_wont
208*7c478bd9Sstevel@tonic-gate #define	set_his_state_wont		set_my_state_dont
209*7c478bd9Sstevel@tonic-gate #define	set_his_want_state_dont		set_my_want_state_wont
210*7c478bd9Sstevel@tonic-gate #define	set_his_want_state_wont		set_my_want_state_dont
211*7c478bd9Sstevel@tonic-gate 
212*7c478bd9Sstevel@tonic-gate 
213*7c478bd9Sstevel@tonic-gate extern FILE *NetTrace;		/* Where debugging output goes */
214*7c478bd9Sstevel@tonic-gate 				/* Name of file where debugging output goes */
215*7c478bd9Sstevel@tonic-gate extern unsigned char NetTraceFile[];
216*7c478bd9Sstevel@tonic-gate extern void SetNetTrace(char *); /* Function to change where debugging goes */
217*7c478bd9Sstevel@tonic-gate 
218*7c478bd9Sstevel@tonic-gate extern jmp_buf peerdied;
219*7c478bd9Sstevel@tonic-gate extern jmp_buf toplevel;	/* For error conditions. */
220*7c478bd9Sstevel@tonic-gate 
221*7c478bd9Sstevel@tonic-gate extern char *AllocStringBuffer(char **, unsigned int *, unsigned int);
222*7c478bd9Sstevel@tonic-gate extern void ExitString(char *, int);
223*7c478bd9Sstevel@tonic-gate extern void Exit(int);
224*7c478bd9Sstevel@tonic-gate extern void command(int, char *, int);
225*7c478bd9Sstevel@tonic-gate extern void Dump(int, unsigned char *, int);
226*7c478bd9Sstevel@tonic-gate extern char *GetAndAppendString(char **, unsigned int *, char *, FILE *);
227*7c478bd9Sstevel@tonic-gate extern char *GetString(char **, unsigned int *, FILE *);
228*7c478bd9Sstevel@tonic-gate extern void init_network(void);
229*7c478bd9Sstevel@tonic-gate extern void init_terminal(void);
230*7c478bd9Sstevel@tonic-gate extern void init_sys(void);
231*7c478bd9Sstevel@tonic-gate extern void optionstatus(void);
232*7c478bd9Sstevel@tonic-gate extern void printoption(char *, int, int);
233*7c478bd9Sstevel@tonic-gate extern void printsub(int, unsigned char *, int);
234*7c478bd9Sstevel@tonic-gate extern void sendnaws(void);
235*7c478bd9Sstevel@tonic-gate extern void setconnmode(int);
236*7c478bd9Sstevel@tonic-gate extern void setcommandmode(void);
237*7c478bd9Sstevel@tonic-gate extern void setneturg(void);
238*7c478bd9Sstevel@tonic-gate extern void sys_telnet_init(void);
239*7c478bd9Sstevel@tonic-gate extern void telnet(char *);
240*7c478bd9Sstevel@tonic-gate extern void tel_enter_binary(int);
241*7c478bd9Sstevel@tonic-gate extern void tel_leave_binary(int);
242*7c478bd9Sstevel@tonic-gate extern void TerminalDefaultChars(void);
243*7c478bd9Sstevel@tonic-gate extern void TerminalFlushOutput(void);
244*7c478bd9Sstevel@tonic-gate extern void TerminalNewMode(int);
245*7c478bd9Sstevel@tonic-gate extern void TerminalSaveState(void);
246*7c478bd9Sstevel@tonic-gate extern void TerminalSpeeds(int *, int *);
247*7c478bd9Sstevel@tonic-gate extern void upcase(char *);
248*7c478bd9Sstevel@tonic-gate 
249*7c478bd9Sstevel@tonic-gate extern void xmitEL(void);
250*7c478bd9Sstevel@tonic-gate extern void xmitEC(void);
251*7c478bd9Sstevel@tonic-gate extern void intp(void);
252*7c478bd9Sstevel@tonic-gate extern void sendabort(void);
253*7c478bd9Sstevel@tonic-gate extern void sendsusp(void);
254*7c478bd9Sstevel@tonic-gate extern void set_escape_char(char *);
255*7c478bd9Sstevel@tonic-gate extern void fatal_tty_error(char *);
256*7c478bd9Sstevel@tonic-gate 
257*7c478bd9Sstevel@tonic-gate extern void send_do(int, int);
258*7c478bd9Sstevel@tonic-gate extern void send_dont(int, int);
259*7c478bd9Sstevel@tonic-gate extern void send_will(int, int);
260*7c478bd9Sstevel@tonic-gate extern void send_wont(int, int);
261*7c478bd9Sstevel@tonic-gate 
262*7c478bd9Sstevel@tonic-gate extern void lm_mode(unsigned char *, int, int);
263*7c478bd9Sstevel@tonic-gate 
264*7c478bd9Sstevel@tonic-gate extern void slcstate(void);
265*7c478bd9Sstevel@tonic-gate extern void slc_mode_export(void);
266*7c478bd9Sstevel@tonic-gate extern void slc_mode_import(int);
267*7c478bd9Sstevel@tonic-gate extern void slc_check(void);
268*7c478bd9Sstevel@tonic-gate 
269*7c478bd9Sstevel@tonic-gate extern void env_opt_start_info(void);
270*7c478bd9Sstevel@tonic-gate extern void env_opt_add(unsigned char *);
271*7c478bd9Sstevel@tonic-gate extern void env_opt_end(int);
272*7c478bd9Sstevel@tonic-gate 
273*7c478bd9Sstevel@tonic-gate extern char **genget(char *, char **, int);
274*7c478bd9Sstevel@tonic-gate extern unsigned char *env_default(int, int);
275*7c478bd9Sstevel@tonic-gate extern unsigned char *env_getvalue(unsigned char *);
276*7c478bd9Sstevel@tonic-gate 
277*7c478bd9Sstevel@tonic-gate extern int env_init(void);
278*7c478bd9Sstevel@tonic-gate extern int get_status(void);
279*7c478bd9Sstevel@tonic-gate extern int init_telnet(void);
280*7c478bd9Sstevel@tonic-gate extern int isprefix(register char *, register char *);
281*7c478bd9Sstevel@tonic-gate extern int netflush(void);
282*7c478bd9Sstevel@tonic-gate extern int opt_welldefined(char *);
283*7c478bd9Sstevel@tonic-gate extern int process_rings(int, int, int, int, int, int);
284*7c478bd9Sstevel@tonic-gate extern int quit(void);
285*7c478bd9Sstevel@tonic-gate extern int rlogin_susp(void);
286*7c478bd9Sstevel@tonic-gate extern int Scheduler(int);
287*7c478bd9Sstevel@tonic-gate extern int SetSockOpt(int, int, int, int);
288*7c478bd9Sstevel@tonic-gate extern int stilloob(void);
289*7c478bd9Sstevel@tonic-gate extern int telrcv(void);
290*7c478bd9Sstevel@tonic-gate extern int TerminalWindowSize(unsigned short *, unsigned short *);
291*7c478bd9Sstevel@tonic-gate extern int TerminalWrite(char *, int);
292*7c478bd9Sstevel@tonic-gate extern int TerminalSpecialChars(int);
293*7c478bd9Sstevel@tonic-gate extern int tn(int, char **);
294*7c478bd9Sstevel@tonic-gate extern int tninit(void);
295*7c478bd9Sstevel@tonic-gate extern int ttyflush(int);
296*7c478bd9Sstevel@tonic-gate extern int getconnmode(void);
297*7c478bd9Sstevel@tonic-gate extern int xmitAO(void);
298*7c478bd9Sstevel@tonic-gate extern int sendbrk(void);
299*7c478bd9Sstevel@tonic-gate extern int dosynch(void);
300*7c478bd9Sstevel@tonic-gate 
301*7c478bd9Sstevel@tonic-gate extern cc_t *tcval(int);
302*7c478bd9Sstevel@tonic-gate 
303*7c478bd9Sstevel@tonic-gate extern void	auth_encrypt_init(char *, char *, char *);
304*7c478bd9Sstevel@tonic-gate extern void	auth_encrypt_user(char *);
305*7c478bd9Sstevel@tonic-gate extern int	net_write(unsigned char *, int len);
306*7c478bd9Sstevel@tonic-gate extern void	net_encrypt(void);
307*7c478bd9Sstevel@tonic-gate extern void	telnet_spin(void);
308*7c478bd9Sstevel@tonic-gate extern void	printd(unsigned char *, int);
309*7c478bd9Sstevel@tonic-gate 
310*7c478bd9Sstevel@tonic-gate #ifndef	USE_TERMIO
311*7c478bd9Sstevel@tonic-gate 
312*7c478bd9Sstevel@tonic-gate extern struct	tchars ntc;
313*7c478bd9Sstevel@tonic-gate extern struct	ltchars nltc;
314*7c478bd9Sstevel@tonic-gate extern struct	sgttyb nttyb;
315*7c478bd9Sstevel@tonic-gate 
316*7c478bd9Sstevel@tonic-gate #define	termEofChar		ntc.t_eofc
317*7c478bd9Sstevel@tonic-gate #define	termEraseChar		nttyb.sg_erase
318*7c478bd9Sstevel@tonic-gate #define	termFlushChar		nltc.t_flushc
319*7c478bd9Sstevel@tonic-gate #define	termIntChar		ntc.t_intrc
320*7c478bd9Sstevel@tonic-gate #define	termKillChar		nttyb.sg_kill
321*7c478bd9Sstevel@tonic-gate #define	termLiteralNextChar	nltc.t_lnextc
322*7c478bd9Sstevel@tonic-gate #define	termQuitChar		ntc.t_quitc
323*7c478bd9Sstevel@tonic-gate #define	termSuspChar		nltc.t_suspc
324*7c478bd9Sstevel@tonic-gate #define	termRprntChar		nltc.t_rprntc
325*7c478bd9Sstevel@tonic-gate #define	termWerasChar		nltc.t_werasc
326*7c478bd9Sstevel@tonic-gate #define	termStartChar		ntc.t_startc
327*7c478bd9Sstevel@tonic-gate #define	termStopChar		ntc.t_stopc
328*7c478bd9Sstevel@tonic-gate #define	termForw1Char		ntc.t_brkc
329*7c478bd9Sstevel@tonic-gate extern cc_t termForw2Char;
330*7c478bd9Sstevel@tonic-gate extern cc_t termAytChar;
331*7c478bd9Sstevel@tonic-gate 
332*7c478bd9Sstevel@tonic-gate #define	termEofCharp		(cc_t *)&ntc.t_eofc
333*7c478bd9Sstevel@tonic-gate #define	termEraseCharp		(cc_t *)&nttyb.sg_erase
334*7c478bd9Sstevel@tonic-gate #define	termFlushCharp		(cc_t *)&nltc.t_flushc
335*7c478bd9Sstevel@tonic-gate #define	termIntCharp		(cc_t *)&ntc.t_intrc
336*7c478bd9Sstevel@tonic-gate #define	termKillCharp		(cc_t *)&nttyb.sg_kill
337*7c478bd9Sstevel@tonic-gate #define	termLiteralNextCharp	(cc_t *)&nltc.t_lnextc
338*7c478bd9Sstevel@tonic-gate #define	termQuitCharp		(cc_t *)&ntc.t_quitc
339*7c478bd9Sstevel@tonic-gate #define	termSuspCharp		(cc_t *)&nltc.t_suspc
340*7c478bd9Sstevel@tonic-gate #define	termRprntCharp		(cc_t *)&nltc.t_rprntc
341*7c478bd9Sstevel@tonic-gate #define	termWerasCharp		(cc_t *)&nltc.t_werasc
342*7c478bd9Sstevel@tonic-gate #define	termStartCharp		(cc_t *)&ntc.t_startc
343*7c478bd9Sstevel@tonic-gate #define	termStopCharp		(cc_t *)&ntc.t_stopc
344*7c478bd9Sstevel@tonic-gate #define	termForw1Charp		(cc_t *)&ntc.t_brkc
345*7c478bd9Sstevel@tonic-gate #define	termForw2Charp		(cc_t *)&termForw2Char
346*7c478bd9Sstevel@tonic-gate #define	termAytCharp		(cc_t *)&termAytChar
347*7c478bd9Sstevel@tonic-gate 
348*7c478bd9Sstevel@tonic-gate #else
349*7c478bd9Sstevel@tonic-gate 
350*7c478bd9Sstevel@tonic-gate extern struct	termio new_tc;
351*7c478bd9Sstevel@tonic-gate 
352*7c478bd9Sstevel@tonic-gate #define	termEofChar		new_tc.c_cc[VEOF]
353*7c478bd9Sstevel@tonic-gate #define	termEraseChar		new_tc.c_cc[VERASE]
354*7c478bd9Sstevel@tonic-gate #define	termIntChar		new_tc.c_cc[VINTR]
355*7c478bd9Sstevel@tonic-gate #define	termKillChar		new_tc.c_cc[VKILL]
356*7c478bd9Sstevel@tonic-gate #define	termQuitChar		new_tc.c_cc[VQUIT]
357*7c478bd9Sstevel@tonic-gate 
358*7c478bd9Sstevel@tonic-gate #define	termSuspChar		new_tc.c_cc[VSUSP]
359*7c478bd9Sstevel@tonic-gate #define	termFlushChar		new_tc.c_cc[VDISCARD]
360*7c478bd9Sstevel@tonic-gate #define	termWerasChar		new_tc.c_cc[VWERASE]
361*7c478bd9Sstevel@tonic-gate #define	termRprntChar		new_tc.c_cc[VREPRINT]
362*7c478bd9Sstevel@tonic-gate #define	termLiteralNextChar	new_tc.c_cc[VLNEXT]
363*7c478bd9Sstevel@tonic-gate #define	termStartChar		new_tc.c_cc[VSTART]
364*7c478bd9Sstevel@tonic-gate #define	termStopChar		new_tc.c_cc[VSTOP]
365*7c478bd9Sstevel@tonic-gate #define	termForw1Char		new_tc.c_cc[VEOL]
366*7c478bd9Sstevel@tonic-gate #define	termForw2Char		new_tc.c_cc[VEOL]
367*7c478bd9Sstevel@tonic-gate extern cc_t termAytChar;
368*7c478bd9Sstevel@tonic-gate 
369*7c478bd9Sstevel@tonic-gate #define	termEofCharp		&termEofChar
370*7c478bd9Sstevel@tonic-gate #define	termEraseCharp		&termEraseChar
371*7c478bd9Sstevel@tonic-gate #define	termIntCharp		&termIntChar
372*7c478bd9Sstevel@tonic-gate #define	termKillCharp		&termKillChar
373*7c478bd9Sstevel@tonic-gate #define	termQuitCharp		&termQuitChar
374*7c478bd9Sstevel@tonic-gate #define	termSuspCharp		&termSuspChar
375*7c478bd9Sstevel@tonic-gate #define	termFlushCharp		&termFlushChar
376*7c478bd9Sstevel@tonic-gate #define	termWerasCharp		&termWerasChar
377*7c478bd9Sstevel@tonic-gate #define	termRprntCharp		&termRprntChar
378*7c478bd9Sstevel@tonic-gate #define	termLiteralNextCharp	&termLiteralNextChar
379*7c478bd9Sstevel@tonic-gate #define	termStartCharp		&termStartChar
380*7c478bd9Sstevel@tonic-gate #define	termStopCharp		&termStopChar
381*7c478bd9Sstevel@tonic-gate #define	termForw1Charp		&termForw1Char
382*7c478bd9Sstevel@tonic-gate #define	termForw2Charp		&termForw2Char
383*7c478bd9Sstevel@tonic-gate #define	termAytCharp		&termAytChar
384*7c478bd9Sstevel@tonic-gate #endif
385*7c478bd9Sstevel@tonic-gate 
386*7c478bd9Sstevel@tonic-gate 
387*7c478bd9Sstevel@tonic-gate /* Ring buffer structures which are shared */
388*7c478bd9Sstevel@tonic-gate 
389*7c478bd9Sstevel@tonic-gate #include "ring.h"
390*7c478bd9Sstevel@tonic-gate 
391*7c478bd9Sstevel@tonic-gate extern Ring netoring;
392*7c478bd9Sstevel@tonic-gate extern Ring netiring;
393*7c478bd9Sstevel@tonic-gate extern Ring ttyoring;
394*7c478bd9Sstevel@tonic-gate extern Ring ttyiring;
395*7c478bd9Sstevel@tonic-gate 
396*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
397*7c478bd9Sstevel@tonic-gate }
398*7c478bd9Sstevel@tonic-gate #endif
399*7c478bd9Sstevel@tonic-gate 
400*7c478bd9Sstevel@tonic-gate #endif	/* _EXTERNS_H */
401