ext.h revision 29181
129088Smarkm/*
229088Smarkm * Copyright (c) 1989, 1993
329088Smarkm *	The Regents of the University of California.  All rights reserved.
429088Smarkm *
529088Smarkm * Redistribution and use in source and binary forms, with or without
629088Smarkm * modification, are permitted provided that the following conditions
729088Smarkm * are met:
829088Smarkm * 1. Redistributions of source code must retain the above copyright
929088Smarkm *    notice, this list of conditions and the following disclaimer.
1029088Smarkm * 2. Redistributions in binary form must reproduce the above copyright
1129088Smarkm *    notice, this list of conditions and the following disclaimer in the
1229088Smarkm *    documentation and/or other materials provided with the distribution.
1329088Smarkm * 3. All advertising materials mentioning features or use of this software
1429088Smarkm *    must display the following acknowledgement:
1529088Smarkm *	This product includes software developed by the University of
1629088Smarkm *	California, Berkeley and its contributors.
1729088Smarkm * 4. Neither the name of the University nor the names of its contributors
1829088Smarkm *    may be used to endorse or promote products derived from this software
1929088Smarkm *    without specific prior written permission.
2029088Smarkm *
2129088Smarkm * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2229088Smarkm * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2329088Smarkm * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2429088Smarkm * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2529088Smarkm * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2629088Smarkm * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2729088Smarkm * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2829088Smarkm * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2929088Smarkm * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3029088Smarkm * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3129088Smarkm * SUCH DAMAGE.
3229088Smarkm *
3329088Smarkm *	@(#)ext.h	8.2 (Berkeley) 12/15/93
3429088Smarkm */
3529088Smarkm
3629088Smarkm/*
3729088Smarkm * Telnet server variable declarations
3829088Smarkm */
3929088Smarkmextern char	options[256];
4029088Smarkmextern char	do_dont_resp[256];
4129088Smarkmextern char	will_wont_resp[256];
4229088Smarkmextern int	linemode;	/* linemode on/off */
4329088Smarkm#ifdef	LINEMODE
4429088Smarkmextern int	uselinemode;	/* what linemode to use (on/off) */
4529088Smarkmextern int	editmode;	/* edit modes in use */
4629088Smarkmextern int	useeditmode;	/* edit modes to use */
4729088Smarkmextern int	alwayslinemode;	/* command line option */
4829088Smarkmextern int	lmodetype;	/* Client support for linemode */
4929088Smarkm#endif	/* LINEMODE */
5029088Smarkmextern int	flowmode;	/* current flow control state */
5129088Smarkmextern int	restartany;	/* restart output on any character state */
5229088Smarkm#ifdef DIAGNOSTICS
5329088Smarkmextern int	diagnostic;	/* telnet diagnostic capabilities */
5429088Smarkm#endif /* DIAGNOSTICS */
5529088Smarkm#ifdef BFTPDAEMON
5629088Smarkmextern int	bftpd;		/* behave as bftp daemon */
5729088Smarkm#endif /* BFTPDAEMON */
5829088Smarkm#if	defined(SecurID)
5929088Smarkmextern int	require_SecurID;
6029088Smarkm#endif
6129088Smarkm#if	defined(AUTHENTICATION)
6229088Smarkmextern int	auth_level;
6329088Smarkm#endif
6429088Smarkm
6529088Smarkmextern slcfun	slctab[NSLC + 1];	/* slc mapping table */
6629088Smarkm
6729088Smarkmchar	*terminaltype;
6829088Smarkm
6929088Smarkm/*
7029088Smarkm * I/O data buffers, pointers, and counters.
7129088Smarkm */
7229088Smarkmextern char	ptyobuf[BUFSIZ+NETSLOP], *pfrontp, *pbackp;
7329088Smarkm
7429088Smarkmextern char	netibuf[BUFSIZ], *netip;
7529088Smarkm
7629088Smarkmextern char	netobuf[BUFSIZ+NETSLOP], *nfrontp, *nbackp;
7729088Smarkmextern char	*neturg;		/* one past last bye of urgent data */
7829088Smarkm
7929088Smarkmextern int	pcc, ncc;
8029088Smarkm
8129088Smarkm#if defined(CRAY2) && defined(UNICOS5)
8229088Smarkmextern int unpcc;  /* characters left unprocessed by CRAY-2 terminal routine */
8329088Smarkmextern char *unptyip;  /* pointer to remaining characters in buffer */
8429088Smarkm#endif
8529088Smarkm
8629088Smarkmextern int	pty, net;
8729088Smarkmextern char	*line;
8829088Smarkmextern int	SYNCHing;		/* we are in TELNET SYNCH mode */
8929088Smarkm
9029088Smarkm#ifndef	P
9129088Smarkm# ifdef	__STDC__
9229088Smarkm#  define P(x)	x
9329088Smarkm# else
9429088Smarkm#  define P(x)	()
9529088Smarkm# endif
9629088Smarkm#endif
9729088Smarkm
9829088Smarkmextern void
9929088Smarkm	_termstat P((void)),
10029088Smarkm	add_slc P((int, int, int)),
10129088Smarkm	check_slc P((void)),
10229088Smarkm	change_slc P((int, int, int)),
10329088Smarkm	cleanup P((int)),
10429088Smarkm	clientstat P((int, int, int)),
10529088Smarkm	copy_termbuf P((char *, int)),
10629088Smarkm	deferslc P((void)),
10729088Smarkm	defer_terminit P((void)),
10829088Smarkm	do_opt_slc P((unsigned char *, int)),
10929088Smarkm	doeof P((void)),
11029088Smarkm	dooption P((int)),
11129088Smarkm	dontoption P((int)),
11229088Smarkm	edithost P((char *, char *)),
11329088Smarkm	fatal P((int, char *)),
11429088Smarkm	fatalperror P((int, char *)),
11529088Smarkm	get_slc_defaults P((void)),
11629088Smarkm	init_env P((void)),
11729088Smarkm	init_termbuf P((void)),
11829088Smarkm	interrupt P((void)),
11929088Smarkm	localstat P((void)),
12029088Smarkm	flowstat P((void)),
12129088Smarkm	netclear P((void)),
12229088Smarkm	netflush P((void)),
12329088Smarkm#ifdef DIAGNOSTICS
12429088Smarkm	printoption P((char *, int)),
12529088Smarkm	printdata P((char *, char *, int)),
12629088Smarkm	printsub P((int, unsigned char *, int)),
12729088Smarkm#endif
12829088Smarkm	ptyflush P((void)),
12929088Smarkm	putchr P((int)),
13029088Smarkm	putf P((char *, char *)),
13129088Smarkm	recv_ayt P((void)),
13229088Smarkm	send_do P((int, int)),
13329088Smarkm	send_dont P((int, int)),
13429088Smarkm	send_slc P((void)),
13529088Smarkm	send_status P((void)),
13629088Smarkm	send_will P((int, int)),
13729088Smarkm	send_wont P((int, int)),
13829088Smarkm	sendbrk P((void)),
13929088Smarkm	sendsusp P((void)),
14029088Smarkm	set_termbuf P((void)),
14129088Smarkm	start_login P((char *, int, char *)),
14229088Smarkm	start_slc P((int)),
14329088Smarkm#if	defined(AUTHENTICATION)
14429088Smarkm	start_slave P((char *)),
14529088Smarkm#else
14629088Smarkm	start_slave P((char *, int, char *)),
14729088Smarkm#endif
14829088Smarkm	suboption P((void)),
14929088Smarkm	telrcv P((void)),
15029088Smarkm	ttloop P((void)),
15129088Smarkm	tty_binaryin P((int)),
15229088Smarkm	tty_binaryout P((int));
15329088Smarkm
15429088Smarkmextern int
15529088Smarkm	end_slc P((unsigned char **)),
15629088Smarkm	getnpty P((void)),
15729088Smarkm#ifndef convex
15829088Smarkm	getpty P((int *)),
15929088Smarkm#endif
16029088Smarkm	login_tty P((int)),
16129088Smarkm	spcset P((int, cc_t *, cc_t **)),
16229088Smarkm	stilloob P((int)),
16329088Smarkm	terminit P((void)),
16429088Smarkm	termstat P((void)),
16529088Smarkm	tty_flowmode P((void)),
16629088Smarkm	tty_restartany P((void)),
16729088Smarkm	tty_isbinaryin P((void)),
16829088Smarkm	tty_isbinaryout P((void)),
16929088Smarkm	tty_iscrnl P((void)),
17029088Smarkm	tty_isecho P((void)),
17129088Smarkm	tty_isediting P((void)),
17229088Smarkm	tty_islitecho P((void)),
17329088Smarkm	tty_isnewmap P((void)),
17429088Smarkm	tty_israw P((void)),
17529088Smarkm	tty_issofttab P((void)),
17629088Smarkm	tty_istrapsig P((void)),
17729088Smarkm	tty_linemode P((void));
17829088Smarkm
17929088Smarkmextern void
18029088Smarkm	tty_rspeed P((int)),
18129088Smarkm	tty_setecho P((int)),
18229088Smarkm	tty_setedit P((int)),
18329088Smarkm	tty_setlinemode P((int)),
18429088Smarkm	tty_setlitecho P((int)),
18529088Smarkm	tty_setsig P((int)),
18629088Smarkm	tty_setsofttab P((int)),
18729088Smarkm	tty_tspeed P((int)),
18829088Smarkm	willoption P((int)),
18929088Smarkm	wontoption P((int)),
19029088Smarkm	writenet P((unsigned char *, int));
19129088Smarkm
19229088Smarkm#ifdef	ENCRYPTION
19329088Smarkmextern void	(*encrypt_output) P((unsigned char *, int));
19429088Smarkmextern int	(*decrypt_input) P((int));
19529088Smarkmextern char	*nclearto;
19629088Smarkm#endif	/* ENCRYPTION */
19729088Smarkm
19829088Smarkm
19929088Smarkm/*
20029088Smarkm * The following are some clocks used to decide how to interpret
20129088Smarkm * the relationship between various variables.
20229088Smarkm */
20329088Smarkm
20429088Smarkmextern struct {
20529088Smarkm    int
20629088Smarkm	system,			/* what the current time is */
20729088Smarkm	echotoggle,		/* last time user entered echo character */
20829088Smarkm	modenegotiated,		/* last time operating mode negotiated */
20929088Smarkm	didnetreceive,		/* last time we read data from network */
21029088Smarkm	ttypesubopt,		/* ttype subopt is received */
21129088Smarkm	tspeedsubopt,		/* tspeed subopt is received */
21229088Smarkm	environsubopt,		/* environ subopt is received */
21329088Smarkm	oenvironsubopt,		/* old environ subopt is received */
21429088Smarkm	xdisplocsubopt,		/* xdisploc subopt is received */
21529088Smarkm	baseline,		/* time started to do timed action */
21629088Smarkm	gotDM;			/* when did we last see a data mark */
21729088Smarkm} clocks;
21829088Smarkm
21929088Smarkm
22029088Smarkm#if	defined(CRAY2) && defined(UNICOS5)
22129088Smarkmextern int	needtermstat;
22229088Smarkm#endif
22329088Smarkm
22429088Smarkm#ifndef	DEFAULT_IM
22529088Smarkm# ifdef CRAY
22629088Smarkm#  define DEFAULT_IM	"\r\n\r\nCray UNICOS (%h) (%t)\r\n\r\r\n\r"
22729088Smarkm# else
22829088Smarkm#  ifdef sun
22929088Smarkm#   define DEFAULT_IM	"\r\n\r\nSunOS UNIX (%h) (%t)\r\n\r\r\n\r"
23029088Smarkm#  else
23129088Smarkm#   ifdef ultrix
23229088Smarkm#    define DEFAULT_IM	"\r\n\r\nULTRIX (%h) (%t)\r\n\r\r\n\r"
23329088Smarkm#   else
23429181Smarkm#    ifdef __FreeBSD__
23529181Smarkm#     define DEFAULT_IM  "\r\n\r\nFreeBSD (%h) (%t)\r\n\r\r\n\r"
23629181Smarkm#    else
23729088Smarkm#    define DEFAULT_IM	"\r\n\r\n4.4 BSD UNIX (%h) (%t)\r\n\r\r\n\r"
23829181Smarkm#    endif
23929088Smarkm#   endif
24029088Smarkm#  endif
24129088Smarkm# endif
24229088Smarkm#endif
243