1 /* $NetBSD: ext.h,v 1.16 2001/08/24 00:14:03 wiz Exp $ */ 2 3 /* 4 * Copyright (c) 1989, 1993 5 * The Regents of the University of California. All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 3. All advertising materials mentioning features or use of this software 16 * must display the following acknowledgement: 17 * This product includes software developed by the University of 18 * California, Berkeley and its contributors. 19 * 4. Neither the name of the University nor the names of its contributors 20 * may be used to endorse or promote products derived from this software 21 * without specific prior written permission. 22 * 23 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * SUCH DAMAGE. 34 * 35 * from: @(#)ext.h 8.2 (Berkeley) 12/15/93 36 */ 37 38 /* 39 * Telnet server variable declarations 40 */ 41 extern char options[256]; 42 extern char do_dont_resp[256]; 43 extern char will_wont_resp[256]; 44 extern int linemode; /* linemode on/off */ 45 #ifdef LINEMODE 46 extern int uselinemode; /* what linemode to use (on/off) */ 47 extern int editmode; /* edit modes in use */ 48 extern int useeditmode; /* edit modes to use */ 49 extern int alwayslinemode; /* command line option */ 50 # ifdef KLUDGELINEMODE 51 extern int lmodetype; /* Client support for linemode */ 52 # endif /* KLUDGELINEMODE */ 53 #endif /* LINEMODE */ 54 extern int flowmode; /* current flow control state */ 55 extern int restartany; /* restart output on any character state */ 56 #ifdef DIAGNOSTICS 57 extern int diagnostic; /* telnet diagnostic capabilities */ 58 #endif /* DIAGNOSTICS */ 59 #ifdef BFTPDAEMON 60 extern int bftpd; /* behave as bftp daemon */ 61 #endif /* BFTPDAEMON */ 62 #if defined(SECURELOGIN) 63 extern int require_secure_login; 64 #endif 65 #if defined(AUTHENTICATION) 66 extern int auth_level; 67 #endif 68 #if defined(FORWARD) 69 extern int got_forwarded_creds; 70 #endif 71 72 extern slcfun slctab[NSLC + 1]; /* slc mapping table */ 73 74 extern char *terminaltype; 75 76 /* 77 * I/O data buffers, pointers, and counters. 78 */ 79 extern char ptyobuf[BUFSIZ+NETSLOP], *pfrontp, *pbackp; 80 81 extern char netibuf[BUFSIZ], *netip; 82 83 extern char netobuf[BUFSIZ+NETSLOP], *nfrontp, *nbackp; 84 extern char *neturg; /* one past last bye of urgent data */ 85 86 extern int pcc, ncc; 87 88 89 extern int pty, net; 90 extern char *line; 91 extern int SYNCHing; /* we are in TELNET SYNCH mode */ 92 93 #include <sys/cdefs.h> 94 #define P __P 95 96 extern void 97 _termstat P((void)), 98 add_slc P((int, int, int)), 99 check_slc P((void)), 100 change_slc P((int, int, int)), 101 cleanup P((int)), 102 clientstat P((int, int, int)), 103 copy_termbuf P((char *, int)), 104 deferslc P((void)), 105 defer_terminit P((void)), 106 do_opt_slc P((unsigned char *, int)), 107 doeof P((void)), 108 dooption P((int)), 109 dontoption P((int)), 110 edithost P((char *, char *)), 111 fatal P((int, const char *)), 112 fatalperror P((int, const char *)), 113 get_slc_defaults P((void)), 114 init_env P((void)), 115 init_termbuf P((void)), 116 interrupt P((void)), 117 localstat P((void)), 118 flowstat P((void)), 119 netclear P((void)), 120 netflush P((void)), 121 #ifdef DIAGNOSTICS 122 printoption P((const char *, int)), 123 printdata P((char *, char *, int)), 124 #if !defined(ENCRYPTION) 125 printsub P((int, unsigned char *, int)), 126 #endif 127 #endif 128 ptyflush P((void)), 129 putchr P((int)), 130 recv_ayt P((void)), 131 send_do P((int, int)), 132 send_dont P((int, int)), 133 send_slc P((void)), 134 send_status P((void)), 135 send_will P((int, int)), 136 send_wont P((int, int)), 137 sendbrk P((void)), 138 sendsusp P((void)), 139 set_termbuf P((void)), 140 start_login P((char *, int, char *)), 141 start_slc P((int)), 142 startslave P((char *, int, char *)), 143 suboption P((void)), 144 telrcv P((void)), 145 ttloop P((void)), 146 tty_binaryin P((int)), 147 tty_binaryout P((int)); 148 149 extern char * 150 putf P((char *, char *)); 151 152 extern int 153 end_slc P((unsigned char **)), 154 getnpty P((void)), 155 #ifndef convex 156 getpty P((int *)), 157 #endif 158 spcset P((int, cc_t *, cc_t **)), 159 stilloob P((int)), 160 terminit P((void)), 161 termstat P((void)), 162 tty_flowmode P((void)), 163 tty_restartany P((void)), 164 tty_isbinaryin P((void)), 165 tty_isbinaryout P((void)), 166 tty_iscrnl P((void)), 167 tty_isecho P((void)), 168 tty_isediting P((void)), 169 tty_islitecho P((void)), 170 tty_isnewmap P((void)), 171 tty_israw P((void)), 172 tty_issofttab P((void)), 173 tty_istrapsig P((void)), 174 tty_linemode P((void)); 175 176 extern void 177 tty_rspeed P((int)), 178 tty_setecho P((int)), 179 tty_setedit P((int)), 180 tty_setlinemode P((int)), 181 tty_setlitecho P((int)), 182 tty_setsig P((int)), 183 tty_setsofttab P((int)), 184 tty_tspeed P((int)), 185 willoption P((int)), 186 wontoption P((int)), 187 writenet P((unsigned char *, int)); 188 189 extern int output_data __P((const char *, ...)) 190 __attribute__((__format__(__printf__, 1, 2))); 191 extern int output_datalen __P((const char *, size_t)); 192 193 #ifdef ENCRYPTION 194 extern char *nclearto; 195 #endif /* ENCRYPTION */ 196 197 198 /* 199 * The following are some clocks used to decide how to interpret 200 * the relationship between various variables. 201 */ 202 203 extern struct { 204 int 205 system, /* what the current time is */ 206 echotoggle, /* last time user entered echo character */ 207 modenegotiated, /* last time operating mode negotiated */ 208 didnetreceive, /* last time we read data from network */ 209 ttypesubopt, /* ttype subopt is received */ 210 tspeedsubopt, /* tspeed subopt is received */ 211 environsubopt, /* environ subopt is received */ 212 oenvironsubopt, /* old environ subopt is received */ 213 xdisplocsubopt, /* xdisploc subopt is received */ 214 baseline, /* time started to do timed action */ 215 gotDM; /* when did we last see a data mark */ 216 } clocks; 217 218 219 220 #ifndef DEFAULT_IM 221 # ifdef CRAY 222 # define DEFAULT_IM "\r\n\r\nCray UNICOS (%h) (%t)\r\n\r\r\n\r" 223 # else 224 # ifdef sun 225 # define DEFAULT_IM "\r\n\r\nSunOS UNIX (%h) (%t)\r\n\r\r\n\r" 226 # else 227 # ifdef ultrix 228 # define DEFAULT_IM "\r\n\r\nULTRIX (%h) (%t)\r\n\r\r\n\r" 229 # else 230 # define DEFAULT_IM "\r\n\r\n4.4 BSD UNIX (%h) (%t)\r\n\r\r\n\r" 231 # endif 232 # endif 233 # endif 234 #endif 235 236 #if defined(AUTHENTICATION) 237 #include <libtelnet/auth.h> 238 #endif 239 240 #if defined(ENCRYPTION) 241 #include <libtelnet/encrypt.h> 242 #endif 243