ext.h revision 79981
1/*
2 * Copyright (c) 1989, 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 * 3. All advertising materials mentioning features or use of this software
14 *    must display the following acknowledgement:
15 *	This product includes software developed by the University of
16 *	California, Berkeley and its contributors.
17 * 4. Neither the name of the University nor the names of its contributors
18 *    may be used to endorse or promote products derived from this software
19 *    without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 *	@(#)ext.h	8.2 (Berkeley) 12/15/93
34 * $FreeBSD: head/contrib/telnet/telnetd/ext.h 79981 2001-07-19 17:48:57Z ru $
35 */
36
37/*
38 * Telnet server variable declarations
39 */
40extern char	options[256];
41extern char	do_dont_resp[256];
42extern char	will_wont_resp[256];
43extern int	linemode;	/* linemode on/off */
44#ifdef	LINEMODE
45extern int	uselinemode;	/* what linemode to use (on/off) */
46extern int	editmode;	/* edit modes in use */
47extern int	useeditmode;	/* edit modes to use */
48extern int	alwayslinemode;	/* command line option */
49extern int	lmodetype;	/* Client support for linemode */
50#endif	/* LINEMODE */
51extern int	flowmode;	/* current flow control state */
52extern int	restartany;	/* restart output on any character state */
53#ifdef DIAGNOSTICS
54extern int	diagnostic;	/* telnet diagnostic capabilities */
55#endif /* DIAGNOSTICS */
56#ifdef BFTPDAEMON
57extern int	bftpd;		/* behave as bftp daemon */
58#endif /* BFTPDAEMON */
59#if	defined(SecurID)
60extern int	require_SecurID;
61#endif
62#if	defined(AUTHENTICATION)
63extern int	auth_level;
64#endif
65
66extern slcfun	slctab[NSLC + 1];	/* slc mapping table */
67
68char	*terminaltype;
69
70/*
71 * I/O data buffers, pointers, and counters.
72 */
73extern char	ptyobuf[BUFSIZ+NETSLOP], *pfrontp, *pbackp;
74
75extern char	netibuf[BUFSIZ], *netip;
76
77extern char	netobuf[BUFSIZ+NETSLOP], *nfrontp, *nbackp;
78extern char	*neturg;		/* one past last bye of urgent data */
79
80extern int	pcc, ncc;
81
82#if defined(CRAY2) && defined(UNICOS5)
83extern int unpcc;  /* characters left unprocessed by CRAY-2 terminal routine */
84extern char *unptyip;  /* pointer to remaining characters in buffer */
85#endif
86
87extern int	pty, net;
88extern char	*line;
89extern int	SYNCHing;		/* we are in TELNET SYNCH mode */
90
91#ifndef	P
92# ifdef	__STDC__
93#  define P(x)	x
94# else
95#  define P(x)	()
96# endif
97#endif
98
99extern void
100	_termstat P((void)),
101	add_slc P((int, int, int)),
102	check_slc P((void)),
103	change_slc P((int, int, int)),
104	cleanup P((int)),
105	clientstat P((int, int, int)),
106	copy_termbuf P((char *, int)),
107	deferslc P((void)),
108	defer_terminit P((void)),
109	do_opt_slc P((unsigned char *, int)),
110	doeof P((void)),
111	dooption P((int)),
112	dontoption P((int)),
113	edithost P((char *, char *)),
114	fatal P((int, char *)),
115	fatalperror P((int, char *)),
116	get_slc_defaults P((void)),
117	init_env P((void)),
118	init_termbuf P((void)),
119	interrupt P((void)),
120	localstat P((void)),
121	flowstat P((void)),
122	netclear P((void)),
123	netflush P((void)),
124#ifdef DIAGNOSTICS
125	printoption P((char *, int)),
126	printdata P((char *, char *, int)),
127	printsub P((int, unsigned char *, int)),
128#endif
129	ptyflush P((void)),
130	putchr P((int)),
131	putf P((char *, char *)),
132	recv_ayt P((void)),
133	send_do P((int, int)),
134	send_dont P((int, int)),
135	send_slc P((void)),
136	send_status P((void)),
137	send_will P((int, int)),
138	send_wont P((int, int)),
139	sendbrk P((void)),
140	sendsusp P((void)),
141	set_termbuf P((void)),
142	start_login P((char *, int, char *)),
143	start_slc P((int)),
144#if	defined(AUTHENTICATION)
145	start_slave P((char *)),
146#else
147	start_slave P((char *, int, char *)),
148#endif
149	suboption P((void)),
150	telrcv P((void)),
151	ttloop P((void)),
152	tty_binaryin P((int)),
153	tty_binaryout P((int));
154
155extern int
156	end_slc P((unsigned char **)),
157	getnpty P((void)),
158#ifndef convex
159	getpty P((int *)),
160#endif
161	login_tty P((int)),
162	spcset P((int, cc_t *, cc_t **)),
163	stilloob P((int)),
164	terminit P((void)),
165	termstat P((void)),
166	tty_flowmode P((void)),
167	tty_restartany P((void)),
168	tty_isbinaryin P((void)),
169	tty_isbinaryout P((void)),
170	tty_iscrnl P((void)),
171	tty_isecho P((void)),
172	tty_isediting P((void)),
173	tty_islitecho P((void)),
174	tty_isnewmap P((void)),
175	tty_israw P((void)),
176	tty_issofttab P((void)),
177	tty_istrapsig P((void)),
178	tty_linemode P((void));
179
180extern void
181	tty_rspeed P((int)),
182	tty_setecho P((int)),
183	tty_setedit P((int)),
184	tty_setlinemode P((int)),
185	tty_setlitecho P((int)),
186	tty_setsig P((int)),
187	tty_setsofttab P((int)),
188	tty_tspeed P((int)),
189	willoption P((int)),
190	wontoption P((int)),
191	writenet P((unsigned char *, int));
192
193int	output_data __P((const char *, ...)) __printflike(1, 2);
194int	output_datalen __P((const char *, size_t));
195
196#ifdef	ENCRYPTION
197extern void	(*encrypt_output) P((unsigned char *, int));
198extern int	(*decrypt_input) P((int));
199extern char	*nclearto;
200#endif	/* ENCRYPTION */
201
202
203/*
204 * The following are some clocks used to decide how to interpret
205 * the relationship between various variables.
206 */
207
208extern struct {
209    int
210	system,			/* what the current time is */
211	echotoggle,		/* last time user entered echo character */
212	modenegotiated,		/* last time operating mode negotiated */
213	didnetreceive,		/* last time we read data from network */
214	ttypesubopt,		/* ttype subopt is received */
215	tspeedsubopt,		/* tspeed subopt is received */
216	environsubopt,		/* environ subopt is received */
217	oenvironsubopt,		/* old environ subopt is received */
218	xdisplocsubopt,		/* xdisploc subopt is received */
219	baseline,		/* time started to do timed action */
220	gotDM;			/* when did we last see a data mark */
221} clocks;
222
223
224#if	defined(CRAY2) && defined(UNICOS5)
225extern int	needtermstat;
226#endif
227
228#ifndef	DEFAULT_IM
229# ifdef CRAY
230#  define DEFAULT_IM	"\r\n\r\nCray UNICOS (%h) (%t)\r\n\r\r\n\r"
231# else
232#  ifdef sun
233#   define DEFAULT_IM	"\r\n\r\nSunOS UNIX (%h) (%t)\r\n\r\r\n\r"
234#  else
235#   ifdef ultrix
236#    define DEFAULT_IM	"\r\n\r\nULTRIX (%h) (%t)\r\n\r\r\n\r"
237#   else
238#    ifdef __FreeBSD__
239#     define DEFAULT_IM  "\r\n\r\nFreeBSD (%h) (%t)\r\n\r\r\n\r"
240#    else
241#    define DEFAULT_IM	"\r\n\r\n4.4 BSD UNIX (%h) (%t)\r\n\r\r\n\r"
242#    endif
243#   endif
244#  endif
245# endif
246#endif
247