[BACK]Return to externs.h CVS log [TXT][DIR] Up to [local] / src / usr.bin / telnet

Annotation of src/usr.bin/telnet/externs.h, Revision 1.29

1.29    ! guenther    1: /*     $OpenBSD: externs.h,v 1.28 2014/07/22 07:30:24 jsg Exp $        */
1.3       art         2: /* $KTH: externs.h,v 1.16 1997/11/29 02:28:35 joda Exp $ */
1.2       niklas      3:
1.1       deraadt     4: /*
                      5:  * Copyright (c) 1988, 1990, 1993
                      6:  *     The Regents of the University of California.  All rights reserved.
                      7:  *
                      8:  * Redistribution and use in source and binary forms, with or without
                      9:  * modification, are permitted provided that the following conditions
                     10:  * are met:
                     11:  * 1. Redistributions of source code must retain the above copyright
                     12:  *    notice, this list of conditions and the following disclaimer.
                     13:  * 2. Redistributions in binary form must reproduce the above copyright
                     14:  *    notice, this list of conditions and the following disclaimer in the
                     15:  *    documentation and/or other materials provided with the distribution.
1.11      millert    16:  * 3. Neither the name of the University nor the names of its contributors
1.1       deraadt    17:  *    may be used to endorse or promote products derived from this software
                     18:  *    without specific prior written permission.
                     19:  *
                     20:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     21:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     22:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     23:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     24:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     25:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     26:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     27:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     28:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     29:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     30:  * SUCH DAMAGE.
                     31:  *
1.3       art        32:  *     @(#)externs.h   8.3 (Berkeley) 5/30/95
1.1       deraadt    33:  */
                     34:
                     35: #define        SUBBUFSIZE      256
                     36:
                     37: extern int
                     38:     autologin,         /* Autologin enabled */
                     39:     skiprc,            /* Don't process the ~/.telnetrc file */
                     40:     eight,             /* use eight bit mode (binary in and/or out */
1.3       art        41:     binary,
1.12      otto       42:     family,            /* address family of peer */
1.1       deraadt    43:     flushout,          /* flush output */
                     44:     connected,         /* Are we connected to the other side? */
                     45:     globalmode,                /* Mode tty should be in */
                     46:     telnetport,                /* Are we connected to the telnet port? */
                     47:     localflow,         /* Flow control handled locally */
                     48:     restartany,                /* If flow control, restart output on any character */
                     49:     localchars,                /* we recognize interrupt/quit */
1.2       niklas     50:     donelclchars,      /* the user has set "localchars" */
1.1       deraadt    51:     showoptions,
                     52:     net,               /* Network file descriptor */
                     53:     tin,               /* Terminal input file descriptor */
                     54:     tout,              /* Terminal output file descriptor */
                     55:     crlf,              /* Should '\r' be mapped to <CR><LF> (or <CR><NUL>)? */
                     56:     autoflush,         /* flush output when interrupting? */
                     57:     autosynch,         /* send interrupt characters with SYNCH? */
                     58:     SYNCHing,          /* Is the stream in telnet SYNCH mode? */
                     59:     donebinarytoggle,  /* the user has put us in binary */
                     60:     dontlecho,         /* do we suppress local echoing right now? */
                     61:     crmod,
                     62:     netdata,           /* Print out network data flow */
                     63:     prettydump,                /* Print "netdata" output in user readable format */
                     64:     termdata,          /* Print out terminal data flow */
1.27      guenther   65:     resettermname,
                     66:     linemode,
                     67:     kludgelinemode,
                     68:     want_status_response,
1.3       art        69:     debug;             /* Debug level */
1.1       deraadt    70:
                     71: extern cc_t escape;    /* Escape to command mode */
                     72: extern cc_t rlogin;    /* Rlogin mode escape character */
                     73: #ifdef KLUDGELINEMODE
                     74: extern cc_t echoc;     /* Toggle local echoing */
                     75: #endif
                     76:
                     77: extern char
                     78:     *prompt;           /* Prompt for command. */
                     79:
                     80: extern char
                     81:     doopt[],
                     82:     dont[],
                     83:     will[],
                     84:     wont[],
1.27      guenther   85:     will_wont_resp[],
                     86:     do_dont_resp[],
1.1       deraadt    87:     options[],         /* All the little options */
                     88:     *hostname;         /* Who are we connected to? */
1.15      claudio    89:
1.17      sthen      90: extern int     rtableid;       /* routing table to use */
1.1       deraadt    91:
                     92: /*
                     93:  * We keep track of each side of the option negotiation.
                     94:  */
                     95:
                     96: #define        MY_STATE_WILL           0x01
                     97: #define        MY_WANT_STATE_WILL      0x02
                     98: #define        MY_STATE_DO             0x04
                     99: #define        MY_WANT_STATE_DO        0x08
                    100:
                    101: /*
                    102:  * Macros to check the current state of things
                    103:  */
                    104:
                    105: #define        my_state_is_do(opt)             (options[opt]&MY_STATE_DO)
                    106: #define        my_state_is_will(opt)           (options[opt]&MY_STATE_WILL)
                    107: #define my_want_state_is_do(opt)       (options[opt]&MY_WANT_STATE_DO)
                    108: #define my_want_state_is_will(opt)     (options[opt]&MY_WANT_STATE_WILL)
                    109:
                    110: #define        my_state_is_dont(opt)           (!my_state_is_do(opt))
                    111: #define        my_state_is_wont(opt)           (!my_state_is_will(opt))
                    112: #define my_want_state_is_dont(opt)     (!my_want_state_is_do(opt))
                    113: #define my_want_state_is_wont(opt)     (!my_want_state_is_will(opt))
                    114:
                    115: #define        set_my_state_do(opt)            {options[opt] |= MY_STATE_DO;}
                    116: #define        set_my_state_will(opt)          {options[opt] |= MY_STATE_WILL;}
                    117: #define        set_my_want_state_do(opt)       {options[opt] |= MY_WANT_STATE_DO;}
                    118: #define        set_my_want_state_will(opt)     {options[opt] |= MY_WANT_STATE_WILL;}
                    119:
                    120: #define        set_my_state_dont(opt)          {options[opt] &= ~MY_STATE_DO;}
                    121: #define        set_my_state_wont(opt)          {options[opt] &= ~MY_STATE_WILL;}
                    122: #define        set_my_want_state_dont(opt)     {options[opt] &= ~MY_WANT_STATE_DO;}
                    123: #define        set_my_want_state_wont(opt)     {options[opt] &= ~MY_WANT_STATE_WILL;}
                    124:
                    125: /*
1.7       pvalchev  126:  * Make everything symmetrical
1.1       deraadt   127:  */
                    128:
                    129: #define        HIS_STATE_WILL                  MY_STATE_DO
                    130: #define        HIS_WANT_STATE_WILL             MY_WANT_STATE_DO
                    131: #define HIS_STATE_DO                   MY_STATE_WILL
                    132: #define HIS_WANT_STATE_DO              MY_WANT_STATE_WILL
                    133:
                    134: #define        his_state_is_do                 my_state_is_will
                    135: #define        his_state_is_will               my_state_is_do
                    136: #define his_want_state_is_do           my_want_state_is_will
                    137: #define his_want_state_is_will         my_want_state_is_do
                    138:
                    139: #define        his_state_is_dont               my_state_is_wont
                    140: #define        his_state_is_wont               my_state_is_dont
                    141: #define his_want_state_is_dont         my_want_state_is_wont
                    142: #define his_want_state_is_wont         my_want_state_is_dont
                    143:
                    144: #define        set_his_state_do                set_my_state_will
                    145: #define        set_his_state_will              set_my_state_do
                    146: #define        set_his_want_state_do           set_my_want_state_will
                    147: #define        set_his_want_state_will         set_my_want_state_do
                    148:
                    149: #define        set_his_state_dont              set_my_state_wont
                    150: #define        set_his_state_wont              set_my_state_dont
                    151: #define        set_his_want_state_dont         set_my_want_state_wont
                    152: #define        set_his_want_state_wont         set_my_want_state_dont
                    153:
                    154:
                    155: extern jmp_buf
                    156:     peerdied,
                    157:     toplevel;          /* For error conditions. */
                    158:
1.3       art       159: /* commands.c */
                    160:
1.29    ! guenther  161: struct env_lst *env_define (const char *, const char *);
        !           162: void   env_init (void);
        !           163: char   *env_default(int init, int welldefined);
        !           164: char   *env_getvalue(const char *var, int exported_only);
1.3       art       165:
                    166: void set_escape_char(char *s);
                    167:
                    168: #ifdef SIGINFO
1.27      guenther  169: void ayt_status(int sig);
1.3       art       170: #endif
                    171: int tn(int argc, char **argv);
                    172: void command(int top, char *tbuf, int cnt);
                    173:
                    174: /* main.c */
                    175:
                    176: void tninit(void);
                    177:
                    178: /* network.c */
                    179:
                    180: void init_network(void);
                    181: int stilloob(void);
                    182: void setneturg(void);
                    183: int netflush(void);
                    184:
                    185: /* sys_bsd.c */
                    186:
                    187: void init_sys(void);
                    188: int TerminalSpecialChars(int c);
                    189: void TerminalDefaultChars(void);
                    190: cc_t *tcval(int func);
                    191: void TerminalSpeeds(long *input_speed, long *output_speed);
                    192: int TerminalWindowSize(long *rows, long *cols);
1.26      guenther  193: void TerminalNewMode(int);
                    194: void TerminalSaveState(void);
                    195: void sys_telnet_init(void);
1.3       art       196: int process_rings(int netin, int netout, int netex, int ttyin, int ttyout,
                    197:                  int poll);
                    198:
                    199: /* telnet.c */
                    200:
                    201: void init_telnet(void);
                    202:
                    203: void tel_leave_binary(int rw);
                    204: void tel_enter_binary(int rw);
1.29    ! guenther  205: int opt_welldefined(const char *ep);
1.26      guenther  206: void telnet(char *);
1.3       art       207: int telrcv(void);
                    208: int rlogin_susp(void);
                    209: void intp(void);
                    210: void sendbrk(void);
                    211: void sendabort(void);
                    212: void sendsusp(void);
                    213: void sendeof(void);
                    214: void sendayt(void);
1.26      guenther  215: void sendnaws(void);
1.3       art       216:
                    217: void xmitAO(void);
                    218: void xmitEL(void);
                    219: void xmitEC(void);
                    220:
                    221: void     send_do (int, int);
                    222: void     send_dont (int, int);
                    223: void     send_will (int, int);
                    224: void     send_wont (int, int);
                    225:
                    226: void     lm_mode (unsigned char *, int, int);
                    227:
                    228: void     slcstate (void);
1.23      guenther  229: void     slc_mode_export (int);
1.3       art       230: void     slc_mode_import (int);
                    231: void     slc_check (void);
                    232:
                    233: void     env_opt_start_info (void);
1.29    ! guenther  234: void     env_opt_add (char *);
1.3       art       235: void     env_opt_end (int);
                    236:
                    237: int get_status (void);
                    238: int dosynch (void);
                    239:
                    240: cc_t *tcval (int);
                    241:
1.23      guenther  242: __dead void quit(void);
1.3       art       243:
1.18      guenther  244: /* genget.c */
                    245:
                    246: char   **genget(char *name, char **table, int stlen);
                    247: int    isprefix(char *s1, char *s2);
                    248: int    Ambiguous(void *s);
                    249:
1.3       art       250: /* terminal.c */
                    251:
                    252: void init_terminal(void);
                    253: int ttyflush(int drop);
                    254: int getconnmode(void);
1.26      guenther  255: void setconnmode(int);
                    256: void setcommandmode(void);
1.3       art       257:
                    258: /* utilities.c */
                    259:
1.29    ! guenther  260: extern char NetTraceFile[];
        !           261: void SetNetTrace(const char *file);
1.3       art       262: void Dump(char direction, unsigned char *buffer, int length);
                    263: void printoption(char *direction, int cmd, int option);
                    264: void optionstatus(void);
1.28      jsg       265: void printsub(char direction, unsigned char *pointer, int length);
1.3       art       266: void EmptyTerminal(void);
                    267: void SetForExit(void);
1.20      guenther  268: __dead void Exit(int returnCode);
1.25      guenther  269: __dead void ExitString(char *string, int returnCode);
1.1       deraadt   270:
1.3       art       271: extern struct  termios new_tc;
1.1       deraadt   272:
                    273: # define termEofChar           new_tc.c_cc[VEOF]
                    274: # define termEraseChar         new_tc.c_cc[VERASE]
                    275: # define termIntChar           new_tc.c_cc[VINTR]
                    276: # define termKillChar          new_tc.c_cc[VKILL]
                    277: # define termQuitChar          new_tc.c_cc[VQUIT]
1.24      guenther  278: # define termSuspChar          new_tc.c_cc[VSUSP]
1.1       deraadt   279:
                    280: # if   defined(VFLUSHO) && !defined(VDISCARD)
                    281: #  define VDISCARD VFLUSHO
                    282: # endif
                    283: # ifndef       VDISCARD
                    284: extern cc_t termFlushChar;
                    285: # else
                    286: #  define termFlushChar                new_tc.c_cc[VDISCARD]
                    287: # endif
                    288: # ifndef VWERASE
                    289: extern cc_t termWerasChar;
                    290: # else
                    291: #  define termWerasChar                new_tc.c_cc[VWERASE]
                    292: # endif
                    293: # ifndef       VREPRINT
                    294: extern cc_t termRprntChar;
                    295: # else
                    296: #  define termRprntChar                new_tc.c_cc[VREPRINT]
                    297: # endif
                    298: # ifndef       VLNEXT
                    299: extern cc_t termLiteralNextChar;
                    300: # else
                    301: #  define termLiteralNextChar  new_tc.c_cc[VLNEXT]
                    302: # endif
                    303: # ifndef       VSTART
                    304: extern cc_t termStartChar;
                    305: # else
                    306: #  define termStartChar                new_tc.c_cc[VSTART]
                    307: # endif
                    308: # ifndef       VSTOP
                    309: extern cc_t termStopChar;
                    310: # else
                    311: #  define termStopChar         new_tc.c_cc[VSTOP]
                    312: # endif
                    313: # ifndef       VEOL
                    314: extern cc_t termForw1Char;
                    315: # else
                    316: #  define termForw1Char                new_tc.c_cc[VEOL]
                    317: # endif
                    318: # ifndef       VEOL2
                    319: extern cc_t termForw2Char;
                    320: # else
                    321: #  define termForw2Char                new_tc.c_cc[VEOL]
                    322: # endif
                    323: # ifndef       VSTATUS
                    324: extern cc_t termAytChar;
                    325: #else
                    326: #  define termAytChar          new_tc.c_cc[VSTATUS]
                    327: #endif
                    328:
                    329: /* Ring buffer structures which are shared */
                    330:
                    331: extern Ring
                    332:     netoring,
                    333:     netiring,
                    334:     ttyoring,
                    335:     ttyiring;