ext.h revision 80038
133965Sjdp/*
289862Sobrien * Copyright (c) 1989, 1993
378833Sobrien *	The Regents of the University of California.  All rights reserved.
433965Sjdp *
533965Sjdp * Redistribution and use in source and binary forms, with or without
633965Sjdp * modification, are permitted provided that the following conditions
733965Sjdp * are met:
833965Sjdp * 1. Redistributions of source code must retain the above copyright
933965Sjdp *    notice, this list of conditions and the following disclaimer.
1033965Sjdp * 2. Redistributions in binary form must reproduce the above copyright
1133965Sjdp *    notice, this list of conditions and the following disclaimer in the
1233965Sjdp *    documentation and/or other materials provided with the distribution.
1333965Sjdp * 3. All advertising materials mentioning features or use of this software
1433965Sjdp *    must display the following acknowledgement:
1533965Sjdp *	This product includes software developed by the University of
1633965Sjdp *	California, Berkeley and its contributors.
1733965Sjdp * 4. Neither the name of the University nor the names of its contributors
1833965Sjdp *    may be used to endorse or promote products derived from this software
1933965Sjdp *    without specific prior written permission.
2033965Sjdp *
2133965Sjdp * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2257406Sjdp * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2357406Sjdp * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2433965Sjdp * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2533965Sjdp * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2633965Sjdp * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2733965Sjdp * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2833965Sjdp * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2933965Sjdp * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3033965Sjdp * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3133965Sjdp * SUCH DAMAGE.
3233965Sjdp *
3333965Sjdp *	@(#)ext.h	8.2 (Berkeley) 12/15/93
3433965Sjdp * $FreeBSD: head/contrib/telnet/telnetd/ext.h 80038 2001-07-20 12:02:30Z ru $
3533965Sjdp */
3633965Sjdp
3733965Sjdp/*
3833965Sjdp * Telnet server variable declarations
3933965Sjdp */
4077303Sobrienextern char	options[256];
4133965Sjdpextern char	do_dont_resp[256];
4233965Sjdpextern char	will_wont_resp[256];
4333965Sjdpextern int	linemode;	/* linemode on/off */
4433965Sjdp#ifdef	LINEMODE
4533965Sjdpextern int	uselinemode;	/* what linemode to use (on/off) */
4633965Sjdpextern int	editmode;	/* edit modes in use */
4733965Sjdpextern int	useeditmode;	/* edit modes to use */
4833965Sjdpextern int	alwayslinemode;	/* command line option */
4933965Sjdpextern int	lmodetype;	/* Client support for linemode */
5033965Sjdp#endif	/* LINEMODE */
5133965Sjdpextern int	flowmode;	/* current flow control state */
5277303Sobrienextern int	restartany;	/* restart output on any character state */
5377303Sobrien#ifdef DIAGNOSTICS
5433965Sjdpextern int	diagnostic;	/* telnet diagnostic capabilities */
5533965Sjdp#endif /* DIAGNOSTICS */
5633965Sjdp#ifdef BFTPDAEMON
5733965Sjdpextern int	bftpd;		/* behave as bftp daemon */
5833965Sjdp#endif /* BFTPDAEMON */
5933965Sjdp#if	defined(SecurID)
6033965Sjdpextern int	require_SecurID;
6133965Sjdp#endif
6233965Sjdp#if	defined(AUTHENTICATION)
6333965Sjdpextern int	auth_level;
6433965Sjdp#endif
6533965Sjdp
6633965Sjdpextern slcfun	slctab[NSLC + 1];	/* slc mapping table */
6733965Sjdp
6833965Sjdpchar	*terminaltype;
6933965Sjdp
7033965Sjdp/*
7133965Sjdp * I/O data buffers, pointers, and counters.
7233965Sjdp */
7377303Sobrienextern char	ptyobuf[BUFSIZ+NETSLOP], *pfrontp, *pbackp;
7477303Sobrien
7533965Sjdpextern char	netibuf[BUFSIZ], *netip;
7633965Sjdp
7733965Sjdpextern char	netobuf[BUFSIZ], *nfrontp, *nbackp;
7833965Sjdpextern char	*neturg;		/* one past last bye of urgent data */
7989862Sobrien
8089862Sobrienextern int	pcc, ncc;
8133965Sjdp
8233965Sjdp#if defined(CRAY2) && defined(UNICOS5)
8333965Sjdpextern int unpcc;  /* characters left unprocessed by CRAY-2 terminal routine */
8433965Sjdpextern char *unptyip;  /* pointer to remaining characters in buffer */
8533965Sjdp#endif
8633965Sjdp
8733965Sjdpextern int	pty, net;
8833965Sjdpextern char	*line;
8933965Sjdpextern int	SYNCHing;		/* we are in TELNET SYNCH mode */
9033965Sjdp
9133965Sjdp#ifndef	P
9233965Sjdp# ifdef	__STDC__
9333965Sjdp#  define P(x)	x
9433965Sjdp# else
9533965Sjdp#  define P(x)	()
9633965Sjdp# endif
9733965Sjdp#endif
9833965Sjdp
9933965Sjdpextern void
10033965Sjdp	_termstat P((void)),
10133965Sjdp	add_slc P((int, int, int)),
10233965Sjdp	check_slc P((void)),
10333965Sjdp	change_slc P((int, int, int)),
10433965Sjdp	cleanup P((int)),
10533965Sjdp	clientstat P((int, int, int)),
10633965Sjdp	copy_termbuf P((char *, int)),
10733965Sjdp	deferslc P((void)),
10833965Sjdp	defer_terminit P((void)),
10933965Sjdp	do_opt_slc P((unsigned char *, int)),
11060510Sobrien	doeof P((void)),
11160510Sobrien	dooption P((int)),
11233965Sjdp	dontoption P((int)),
11333965Sjdp	edithost P((char *, char *)),
11433965Sjdp	fatal P((int, char *)),
11533965Sjdp	fatalperror P((int, char *)),
11660510Sobrien	get_slc_defaults P((void)),
11760510Sobrien	init_env P((void)),
11860510Sobrien	init_termbuf P((void)),
11933965Sjdp	interrupt P((void)),
12033965Sjdp	localstat P((void)),
12133965Sjdp	flowstat P((void)),
12233965Sjdp	netclear P((void)),
12333965Sjdp	netflush P((void)),
12433965Sjdp#ifdef DIAGNOSTICS
12533965Sjdp	printoption P((char *, int)),
12633965Sjdp	printdata P((char *, char *, int)),
12733965Sjdp	printsub P((int, unsigned char *, int)),
12833965Sjdp#endif
12933965Sjdp	ptyflush P((void)),
13033965Sjdp	putchr P((int)),
13133965Sjdp	putf P((char *, char *)),
13233965Sjdp	recv_ayt P((void)),
13333965Sjdp	send_do P((int, int)),
13433965Sjdp	send_dont P((int, int)),
13533965Sjdp	send_slc P((void)),
13648850Sdfr	send_status P((void)),
13748850Sdfr	send_will P((int, int)),
13860510Sobrien	send_wont P((int, int)),
13960510Sobrien	sendbrk P((void)),
14089862Sobrien	sendsusp P((void)),
14189862Sobrien	set_termbuf P((void)),
14233965Sjdp	start_login P((char *, int, char *)),
14333965Sjdp	start_slc P((int)),
14433965Sjdp#if	defined(AUTHENTICATION)
14533965Sjdp	start_slave P((char *)),
14633965Sjdp#else
14733965Sjdp	start_slave P((char *, int, char *)),
14833965Sjdp#endif
14933965Sjdp	suboption P((void)),
15033965Sjdp	telrcv P((void)),
15133965Sjdp	ttloop P((void)),
15233965Sjdp	tty_binaryin P((int)),
15333965Sjdp	tty_binaryout P((int));
15433965Sjdp
15533965Sjdpextern int
15633965Sjdp	end_slc P((unsigned char **)),
15733965Sjdp	getnpty P((void)),
15833965Sjdp#ifndef convex
15933965Sjdp	getpty P((int *)),
16033965Sjdp#endif
16133965Sjdp	login_tty P((int)),
16233965Sjdp	spcset P((int, cc_t *, cc_t **)),
16333965Sjdp	stilloob P((int)),
16433965Sjdp	terminit P((void)),
16533965Sjdp	termstat P((void)),
16633965Sjdp	tty_flowmode P((void)),
16733965Sjdp	tty_restartany P((void)),
16833965Sjdp	tty_isbinaryin P((void)),
16933965Sjdp	tty_isbinaryout P((void)),
17033965Sjdp	tty_iscrnl P((void)),
17133965Sjdp	tty_isecho P((void)),
17233965Sjdp	tty_isediting P((void)),
17333965Sjdp	tty_islitecho P((void)),
17433965Sjdp	tty_isnewmap P((void)),
17589862Sobrien	tty_israw P((void)),
17633965Sjdp	tty_issofttab P((void)),
17789862Sobrien	tty_istrapsig P((void)),
17860510Sobrien	tty_linemode P((void));
17960510Sobrien
18033965Sjdpextern void
18133965Sjdp	tty_rspeed P((int)),
18233965Sjdp	tty_setecho P((int)),
18333965Sjdp	tty_setedit P((int)),
18433965Sjdp	tty_setlinemode P((int)),
18533965Sjdp	tty_setlitecho P((int)),
18633965Sjdp	tty_setsig P((int)),
18733965Sjdp	tty_setsofttab P((int)),
18833965Sjdp	tty_tspeed P((int)),
18933965Sjdp	willoption P((int)),
19033965Sjdp	wontoption P((int));
19133965Sjdp
19289862Sobrienint	output_data __P((const char *, ...)) __printflike(1, 2);
19333965Sjdpint	output_datalen __P((const char *, size_t));
19489862Sobrien
19589862Sobrien#ifdef	ENCRYPTION
19689862Sobrienextern void	(*encrypt_output) P((unsigned char *, int));
19733965Sjdpextern int	(*decrypt_input) P((int));
19833965Sjdpextern char	*nclearto;
19933965Sjdp#endif	/* ENCRYPTION */
20033965Sjdp
20133965Sjdp
20233965Sjdp/*
20333965Sjdp * The following are some clocks used to decide how to interpret
20433965Sjdp * the relationship between various variables.
20533965Sjdp */
20633965Sjdp
20733965Sjdpextern struct {
20833965Sjdp    int
20933965Sjdp	system,			/* what the current time is */
21033965Sjdp	echotoggle,		/* last time user entered echo character */
21133965Sjdp	modenegotiated,		/* last time operating mode negotiated */
21233965Sjdp	didnetreceive,		/* last time we read data from network */
21333965Sjdp	ttypesubopt,		/* ttype subopt is received */
21433965Sjdp	tspeedsubopt,		/* tspeed subopt is received */
21533965Sjdp	environsubopt,		/* environ subopt is received */
21633965Sjdp	oenvironsubopt,		/* old environ subopt is received */
21733965Sjdp	xdisplocsubopt,		/* xdisploc subopt is received */
21833965Sjdp	baseline,		/* time started to do timed action */
21933965Sjdp	gotDM;			/* when did we last see a data mark */
22033965Sjdp} clocks;
22133965Sjdp
22233965Sjdp
22333965Sjdp#if	defined(CRAY2) && defined(UNICOS5)
22433965Sjdpextern int	needtermstat;
22533965Sjdp#endif
22633965Sjdp
22733965Sjdp#ifndef	DEFAULT_IM
22833965Sjdp# ifdef CRAY
22933965Sjdp#  define DEFAULT_IM	"\r\n\r\nCray UNICOS (%h) (%t)\r\n\r\r\n\r"
23033965Sjdp# else
23133965Sjdp#  ifdef sun
23233965Sjdp#   define DEFAULT_IM	"\r\n\r\nSunOS UNIX (%h) (%t)\r\n\r\r\n\r"
23333965Sjdp#  else
23433965Sjdp#   ifdef ultrix
23533965Sjdp#    define DEFAULT_IM	"\r\n\r\nULTRIX (%h) (%t)\r\n\r\r\n\r"
23633965Sjdp#   else
23733965Sjdp#    ifdef __FreeBSD__
23833965Sjdp#     define DEFAULT_IM  "\r\n\r\nFreeBSD (%h) (%t)\r\n\r\r\n\r"
23933965Sjdp#    else
24077303Sobrien#    define DEFAULT_IM	"\r\n\r\n4.4 BSD UNIX (%h) (%t)\r\n\r\r\n\r"
24177303Sobrien#    endif
24277303Sobrien#   endif
24377303Sobrien#  endif
24477303Sobrien# endif
24577303Sobrien#endif
24677303Sobrien