ext.h revision 90926
1156952Sume/* 2156952Sume * Copyright (c) 1989, 1993 3156952Sume * The Regents of the University of California. All rights reserved. 4156952Sume * 5156952Sume * Redistribution and use in source and binary forms, with or without 6156952Sume * modification, are permitted provided that the following conditions 7156952Sume * are met: 8156952Sume * 1. Redistributions of source code must retain the above copyright 9156952Sume * notice, this list of conditions and the following disclaimer. 10156952Sume * 2. Redistributions in binary form must reproduce the above copyright 11156952Sume * notice, this list of conditions and the following disclaimer in the 12156952Sume * documentation and/or other materials provided with the distribution. 13156952Sume * 3. All advertising materials mentioning features or use of this software 14156952Sume * must display the following acknowledgement: 15156952Sume * This product includes software developed by the University of 16156952Sume * California, Berkeley and its contributors. 17156952Sume * 4. Neither the name of the University nor the names of its contributors 18156952Sume * may be used to endorse or promote products derived from this software 19156952Sume * without specific prior written permission. 20156952Sume * 21156952Sume * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22156952Sume * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23156952Sume * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24156952Sume * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25156952Sume * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26156952Sume * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27156952Sume * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28156952Sume * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29156952Sume * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30156952Sume * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31156952Sume * SUCH DAMAGE. 32156952Sume * 33156952Sume * @(#)ext.h 8.2 (Berkeley) 12/15/93 34156952Sume */ 35156952Sume 36156952Sume/* $Id: ext.h,v 1.23 2001/08/29 00:45:22 assar Exp $ */ 37156952Sume 38156952Sume#ifndef __EXT_H__ 39156952Sume#define __EXT_H__ 40156952Sume 41156952Sume/* 42156952Sume * Telnet server variable declarations 43156952Sume */ 44156952Sumeextern char options[256]; 45156952Sumeextern char do_dont_resp[256]; 46156952Sumeextern char will_wont_resp[256]; 47156952Sumeextern int flowmode; /* current flow control state */ 48156952Sumeextern int restartany; /* restart output on any character state */ 49156952Sume#ifdef DIAGNOSTICS 50156952Sumeextern int diagnostic; /* telnet diagnostic capabilities */ 51156952Sume#endif /* DIAGNOSTICS */ 52156952Sumeextern int require_otp; 53156952Sume#ifdef AUTHENTICATION 54156952Sumeextern int auth_level; 55156952Sume#endif 56156952Sumeextern const char *new_login; 57156952Sume 58156952Sumeextern slcfun slctab[NSLC + 1]; /* slc mapping table */ 59156952Sume 60156952Sumeextern char *terminaltype; 61156952Sume 62156952Sume/* 63156952Sume * I/O data buffers, pointers, and counters. 64156952Sume */ 65156952Sumeextern char ptyobuf[BUFSIZ+NETSLOP], *pfrontp, *pbackp; 66156952Sume 67156952Sumeextern char netibuf[BUFSIZ], *netip; 68156952Sume 69270838Sumeextern char netobuf[BUFSIZ+NETSLOP], *nfrontp, *nbackp; 70156952Sumeextern char *neturg; /* one past last bye of urgent data */ 71156956Sume 72156956Sumeextern int pcc, ncc; 73156952Sume 74156952Sumeextern int ourpty, net; 75156952Sumeextern char *line; 76156952Sumeextern int SYNCHing; /* we are in TELNET SYNCH mode */ 77156952Sume 78156952Sumeint telnet_net_write (unsigned char *str, int len); 79156952Sumevoid net_encrypt (void); 80156952Sumeint telnet_spin (void); 81156952Sumechar *telnet_getenv (const char *val); 82156952Sumechar *telnet_gets (char *prompt, char *result, int length, int echo); 83156952Sumevoid get_slc_defaults (void); 84156952Sumevoid telrcv (void); 85156952Sumevoid send_do (int option, int init); 86170244Sumevoid willoption (int option); 87156952Sumevoid send_dont (int option, int init); 88156952Sumevoid wontoption (int option); 89156952Sumevoid send_will (int option, int init); 90156956Sumevoid dooption (int option); 91156952Sumevoid send_wont (int option, int init); 92156952Sumevoid dontoption (int option); 93156952Sumevoid suboption (void); 94156952Sumevoid doclientstat (void); 95156952Sumevoid send_status (void); 96156952Sumevoid init_termbuf (void); 97156952Sumevoid set_termbuf (void); 98156952Sumeint spcset (int func, cc_t *valp, cc_t **valpp); 99170244Sumevoid set_utid (void); 100156952Sumeint getpty (int *ptynum); 101156952Sumeint tty_isecho (void); 102156952Sumeint tty_flowmode (void); 103156952Sumeint tty_restartany (void); 104156952Sumevoid tty_setecho (int on); 105156952Sumeint tty_israw (void); 106156952Sumevoid tty_binaryin (int on); 107156952Sumevoid tty_binaryout (int on); 108156952Sumeint tty_isbinaryin (void); 109156952Sumeint tty_isbinaryout (void); 110156952Sumeint tty_issofttab (void); 111156952Sumevoid tty_setsofttab (int on); 112156952Sumeint tty_islitecho (void); 113156952Sumevoid tty_setlitecho (int on); 114156952Sumeint tty_iscrnl (void); 115156952Sumevoid tty_tspeed (int val); 116156952Sumevoid tty_rspeed (int val); 117156952Sumevoid getptyslave (void); 118156952Sumeint cleanopen (char *line); 119156952Sumevoid startslave (const char *host, const char *, int autologin, char *autoname); 120156952Sumevoid init_env (void); 121156952Sumevoid start_login (const char *host, int autologin, char *name); 122156952Sumevoid cleanup (int sig); 123156952Sumeint main (int argc, char **argv); 124156952Sumeint getterminaltype (char *name, size_t); 125156952Sumevoid _gettermname (void); 126156952Sumeint terminaltypeok (char *s); 127156952Sumevoid my_telnet (int f, int p, const char*, const char *, int, char*); 128156952Sumevoid interrupt (void); 129156952Sumevoid sendbrk (void); 130156952Sumevoid sendsusp (void); 131156952Sumevoid recv_ayt (void); 132156952Sumevoid doeof (void); 133156952Sumevoid flowstat (void); 134156952Sumevoid clientstat (int code, int parm1, int parm2); 135156952Sumeint ttloop (void); 136156952Sumeint stilloob (int s); 137156952Sumevoid ptyflush (void); 138156952Sumechar *nextitem (char *current); 139156952Sumevoid netclear (void); 140156952Sumevoid netflush (void); 141156952Sumevoid writenet (unsigned char *ptr, int len); 142156952Sumevoid fatal (int f, char *msg); 143156952Sumevoid fatalperror (int f, const char *msg); 144156952Sumevoid fatalperror_errno (int f, const char *msg, int error); 145156952Sumevoid edithost (char *pat, char *host); 146156952Sumevoid putstr (char *s); 147156952Sumevoid putchr (int cc); 148156952Sumevoid putf (char *cp, char *where); 149156952Sumevoid printoption (char *fmt, int option); 150156952Sumevoid printsub (int direction, unsigned char *pointer, int length); 151156952Sumevoid printdata (char *tag, char *ptr, int cnt); 152156952Sumeint login_tty(int t); 153156952Sume 154156952Sume#ifdef ENCRYPTION 155156952Sumeextern void (*encrypt_output) (unsigned char *, int); 156156952Sumeextern int (*decrypt_input) (int); 157156952Sumeextern char *nclearto; 158156952Sume#endif 159156952Sume 160156952Sume 161156952Sume/* 162156952Sume * The following are some clocks used to decide how to interpret 163156952Sume * the relationship between various variables. 164156952Sume */ 165156952Sume 166156952Sumestruct clocks_t{ 167156952Sume int 168156952Sume system, /* what the current time is */ 169156952Sume echotoggle, /* last time user entered echo character */ 170156952Sume modenegotiated, /* last time operating mode negotiated */ 171156952Sume didnetreceive, /* last time we read data from network */ 172156952Sume ttypesubopt, /* ttype subopt is received */ 173156952Sume tspeedsubopt, /* tspeed subopt is received */ 174156952Sume environsubopt, /* environ subopt is received */ 175156952Sume oenvironsubopt, /* old environ subopt is received */ 176156952Sume xdisplocsubopt, /* xdisploc subopt is received */ 177156952Sume baseline, /* time started to do timed action */ 178156952Sume gotDM; /* when did we last see a data mark */ 179156952Sume}; 180170244Sumeextern struct clocks_t clocks; 181156952Sume 182156952Sumeextern int log_unauth; 183170244Sumeextern int no_warn; 184156952Sume 185156952Sumeextern int def_tspeed, def_rspeed; 186156952Sume#ifdef TIOCSWINSZ 187156952Sumeextern int def_row, def_col; 188156952Sume#endif 189170244Sume 190156952Sume#ifdef STREAMSPTY 191156952Sumeextern int really_stream; 192156952Sume#endif 193156952Sume 194156952Sume#ifndef USE_IM 195170244Sume# ifdef CRAY 196156952Sume# define USE_IM "Cray UNICOS (%h) (%t)" 197156952Sume# endif 198156952Sume# ifdef _AIX 199156952Sume# define USE_IM "%s %v.%r (%h) (%t)" 200156952Sume# endif 201156952Sume# ifndef USE_IM 202156952Sume# define USE_IM "%s %r (%h) (%t)" 203156952Sume# endif 204156952Sume#endif 205156956Sume 206156956Sume#define DEFAULT_IM "\r\n\r\n" USE_IM "\r\n\r\n\r\n" 207156956Sume 208156956Sume#endif /* __EXT_H__ */ 209156956Sume