ext.h revision 87139
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 87139 2001-11-30 21:06:38Z markm $
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#ifdef	AUTHENTICATION
60extern int	auth_level;
61#endif
62
63extern slcfun	slctab[NSLC + 1];	/* slc mapping table */
64
65char	*terminaltype;
66
67/*
68 * I/O data buffers, pointers, and counters.
69 */
70extern char	ptyobuf[BUFSIZ+NETSLOP], *pfrontp, *pbackp;
71
72extern char	netibuf[BUFSIZ], *netip;
73
74extern char	netobuf[BUFSIZ], *nfrontp, *nbackp;
75extern char	*neturg;		/* one past last bye of urgent data */
76
77extern int	pcc, ncc;
78
79extern int	pty, net;
80extern char	line[16];
81extern int	SYNCHing;		/* we are in TELNET SYNCH mode */
82
83#ifndef	P
84# ifdef	__STDC__
85#  define P(x)	x
86# else
87#  define P(x)	()
88# endif
89#endif
90
91extern void
92	_termstat P((void)),
93	add_slc P((char, char, cc_t)),
94	check_slc P((void)),
95	change_slc P((char, char, cc_t)),
96	cleanup P((int)),
97	clientstat P((int, int, int)),
98	copy_termbuf P((char *, size_t)),
99	deferslc P((void)),
100	defer_terminit P((void)),
101	do_opt_slc P((unsigned char *, int)),
102	doeof P((void)),
103	dooption P((int)),
104	dontoption P((int)),
105	edithost P((char *, char *)),
106	fatal P((int, const char *)),
107	fatalperror P((int, const char *)),
108	get_slc_defaults P((void)),
109	init_env P((void)),
110	init_termbuf P((void)),
111	interrupt P((void)),
112	localstat P((void)),
113	flowstat P((void)),
114	netclear P((void)),
115	netflush P((void)),
116#ifdef DIAGNOSTICS
117	printoption P((const char *, int)),
118	printdata P((const char *, char *, int)),
119	printsub P((char, unsigned char *, int)),
120#endif
121	process_slc P((unsigned char, unsigned char, cc_t)),
122	ptyflush P((void)),
123	putchr P((int)),
124	putf P((char *, char *)),
125	recv_ayt P((void)),
126	send_do P((int, int)),
127	send_dont P((int, int)),
128	send_slc P((void)),
129	send_status P((void)),
130	send_will P((int, int)),
131	send_wont P((int, int)),
132	sendbrk P((void)),
133	sendsusp P((void)),
134	set_termbuf P((void)),
135	start_login P((char *, int, char *)),
136	start_slc P((int)),
137#ifdef	AUTHENTICATION
138	start_slave P((char *)),
139#else
140	start_slave P((char *, int, char *)),
141#endif
142	suboption P((void)),
143	telrcv P((void)),
144	ttloop P((void)),
145	tty_binaryin P((int)),
146	tty_binaryout P((int));
147
148extern int
149	end_slc P((unsigned char **)),
150	getnpty P((void)),
151#ifndef convex
152	getpty P((int *)),
153#endif
154	login_tty P((int)),
155	spcset P((int, cc_t *, cc_t **)),
156	stilloob P((int)),
157	terminit P((void)),
158	termstat P((void)),
159	tty_flowmode P((void)),
160	tty_restartany P((void)),
161	tty_isbinaryin P((void)),
162	tty_isbinaryout P((void)),
163	tty_iscrnl P((void)),
164	tty_isecho P((void)),
165	tty_isediting P((void)),
166	tty_islitecho P((void)),
167	tty_isnewmap P((void)),
168	tty_israw P((void)),
169	tty_issofttab P((void)),
170	tty_istrapsig P((void)),
171	tty_linemode P((void));
172
173extern void
174	tty_rspeed P((int)),
175	tty_setecho P((int)),
176	tty_setedit P((int)),
177	tty_setlinemode P((int)),
178	tty_setlitecho P((int)),
179	tty_setsig P((int)),
180	tty_setsofttab P((int)),
181	tty_tspeed P((int)),
182	willoption P((int)),
183	wontoption P((int));
184
185int	output_data __P((const char *, ...)) __printflike(1, 2);
186void	output_datalen __P((const char *, int));
187void	startslave __P((char *, int, char *));
188
189#ifdef	ENCRYPTION
190extern void	(*encrypt_output) P((unsigned char *, int));
191extern int	(*decrypt_input) P((int));
192extern char	*nclearto;
193#endif	/* ENCRYPTION */
194
195
196/*
197 * The following are some clocks used to decide how to interpret
198 * the relationship between various variables.
199 */
200
201extern struct {
202    int
203	system,			/* what the current time is */
204	echotoggle,		/* last time user entered echo character */
205	modenegotiated,		/* last time operating mode negotiated */
206	didnetreceive,		/* last time we read data from network */
207	ttypesubopt,		/* ttype subopt is received */
208	tspeedsubopt,		/* tspeed subopt is received */
209	environsubopt,		/* environ subopt is received */
210	oenvironsubopt,		/* old environ subopt is received */
211	xdisplocsubopt,		/* xdisploc subopt is received */
212	baseline,		/* time started to do timed action */
213	gotDM;			/* when did we last see a data mark */
214} clocks;
215
216#ifndef	DEFAULT_IM
217#   ifdef ultrix
218#    define DEFAULT_IM	"\r\n\r\nULTRIX (%h) (%t)\r\n\r\r\n\r"
219#   else
220#    ifdef __FreeBSD__
221#     define DEFAULT_IM  "\r\n\r\nFreeBSD (%h) (%t)\r\n\r\r\n\r"
222#    else
223#    define DEFAULT_IM	"\r\n\r\n4.4 BSD UNIX (%h) (%t)\r\n\r\r\n\r"
224#    endif
225#   endif
226#endif
227