[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.27

1.27    ! guenther    1: /*     $OpenBSD: externs.h,v 1.26 2014/07/20 10:55:26 guenther 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 unsigned char
                    156:     NetTraceFile[];    /* Name of file where debugging output goes */
                    157: extern void
1.3       art       158:     SetNetTrace (char *);      /* Function to change where debugging goes */
1.1       deraadt   159:
                    160: extern jmp_buf
                    161:     peerdied,
                    162:     toplevel;          /* For error conditions. */
                    163:
1.3       art       164: /* commands.c */
                    165:
                    166: struct env_lst *env_define (unsigned char *, unsigned char *);
                    167: void env_init (void);
                    168: unsigned char * env_default(int init, int welldefined);
1.14      otto      169: unsigned char * env_getvalue(unsigned char *var, int exported_only);
1.3       art       170:
                    171: void set_escape_char(char *s);
                    172:
                    173: #ifdef SIGINFO
1.27    ! guenther  174: void ayt_status(int sig);
1.3       art       175: #endif
                    176: int tn(int argc, char **argv);
                    177: void command(int top, char *tbuf, int cnt);
                    178:
                    179: /* main.c */
                    180:
                    181: void tninit(void);
                    182:
                    183: /* network.c */
                    184:
                    185: void init_network(void);
                    186: int stilloob(void);
                    187: void setneturg(void);
                    188: int netflush(void);
                    189:
                    190: /* sys_bsd.c */
                    191:
                    192: void init_sys(void);
                    193: int TerminalSpecialChars(int c);
                    194: void TerminalDefaultChars(void);
                    195: cc_t *tcval(int func);
                    196: void TerminalSpeeds(long *input_speed, long *output_speed);
                    197: int TerminalWindowSize(long *rows, long *cols);
1.26      guenther  198: void TerminalNewMode(int);
                    199: void TerminalSaveState(void);
                    200: void sys_telnet_init(void);
1.3       art       201: int process_rings(int netin, int netout, int netex, int ttyin, int ttyout,
                    202:                  int poll);
                    203:
                    204: /* telnet.c */
                    205:
                    206: void init_telnet(void);
                    207:
                    208: void tel_leave_binary(int rw);
                    209: void tel_enter_binary(int rw);
                    210: int opt_welldefined(char *ep);
1.26      guenther  211: void telnet(char *);
1.3       art       212: int telrcv(void);
                    213: int rlogin_susp(void);
                    214: void intp(void);
                    215: void sendbrk(void);
                    216: void sendabort(void);
                    217: void sendsusp(void);
                    218: void sendeof(void);
                    219: void sendayt(void);
1.26      guenther  220: void sendnaws(void);
1.3       art       221:
                    222: void xmitAO(void);
                    223: void xmitEL(void);
                    224: void xmitEC(void);
                    225:
                    226: void     send_do (int, int);
                    227: void     send_dont (int, int);
                    228: void     send_will (int, int);
                    229: void     send_wont (int, int);
                    230:
                    231: void     lm_mode (unsigned char *, int, int);
                    232:
                    233: void     slcstate (void);
1.23      guenther  234: void     slc_mode_export (int);
1.3       art       235: void     slc_mode_import (int);
                    236: void     slc_check (void);
                    237:
                    238: void     env_opt_start_info (void);
                    239: void     env_opt_add (unsigned char *);
                    240: void     env_opt_end (int);
                    241:
                    242: unsigned char     *env_default (int, int);
1.14      otto      243: unsigned char     *env_getvalue (unsigned char *, int);
1.3       art       244:
                    245: int get_status (void);
                    246: int dosynch (void);
                    247:
                    248: cc_t *tcval (int);
                    249:
1.23      guenther  250: __dead void quit(void);
1.3       art       251:
1.18      guenther  252: /* genget.c */
                    253:
                    254: char   **genget(char *name, char **table, int stlen);
                    255: int    isprefix(char *s1, char *s2);
                    256: int    Ambiguous(void *s);
                    257:
1.3       art       258: /* terminal.c */
                    259:
                    260: void init_terminal(void);
                    261: int ttyflush(int drop);
                    262: int getconnmode(void);
1.26      guenther  263: void setconnmode(int);
                    264: void setcommandmode(void);
1.3       art       265:
                    266: /* utilities.c */
                    267:
                    268: void SetNetTrace(char *file);
                    269: void Dump(char direction, unsigned char *buffer, int length);
                    270: void printoption(char *direction, int cmd, int option);
                    271: void optionstatus(void);
1.6       hin       272: void printsub(int direction, unsigned char *pointer, int length);
1.3       art       273: void EmptyTerminal(void);
                    274: void SetForExit(void);
1.20      guenther  275: __dead void Exit(int returnCode);
1.25      guenther  276: __dead void ExitString(char *string, int returnCode);
1.1       deraadt   277:
1.3       art       278: extern struct  termios new_tc;
1.1       deraadt   279:
                    280: # define termEofChar           new_tc.c_cc[VEOF]
                    281: # define termEraseChar         new_tc.c_cc[VERASE]
                    282: # define termIntChar           new_tc.c_cc[VINTR]
                    283: # define termKillChar          new_tc.c_cc[VKILL]
                    284: # define termQuitChar          new_tc.c_cc[VQUIT]
1.24      guenther  285: # define termSuspChar          new_tc.c_cc[VSUSP]
1.1       deraadt   286:
                    287: # if   defined(VFLUSHO) && !defined(VDISCARD)
                    288: #  define VDISCARD VFLUSHO
                    289: # endif
                    290: # ifndef       VDISCARD
                    291: extern cc_t termFlushChar;
                    292: # else
                    293: #  define termFlushChar                new_tc.c_cc[VDISCARD]
                    294: # endif
                    295: # ifndef VWERASE
                    296: extern cc_t termWerasChar;
                    297: # else
                    298: #  define termWerasChar                new_tc.c_cc[VWERASE]
                    299: # endif
                    300: # ifndef       VREPRINT
                    301: extern cc_t termRprntChar;
                    302: # else
                    303: #  define termRprntChar                new_tc.c_cc[VREPRINT]
                    304: # endif
                    305: # ifndef       VLNEXT
                    306: extern cc_t termLiteralNextChar;
                    307: # else
                    308: #  define termLiteralNextChar  new_tc.c_cc[VLNEXT]
                    309: # endif
                    310: # ifndef       VSTART
                    311: extern cc_t termStartChar;
                    312: # else
                    313: #  define termStartChar                new_tc.c_cc[VSTART]
                    314: # endif
                    315: # ifndef       VSTOP
                    316: extern cc_t termStopChar;
                    317: # else
                    318: #  define termStopChar         new_tc.c_cc[VSTOP]
                    319: # endif
                    320: # ifndef       VEOL
                    321: extern cc_t termForw1Char;
                    322: # else
                    323: #  define termForw1Char                new_tc.c_cc[VEOL]
                    324: # endif
                    325: # ifndef       VEOL2
                    326: extern cc_t termForw2Char;
                    327: # else
                    328: #  define termForw2Char                new_tc.c_cc[VEOL]
                    329: # endif
                    330: # ifndef       VSTATUS
                    331: extern cc_t termAytChar;
                    332: #else
                    333: #  define termAytChar          new_tc.c_cc[VSTATUS]
                    334: #endif
                    335:
                    336: /* Ring buffer structures which are shared */
                    337:
                    338: extern Ring
                    339:     netoring,
                    340:     netiring,
                    341:     ttyoring,
                    342:     ttyiring;