Annotation of src/usr.bin/telnet/externs.h, Revision 1.1
1.1 ! deraadt 1: /*
! 2: * Copyright (c) 1988, 1990, 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: * from: @(#)externs.h 8.1 (Berkeley) 6/6/93
! 34: * $Id: externs.h,v 1.5 1995/03/17 18:03:06 mycroft Exp $
! 35: */
! 36:
! 37: #ifndef BSD
! 38: # define BSD 43
! 39: #endif
! 40:
! 41: /*
! 42: * ucb stdio.h defines BSD as something wierd
! 43: */
! 44: #if defined(sun) && defined(__svr4__)
! 45: #define BSD 43
! 46: #endif
! 47:
! 48: #ifndef USE_TERMIO
! 49: # if BSD > 43 || defined(SYSV_TERMIO)
! 50: # define USE_TERMIO
! 51: # endif
! 52: #endif
! 53:
! 54: #include <stdio.h>
! 55: #include <stdlib.h>
! 56: #include <setjmp.h>
! 57: #if defined(CRAY) && !defined(NO_BSD_SETJMP)
! 58: #include <bsdsetjmp.h>
! 59: #endif
! 60: #ifndef FILIO_H
! 61: #include <sys/ioctl.h>
! 62: #else
! 63: #include <sys/filio.h>
! 64: #endif
! 65: #ifdef CRAY
! 66: # include <errno.h>
! 67: #endif /* CRAY */
! 68: #ifdef USE_TERMIO
! 69: # ifndef VINTR
! 70: # ifdef SYSV_TERMIO
! 71: # include <sys/termio.h>
! 72: # else
! 73: # include <sys/termios.h>
! 74: # define termio termios
! 75: # endif
! 76: # endif
! 77: #endif
! 78: #if defined(NO_CC_T) || !defined(USE_TERMIO)
! 79: # if !defined(USE_TERMIO)
! 80: typedef char cc_t;
! 81: # else
! 82: typedef unsigned char cc_t;
! 83: # endif
! 84: #endif
! 85:
! 86: #ifndef NO_STRING_H
! 87: #include <string.h>
! 88: #endif
! 89: #include <strings.h>
! 90:
! 91: #ifndef _POSIX_VDISABLE
! 92: # ifdef sun
! 93: # include <sys/param.h> /* pick up VDISABLE definition, mayby */
! 94: # endif
! 95: # ifdef VDISABLE
! 96: # define _POSIX_VDISABLE VDISABLE
! 97: # else
! 98: # define _POSIX_VDISABLE ((cc_t)'\377')
! 99: # endif
! 100: #endif
! 101:
! 102: #define SUBBUFSIZE 256
! 103:
! 104: #ifndef CRAY
! 105: extern int errno; /* outside this world */
! 106: #endif /* !CRAY */
! 107:
! 108: #if !defined(P)
! 109: # ifdef __STDC__
! 110: # define P(x) x
! 111: # else
! 112: # define P(x) ()
! 113: # endif
! 114: #endif
! 115:
! 116: extern int
! 117: autologin, /* Autologin enabled */
! 118: skiprc, /* Don't process the ~/.telnetrc file */
! 119: eight, /* use eight bit mode (binary in and/or out */
! 120: flushout, /* flush output */
! 121: connected, /* Are we connected to the other side? */
! 122: globalmode, /* Mode tty should be in */
! 123: In3270, /* Are we in 3270 mode? */
! 124: telnetport, /* Are we connected to the telnet port? */
! 125: localflow, /* Flow control handled locally */
! 126: restartany, /* If flow control, restart output on any character */
! 127: localchars, /* we recognize interrupt/quit */
! 128: donelclchars, /* the user has set "localchars" */
! 129: showoptions,
! 130: net, /* Network file descriptor */
! 131: tin, /* Terminal input file descriptor */
! 132: tout, /* Terminal output file descriptor */
! 133: crlf, /* Should '\r' be mapped to <CR><LF> (or <CR><NUL>)? */
! 134: autoflush, /* flush output when interrupting? */
! 135: autosynch, /* send interrupt characters with SYNCH? */
! 136: SYNCHing, /* Is the stream in telnet SYNCH mode? */
! 137: donebinarytoggle, /* the user has put us in binary */
! 138: dontlecho, /* do we suppress local echoing right now? */
! 139: crmod,
! 140: netdata, /* Print out network data flow */
! 141: prettydump, /* Print "netdata" output in user readable format */
! 142: #if defined(unix)
! 143: #if defined(TN3270)
! 144: cursesdata, /* Print out curses data flow */
! 145: apitrace, /* Trace API transactions */
! 146: #endif /* defined(TN3270) */
! 147: termdata, /* Print out terminal data flow */
! 148: #endif /* defined(unix) */
! 149: debug, /* Debug level */
! 150: clienteof; /* Client received EOF */
! 151:
! 152: extern cc_t escape; /* Escape to command mode */
! 153: extern cc_t rlogin; /* Rlogin mode escape character */
! 154: #ifdef KLUDGELINEMODE
! 155: extern cc_t echoc; /* Toggle local echoing */
! 156: #endif
! 157:
! 158: extern char
! 159: *prompt; /* Prompt for command. */
! 160:
! 161: extern char
! 162: doopt[],
! 163: dont[],
! 164: will[],
! 165: wont[],
! 166: options[], /* All the little options */
! 167: *hostname; /* Who are we connected to? */
! 168:
! 169: /*
! 170: * We keep track of each side of the option negotiation.
! 171: */
! 172:
! 173: #define MY_STATE_WILL 0x01
! 174: #define MY_WANT_STATE_WILL 0x02
! 175: #define MY_STATE_DO 0x04
! 176: #define MY_WANT_STATE_DO 0x08
! 177:
! 178: /*
! 179: * Macros to check the current state of things
! 180: */
! 181:
! 182: #define my_state_is_do(opt) (options[opt]&MY_STATE_DO)
! 183: #define my_state_is_will(opt) (options[opt]&MY_STATE_WILL)
! 184: #define my_want_state_is_do(opt) (options[opt]&MY_WANT_STATE_DO)
! 185: #define my_want_state_is_will(opt) (options[opt]&MY_WANT_STATE_WILL)
! 186:
! 187: #define my_state_is_dont(opt) (!my_state_is_do(opt))
! 188: #define my_state_is_wont(opt) (!my_state_is_will(opt))
! 189: #define my_want_state_is_dont(opt) (!my_want_state_is_do(opt))
! 190: #define my_want_state_is_wont(opt) (!my_want_state_is_will(opt))
! 191:
! 192: #define set_my_state_do(opt) {options[opt] |= MY_STATE_DO;}
! 193: #define set_my_state_will(opt) {options[opt] |= MY_STATE_WILL;}
! 194: #define set_my_want_state_do(opt) {options[opt] |= MY_WANT_STATE_DO;}
! 195: #define set_my_want_state_will(opt) {options[opt] |= MY_WANT_STATE_WILL;}
! 196:
! 197: #define set_my_state_dont(opt) {options[opt] &= ~MY_STATE_DO;}
! 198: #define set_my_state_wont(opt) {options[opt] &= ~MY_STATE_WILL;}
! 199: #define set_my_want_state_dont(opt) {options[opt] &= ~MY_WANT_STATE_DO;}
! 200: #define set_my_want_state_wont(opt) {options[opt] &= ~MY_WANT_STATE_WILL;}
! 201:
! 202: /*
! 203: * Make everything symetrical
! 204: */
! 205:
! 206: #define HIS_STATE_WILL MY_STATE_DO
! 207: #define HIS_WANT_STATE_WILL MY_WANT_STATE_DO
! 208: #define HIS_STATE_DO MY_STATE_WILL
! 209: #define HIS_WANT_STATE_DO MY_WANT_STATE_WILL
! 210:
! 211: #define his_state_is_do my_state_is_will
! 212: #define his_state_is_will my_state_is_do
! 213: #define his_want_state_is_do my_want_state_is_will
! 214: #define his_want_state_is_will my_want_state_is_do
! 215:
! 216: #define his_state_is_dont my_state_is_wont
! 217: #define his_state_is_wont my_state_is_dont
! 218: #define his_want_state_is_dont my_want_state_is_wont
! 219: #define his_want_state_is_wont my_want_state_is_dont
! 220:
! 221: #define set_his_state_do set_my_state_will
! 222: #define set_his_state_will set_my_state_do
! 223: #define set_his_want_state_do set_my_want_state_will
! 224: #define set_his_want_state_will set_my_want_state_do
! 225:
! 226: #define set_his_state_dont set_my_state_wont
! 227: #define set_his_state_wont set_my_state_dont
! 228: #define set_his_want_state_dont set_my_want_state_wont
! 229: #define set_his_want_state_wont set_my_want_state_dont
! 230:
! 231:
! 232: extern FILE
! 233: *NetTrace; /* Where debugging output goes */
! 234: extern unsigned char
! 235: NetTraceFile[]; /* Name of file where debugging output goes */
! 236: extern void
! 237: SetNetTrace P((char *)); /* Function to change where debugging goes */
! 238:
! 239: extern jmp_buf
! 240: peerdied,
! 241: toplevel; /* For error conditions. */
! 242:
! 243: extern void
! 244: command P((int, char *, int)),
! 245: Dump P((int, unsigned char *, int)),
! 246: init_3270 P((void)),
! 247: printoption P((char *, int, int)),
! 248: printsub P((int, unsigned char *, int)),
! 249: sendnaws P((void)),
! 250: setconnmode P((int)),
! 251: setcommandmode P((void)),
! 252: setneturg P((void)),
! 253: sys_telnet_init P((void)),
! 254: telnet P((char *)),
! 255: tel_enter_binary P((int)),
! 256: TerminalFlushOutput P((void)),
! 257: TerminalNewMode P((int)),
! 258: TerminalRestoreState P((void)),
! 259: TerminalSaveState P((void)),
! 260: tninit P((void)),
! 261: upcase P((char *)),
! 262: willoption P((int)),
! 263: wontoption P((int));
! 264:
! 265: extern void
! 266: send_do P((int, int)),
! 267: send_dont P((int, int)),
! 268: send_will P((int, int)),
! 269: send_wont P((int, int));
! 270:
! 271: extern void
! 272: lm_will P((unsigned char *, int)),
! 273: lm_wont P((unsigned char *, int)),
! 274: lm_do P((unsigned char *, int)),
! 275: lm_dont P((unsigned char *, int)),
! 276: lm_mode P((unsigned char *, int, int));
! 277:
! 278: extern void
! 279: slc_init P((void)),
! 280: slcstate P((void)),
! 281: slc_mode_export P((void)),
! 282: slc_mode_import P((int)),
! 283: slc_import P((int)),
! 284: slc_export P((void)),
! 285: slc P((unsigned char *, int)),
! 286: slc_check P((void)),
! 287: slc_start_reply P((void)),
! 288: slc_add_reply P((int, int, int)),
! 289: slc_end_reply P((void));
! 290: extern int
! 291: slc_update P((void));
! 292:
! 293: extern void
! 294: env_opt P((unsigned char *, int)),
! 295: env_opt_start P((void)),
! 296: env_opt_start_info P((void)),
! 297: env_opt_add P((unsigned char *)),
! 298: env_opt_end P((int));
! 299:
! 300: extern unsigned char
! 301: *env_default P((int, int)),
! 302: *env_getvalue P((unsigned char *));
! 303:
! 304: extern int
! 305: get_status P((void)),
! 306: dosynch P((void));
! 307:
! 308: extern cc_t
! 309: *tcval P((int));
! 310:
! 311: #ifndef USE_TERMIO
! 312:
! 313: extern struct tchars ntc;
! 314: extern struct ltchars nltc;
! 315: extern struct sgttyb nttyb;
! 316:
! 317: # define termEofChar ntc.t_eofc
! 318: # define termEraseChar nttyb.sg_erase
! 319: # define termFlushChar nltc.t_flushc
! 320: # define termIntChar ntc.t_intrc
! 321: # define termKillChar nttyb.sg_kill
! 322: # define termLiteralNextChar nltc.t_lnextc
! 323: # define termQuitChar ntc.t_quitc
! 324: # define termSuspChar nltc.t_suspc
! 325: # define termRprntChar nltc.t_rprntc
! 326: # define termWerasChar nltc.t_werasc
! 327: # define termStartChar ntc.t_startc
! 328: # define termStopChar ntc.t_stopc
! 329: # define termForw1Char ntc.t_brkc
! 330: extern cc_t termForw2Char;
! 331: extern cc_t termAytChar;
! 332:
! 333: # define termEofCharp (cc_t *)&ntc.t_eofc
! 334: # define termEraseCharp (cc_t *)&nttyb.sg_erase
! 335: # define termFlushCharp (cc_t *)&nltc.t_flushc
! 336: # define termIntCharp (cc_t *)&ntc.t_intrc
! 337: # define termKillCharp (cc_t *)&nttyb.sg_kill
! 338: # define termLiteralNextCharp (cc_t *)&nltc.t_lnextc
! 339: # define termQuitCharp (cc_t *)&ntc.t_quitc
! 340: # define termSuspCharp (cc_t *)&nltc.t_suspc
! 341: # define termRprntCharp (cc_t *)&nltc.t_rprntc
! 342: # define termWerasCharp (cc_t *)&nltc.t_werasc
! 343: # define termStartCharp (cc_t *)&ntc.t_startc
! 344: # define termStopCharp (cc_t *)&ntc.t_stopc
! 345: # define termForw1Charp (cc_t *)&ntc.t_brkc
! 346: # define termForw2Charp (cc_t *)&termForw2Char
! 347: # define termAytCharp (cc_t *)&termAytChar
! 348:
! 349: # else
! 350:
! 351: extern struct termio new_tc;
! 352:
! 353: # define termEofChar new_tc.c_cc[VEOF]
! 354: # define termEraseChar new_tc.c_cc[VERASE]
! 355: # define termIntChar new_tc.c_cc[VINTR]
! 356: # define termKillChar new_tc.c_cc[VKILL]
! 357: # define termQuitChar new_tc.c_cc[VQUIT]
! 358:
! 359: # ifndef VSUSP
! 360: extern cc_t termSuspChar;
! 361: # else
! 362: # define termSuspChar new_tc.c_cc[VSUSP]
! 363: # endif
! 364: # if defined(VFLUSHO) && !defined(VDISCARD)
! 365: # define VDISCARD VFLUSHO
! 366: # endif
! 367: # ifndef VDISCARD
! 368: extern cc_t termFlushChar;
! 369: # else
! 370: # define termFlushChar new_tc.c_cc[VDISCARD]
! 371: # endif
! 372: # ifndef VWERASE
! 373: extern cc_t termWerasChar;
! 374: # else
! 375: # define termWerasChar new_tc.c_cc[VWERASE]
! 376: # endif
! 377: # ifndef VREPRINT
! 378: extern cc_t termRprntChar;
! 379: # else
! 380: # define termRprntChar new_tc.c_cc[VREPRINT]
! 381: # endif
! 382: # ifndef VLNEXT
! 383: extern cc_t termLiteralNextChar;
! 384: # else
! 385: # define termLiteralNextChar new_tc.c_cc[VLNEXT]
! 386: # endif
! 387: # ifndef VSTART
! 388: extern cc_t termStartChar;
! 389: # else
! 390: # define termStartChar new_tc.c_cc[VSTART]
! 391: # endif
! 392: # ifndef VSTOP
! 393: extern cc_t termStopChar;
! 394: # else
! 395: # define termStopChar new_tc.c_cc[VSTOP]
! 396: # endif
! 397: # ifndef VEOL
! 398: extern cc_t termForw1Char;
! 399: # else
! 400: # define termForw1Char new_tc.c_cc[VEOL]
! 401: # endif
! 402: # ifndef VEOL2
! 403: extern cc_t termForw2Char;
! 404: # else
! 405: # define termForw2Char new_tc.c_cc[VEOL]
! 406: # endif
! 407: # ifndef VSTATUS
! 408: extern cc_t termAytChar;
! 409: #else
! 410: # define termAytChar new_tc.c_cc[VSTATUS]
! 411: #endif
! 412:
! 413: # if !defined(CRAY) || defined(__STDC__)
! 414: # define termEofCharp &termEofChar
! 415: # define termEraseCharp &termEraseChar
! 416: # define termIntCharp &termIntChar
! 417: # define termKillCharp &termKillChar
! 418: # define termQuitCharp &termQuitChar
! 419: # define termSuspCharp &termSuspChar
! 420: # define termFlushCharp &termFlushChar
! 421: # define termWerasCharp &termWerasChar
! 422: # define termRprntCharp &termRprntChar
! 423: # define termLiteralNextCharp &termLiteralNextChar
! 424: # define termStartCharp &termStartChar
! 425: # define termStopCharp &termStopChar
! 426: # define termForw1Charp &termForw1Char
! 427: # define termForw2Charp &termForw2Char
! 428: # define termAytCharp &termAytChar
! 429: # else
! 430: /* Work around a compiler bug */
! 431: # define termEofCharp 0
! 432: # define termEraseCharp 0
! 433: # define termIntCharp 0
! 434: # define termKillCharp 0
! 435: # define termQuitCharp 0
! 436: # define termSuspCharp 0
! 437: # define termFlushCharp 0
! 438: # define termWerasCharp 0
! 439: # define termRprntCharp 0
! 440: # define termLiteralNextCharp 0
! 441: # define termStartCharp 0
! 442: # define termStopCharp 0
! 443: # define termForw1Charp 0
! 444: # define termForw2Charp 0
! 445: # define termAytCharp 0
! 446: # endif
! 447: #endif
! 448:
! 449:
! 450: /* Ring buffer structures which are shared */
! 451:
! 452: extern Ring
! 453: netoring,
! 454: netiring,
! 455: ttyoring,
! 456: ttyiring;
! 457:
! 458: /* Tn3270 section */
! 459: #if defined(TN3270)
! 460:
! 461: extern int
! 462: HaveInput, /* Whether an asynchronous I/O indication came in */
! 463: noasynchtty, /* Don't do signals on I/O (SIGURG, SIGIO) */
! 464: noasynchnet, /* Don't do signals on I/O (SIGURG, SIGIO) */
! 465: sigiocount, /* Count of SIGIO receptions */
! 466: shell_active; /* Subshell is active */
! 467:
! 468: extern char
! 469: *Ibackp, /* Oldest byte of 3270 data */
! 470: Ibuf[], /* 3270 buffer */
! 471: *Ifrontp, /* Where next 3270 byte goes */
! 472: tline[],
! 473: *transcom; /* Transparent command */
! 474:
! 475: extern int
! 476: settranscom P((int, char**));
! 477:
! 478: extern void
! 479: inputAvailable P((int));
! 480: #endif /* defined(TN3270) */