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