kernel - Fix broken assertion for "pv->pv_m != NULL" panic
[dragonfly.git] / usr.bin / telnet / externs.h
blob2aa08f73ca814484a31366b7225fc48b074d1252
1 /*
2 * Copyright (c) 1988, 1990, 1993
3 * The Regents of the University of California. All rights reserved.
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. Neither the name of the University nor the names of its contributors
14 * may be used to endorse or promote products derived from this software
15 * without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
29 * @(#)externs.h 8.3 (Berkeley) 5/30/95
30 * $FreeBSD: src/crypto/telnet/telnet/externs.h,v 1.4.2.2 2002/04/13 10:59:08 markm Exp $
33 #ifndef BSD
34 # define BSD 43
35 #endif
38 * ucb stdio.h defines BSD as something weird
40 #if defined(sun) && defined(__svr4__)
41 #define BSD 43
42 #endif
44 #ifndef USE_TERMIO
45 # if BSD > 43 || defined(SYSV_TERMIO)
46 # define USE_TERMIO
47 # endif
48 #endif
50 #include <stdio.h>
51 #include <setjmp.h>
52 #include <sys/ioctl.h>
53 #include <errno.h>
54 #ifdef USE_TERMIO
55 # ifndef VINTR
56 # include <termios.h>
57 # endif
58 # define termio termios
59 #endif
60 #if defined(NO_CC_T) || !defined(USE_TERMIO)
61 # if !defined(USE_TERMIO)
62 typedef char cc_t;
63 # else
64 typedef unsigned char cc_t;
65 # endif
66 #endif
68 #include <string.h>
70 #if defined(IPSEC)
71 #include <netinet6/ipsec.h>
72 #if defined(IPSEC_POLICY_IPSEC)
73 extern char *ipsec_policy_in;
74 extern char *ipsec_policy_out;
75 #endif
76 #endif
78 #ifndef _POSIX_VDISABLE
79 # ifdef sun
80 # include <sys/param.h> /* pick up VDISABLE definition, mayby */
81 # endif
82 # ifdef VDISABLE
83 # define _POSIX_VDISABLE VDISABLE
84 # else
85 # define _POSIX_VDISABLE ((cc_t)'\377')
86 # endif
87 #endif
89 #define SUBBUFSIZE 256
91 extern int
92 autologin, /* Autologin enabled */
93 skiprc, /* Don't process the ~/.telnetrc file */
94 eight, /* use eight bit mode (binary in and/or out */
95 family, /* address family of peer */
96 flushout, /* flush output */
97 connected, /* Are we connected to the other side? */
98 globalmode, /* Mode tty should be in */
99 telnetport, /* Are we connected to the telnet port? */
100 localflow, /* Flow control handled locally */
101 restartany, /* If flow control, restart output on any character */
102 localchars, /* we recognize interrupt/quit */
103 donelclchars, /* the user has set "localchars" */
104 showoptions,
105 net, /* Network file descriptor */
106 tin, /* Terminal input file descriptor */
107 tout, /* Terminal output file descriptor */
108 crlf, /* Should '\r' be mapped to <CR><LF> (or <CR><NUL>)? */
109 autoflush, /* flush output when interrupting? */
110 autosynch, /* send interrupt characters with SYNCH? */
111 SYNCHing, /* Is the stream in telnet SYNCH mode? */
112 donebinarytoggle, /* the user has put us in binary */
113 dontlecho, /* do we suppress local echoing right now? */
114 crmod,
115 netdata, /* Print out network data flow */
116 prettydump, /* Print "netdata" output in user readable format */
117 termdata, /* Print out terminal data flow */
118 debug, /* Debug level */
119 doaddrlookup, /* do a reverse lookup? */
120 clienteof; /* Client received EOF */
122 extern cc_t escape; /* Escape to command mode */
123 extern cc_t rlogin; /* Rlogin mode escape character */
124 #ifdef KLUDGELINEMODE
125 extern cc_t echoc; /* Toggle local echoing */
126 #endif
128 extern char
129 *prompt; /* Prompt for command. */
131 extern char
132 doopt[],
133 dont[],
134 will[],
135 wont[],
136 options[], /* All the little options */
137 *hostname; /* Who are we connected to? */
138 #ifdef ENCRYPTION
139 extern void (*encrypt_output)(unsigned char *, int);
140 extern int (*decrypt_input)(int);
141 #endif /* ENCRYPTION */
144 * We keep track of each side of the option negotiation.
147 #define MY_STATE_WILL 0x01
148 #define MY_WANT_STATE_WILL 0x02
149 #define MY_STATE_DO 0x04
150 #define MY_WANT_STATE_DO 0x08
153 * Macros to check the current state of things
156 #define my_state_is_do(opt) (options[opt]&MY_STATE_DO)
157 #define my_state_is_will(opt) (options[opt]&MY_STATE_WILL)
158 #define my_want_state_is_do(opt) (options[opt]&MY_WANT_STATE_DO)
159 #define my_want_state_is_will(opt) (options[opt]&MY_WANT_STATE_WILL)
161 #define my_state_is_dont(opt) (!my_state_is_do(opt))
162 #define my_state_is_wont(opt) (!my_state_is_will(opt))
163 #define my_want_state_is_dont(opt) (!my_want_state_is_do(opt))
164 #define my_want_state_is_wont(opt) (!my_want_state_is_will(opt))
166 #define set_my_state_do(opt) {options[opt] |= MY_STATE_DO;}
167 #define set_my_state_will(opt) {options[opt] |= MY_STATE_WILL;}
168 #define set_my_want_state_do(opt) {options[opt] |= MY_WANT_STATE_DO;}
169 #define set_my_want_state_will(opt) {options[opt] |= MY_WANT_STATE_WILL;}
171 #define set_my_state_dont(opt) {options[opt] &= ~MY_STATE_DO;}
172 #define set_my_state_wont(opt) {options[opt] &= ~MY_STATE_WILL;}
173 #define set_my_want_state_dont(opt) {options[opt] &= ~MY_WANT_STATE_DO;}
174 #define set_my_want_state_wont(opt) {options[opt] &= ~MY_WANT_STATE_WILL;}
177 * Make everything symetrical
180 #define HIS_STATE_WILL MY_STATE_DO
181 #define HIS_WANT_STATE_WILL MY_WANT_STATE_DO
182 #define HIS_STATE_DO MY_STATE_WILL
183 #define HIS_WANT_STATE_DO MY_WANT_STATE_WILL
185 #define his_state_is_do my_state_is_will
186 #define his_state_is_will my_state_is_do
187 #define his_want_state_is_do my_want_state_is_will
188 #define his_want_state_is_will my_want_state_is_do
190 #define his_state_is_dont my_state_is_wont
191 #define his_state_is_wont my_state_is_dont
192 #define his_want_state_is_dont my_want_state_is_wont
193 #define his_want_state_is_wont my_want_state_is_dont
195 #define set_his_state_do set_my_state_will
196 #define set_his_state_will set_my_state_do
197 #define set_his_want_state_do set_my_want_state_will
198 #define set_his_want_state_will set_my_want_state_do
200 #define set_his_state_dont set_my_state_wont
201 #define set_his_state_wont set_my_state_dont
202 #define set_his_want_state_dont set_my_want_state_wont
203 #define set_his_want_state_wont set_my_want_state_dont
205 #if defined(USE_TERMIO)
206 #define SIG_FUNC_RET void
207 #else
208 #define SIG_FUNC_RET int
209 #endif
211 #ifdef SIGINFO
212 extern SIG_FUNC_RET
213 ayt_status(void);
214 #endif
216 extern FILE
217 *NetTrace; /* Where debugging output goes */
218 extern unsigned char
219 NetTraceFile[]; /* Name of file where debugging output goes */
220 extern void
221 SetNetTrace(char *); /* Function to change where debugging goes */
223 extern jmp_buf
224 peerdied,
225 toplevel; /* For error conditions. */
227 extern void
228 command(int, const char *, int),
229 Dump(char, unsigned char *, int),
230 env_init(void),
231 Exit(int),
232 ExitString(const char *, int),
233 init_network(void),
234 init_sys(void),
235 init_telnet(void),
236 init_terminal(void),
237 intp(void),
238 optionstatus(void),
239 printoption(const char *, int, int),
240 printsub(char, unsigned char *, int),
241 quit(void),
242 sendabort(void),
243 sendbrk(void),
244 sendeof(void),
245 sendsusp(void),
246 sendnaws(void),
247 sendayt(void),
248 setconnmode(int),
249 setcommandmode(void),
250 set_escape_char(char *s),
251 setneturg(void),
252 sys_telnet_init(void),
253 telnet(char *),
254 tel_enter_binary(int),
255 tel_leave_binary(int),
256 TerminalFlushOutput(void),
257 TerminalNewMode(int),
258 TerminalRestoreState(void),
259 TerminalSaveState(void),
260 TerminalDefaultChars(void),
261 TerminalSpeeds(long *, long *),
262 tninit(void),
263 upcase(char *),
264 willoption(int),
265 wontoption(int);
267 extern void
268 send_do(int, int),
269 send_dont(int, int),
270 send_will(int, int),
271 send_wont(int, int);
273 extern void
274 lm_will(unsigned char *, int),
275 lm_wont(unsigned char *, int),
276 lm_do(unsigned char *, int),
277 lm_dont(unsigned char *, int),
278 lm_mode(unsigned char *, int, int);
280 extern void
281 slc_init(void),
282 slcstate(void),
283 slc_mode_export(void),
284 slc_mode_import(int),
285 slc_import(int),
286 slc_export(void),
287 slc(unsigned char *, int),
288 slc_check(void),
289 slc_start_reply(void),
290 slc_add_reply(unsigned char, unsigned char, cc_t),
291 slc_end_reply(void);
292 extern int
293 getconnmode(void),
294 opt_welldefined(const char *),
295 NetClose(int),
296 netflush(void),
297 process_rings(int, int, int, int, int, int),
298 rlogin_susp(void),
299 SetSockOpt(int, int, int, int),
300 slc_update(void),
301 stilloob(void),
302 telrcv(void),
303 TerminalRead(char *, int),
304 TerminalWrite(char *, int),
305 TerminalAutoFlush(void),
306 TerminalWindowSize(long *, long *),
307 TerminalSpecialChars(int),
308 tn(int, char **),
309 ttyflush(int);
311 extern void
312 env_opt(unsigned char *, int),
313 env_opt_start(void),
314 env_opt_start_info(void),
315 env_opt_add(unsigned char *),
316 env_opt_end(int);
318 extern unsigned char
319 *env_default(int, int),
320 *env_getvalue(const unsigned char *);
322 extern int
323 get_status(char *),
324 dosynch(char *);
326 extern cc_t
327 *tcval(int);
329 #ifndef USE_TERMIO
331 extern struct tchars ntc;
332 extern struct ltchars nltc;
333 extern struct sgttyb nttyb;
335 # define termEofChar ntc.t_eofc
336 # define termEraseChar nttyb.sg_erase
337 # define termFlushChar nltc.t_flushc
338 # define termIntChar ntc.t_intrc
339 # define termKillChar nttyb.sg_kill
340 # define termLiteralNextChar nltc.t_lnextc
341 # define termQuitChar ntc.t_quitc
342 # define termSuspChar nltc.t_suspc
343 # define termRprntChar nltc.t_rprntc
344 # define termWerasChar nltc.t_werasc
345 # define termStartChar ntc.t_startc
346 # define termStopChar ntc.t_stopc
347 # define termForw1Char ntc.t_brkc
348 extern cc_t termForw2Char;
349 extern cc_t termAytChar;
351 # define termEofCharp (cc_t *)&ntc.t_eofc
352 # define termEraseCharp (cc_t *)&nttyb.sg_erase
353 # define termFlushCharp (cc_t *)&nltc.t_flushc
354 # define termIntCharp (cc_t *)&ntc.t_intrc
355 # define termKillCharp (cc_t *)&nttyb.sg_kill
356 # define termLiteralNextCharp (cc_t *)&nltc.t_lnextc
357 # define termQuitCharp (cc_t *)&ntc.t_quitc
358 # define termSuspCharp (cc_t *)&nltc.t_suspc
359 # define termRprntCharp (cc_t *)&nltc.t_rprntc
360 # define termWerasCharp (cc_t *)&nltc.t_werasc
361 # define termStartCharp (cc_t *)&ntc.t_startc
362 # define termStopCharp (cc_t *)&ntc.t_stopc
363 # define termForw1Charp (cc_t *)&ntc.t_brkc
364 # define termForw2Charp (cc_t *)&termForw2Char
365 # define termAytCharp (cc_t *)&termAytChar
367 # else
369 extern struct termio new_tc;
371 # define termEofChar new_tc.c_cc[VEOF]
372 # define termEraseChar new_tc.c_cc[VERASE]
373 # define termIntChar new_tc.c_cc[VINTR]
374 # define termKillChar new_tc.c_cc[VKILL]
375 # define termQuitChar new_tc.c_cc[VQUIT]
377 # ifndef VSUSP
378 extern cc_t termSuspChar;
379 # else
380 # define termSuspChar new_tc.c_cc[VSUSP]
381 # endif
382 # if defined(VFLUSHO) && !defined(VDISCARD)
383 # define VDISCARD VFLUSHO
384 # endif
385 # ifndef VDISCARD
386 extern cc_t termFlushChar;
387 # else
388 # define termFlushChar new_tc.c_cc[VDISCARD]
389 # endif
390 # ifndef VWERASE
391 extern cc_t termWerasChar;
392 # else
393 # define termWerasChar new_tc.c_cc[VWERASE]
394 # endif
395 # ifndef VREPRINT
396 extern cc_t termRprntChar;
397 # else
398 # define termRprntChar new_tc.c_cc[VREPRINT]
399 # endif
400 # ifndef VLNEXT
401 extern cc_t termLiteralNextChar;
402 # else
403 # define termLiteralNextChar new_tc.c_cc[VLNEXT]
404 # endif
405 # ifndef VSTART
406 extern cc_t termStartChar;
407 # else
408 # define termStartChar new_tc.c_cc[VSTART]
409 # endif
410 # ifndef VSTOP
411 extern cc_t termStopChar;
412 # else
413 # define termStopChar new_tc.c_cc[VSTOP]
414 # endif
415 # ifndef VEOL
416 extern cc_t termForw1Char;
417 # else
418 # define termForw1Char new_tc.c_cc[VEOL]
419 # endif
420 # ifndef VEOL2
421 extern cc_t termForw2Char;
422 # else
423 # define termForw2Char new_tc.c_cc[VEOL]
424 # endif
425 # ifndef VSTATUS
426 extern cc_t termAytChar;
427 #else
428 # define termAytChar new_tc.c_cc[VSTATUS]
429 #endif
431 # if defined(__STDC__)
432 # define termEofCharp &termEofChar
433 # define termEraseCharp &termEraseChar
434 # define termIntCharp &termIntChar
435 # define termKillCharp &termKillChar
436 # define termQuitCharp &termQuitChar
437 # define termSuspCharp &termSuspChar
438 # define termFlushCharp &termFlushChar
439 # define termWerasCharp &termWerasChar
440 # define termRprntCharp &termRprntChar
441 # define termLiteralNextCharp &termLiteralNextChar
442 # define termStartCharp &termStartChar
443 # define termStopCharp &termStopChar
444 # define termForw1Charp &termForw1Char
445 # define termForw2Charp &termForw2Char
446 # define termAytCharp &termAytChar
447 # else
448 /* Work around a compiler bug */
449 # define termEofCharp 0
450 # define termEraseCharp 0
451 # define termIntCharp 0
452 # define termKillCharp 0
453 # define termQuitCharp 0
454 # define termSuspCharp 0
455 # define termFlushCharp 0
456 # define termWerasCharp 0
457 # define termRprntCharp 0
458 # define termLiteralNextCharp 0
459 # define termStartCharp 0
460 # define termStopCharp 0
461 # define termForw1Charp 0
462 # define termForw2Charp 0
463 # define termAytCharp 0
464 # endif
465 #endif
468 /* Ring buffer structures which are shared */
470 extern Ring
471 netoring,
472 netiring,
473 ttyoring,
474 ttyiring;
476 extern void
477 xmitAO(void),
478 xmitEC(void),
479 xmitEL(void);