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