129088Smarkm/* 229088Smarkm * Copyright (c) 1989, 1993 329088Smarkm * The Regents of the University of California. All rights reserved. 429088Smarkm * 529088Smarkm * Redistribution and use in source and binary forms, with or without 629088Smarkm * modification, are permitted provided that the following conditions 729088Smarkm * are met: 829088Smarkm * 1. Redistributions of source code must retain the above copyright 929088Smarkm * notice, this list of conditions and the following disclaimer. 1029088Smarkm * 2. Redistributions in binary form must reproduce the above copyright 1129088Smarkm * notice, this list of conditions and the following disclaimer in the 1229088Smarkm * documentation and/or other materials provided with the distribution. 1329088Smarkm * 3. All advertising materials mentioning features or use of this software 1429088Smarkm * must display the following acknowledgement: 1529088Smarkm * This product includes software developed by the University of 1629088Smarkm * California, Berkeley and its contributors. 1729088Smarkm * 4. Neither the name of the University nor the names of its contributors 1829088Smarkm * may be used to endorse or promote products derived from this software 1929088Smarkm * without specific prior written permission. 2029088Smarkm * 2129088Smarkm * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2229088Smarkm * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2329088Smarkm * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2429088Smarkm * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2529088Smarkm * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2629088Smarkm * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2729088Smarkm * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2829088Smarkm * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2929088Smarkm * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3029088Smarkm * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3129088Smarkm * SUCH DAMAGE. 3229088Smarkm * 3329088Smarkm * @(#)ext.h 8.2 (Berkeley) 12/15/93 3463248Speter * $FreeBSD: releng/11.0/contrib/telnet/telnetd/ext.h 184935 2008-11-13 19:05:27Z ed $ 3529088Smarkm */ 3629088Smarkm 3729088Smarkm/* 3829088Smarkm * Telnet server variable declarations 3929088Smarkm */ 4029088Smarkmextern char options[256]; 4129088Smarkmextern char do_dont_resp[256]; 4229088Smarkmextern char will_wont_resp[256]; 4329088Smarkmextern int linemode; /* linemode on/off */ 4429088Smarkm#ifdef LINEMODE 4529088Smarkmextern int uselinemode; /* what linemode to use (on/off) */ 4629088Smarkmextern int editmode; /* edit modes in use */ 4729088Smarkmextern int useeditmode; /* edit modes to use */ 4829088Smarkmextern int alwayslinemode; /* command line option */ 4929088Smarkmextern int lmodetype; /* Client support for linemode */ 5029088Smarkm#endif /* LINEMODE */ 5129088Smarkmextern int flowmode; /* current flow control state */ 5229088Smarkmextern int restartany; /* restart output on any character state */ 5329088Smarkm#ifdef DIAGNOSTICS 5429088Smarkmextern int diagnostic; /* telnet diagnostic capabilities */ 5529088Smarkm#endif /* DIAGNOSTICS */ 5629088Smarkm#ifdef BFTPDAEMON 5729088Smarkmextern int bftpd; /* behave as bftp daemon */ 5829088Smarkm#endif /* BFTPDAEMON */ 5987139Smarkm#ifdef AUTHENTICATION 6029088Smarkmextern int auth_level; 6129088Smarkm#endif 6229088Smarkm 6329088Smarkmextern slcfun slctab[NSLC + 1]; /* slc mapping table */ 6429088Smarkm 6529088Smarkmchar *terminaltype; 6629088Smarkm 6729088Smarkm/* 6829088Smarkm * I/O data buffers, pointers, and counters. 6929088Smarkm */ 7029088Smarkmextern char ptyobuf[BUFSIZ+NETSLOP], *pfrontp, *pbackp; 7129088Smarkm 7229088Smarkmextern char netibuf[BUFSIZ], *netip; 7329088Smarkm 7480038Sruextern char netobuf[BUFSIZ], *nfrontp, *nbackp; 7529088Smarkmextern char *neturg; /* one past last bye of urgent data */ 7629088Smarkm 7729088Smarkmextern int pcc, ncc; 7829088Smarkm 7929088Smarkmextern int pty, net; 80184935Sedextern char line[32]; 8129088Smarkmextern int SYNCHing; /* we are in TELNET SYNCH mode */ 8229088Smarkm 8329088Smarkmextern void 8487155Smarkm _termstat(void), 8587155Smarkm add_slc(char, char, cc_t), 8687155Smarkm check_slc(void), 8787155Smarkm change_slc(char, char, cc_t), 8887155Smarkm cleanup(int), 8987155Smarkm clientstat(int, int, int), 9087155Smarkm copy_termbuf(char *, size_t), 9187155Smarkm deferslc(void), 9287155Smarkm defer_terminit(void), 9387155Smarkm do_opt_slc(unsigned char *, int), 9487155Smarkm doeof(void), 9587155Smarkm dooption(int), 9687155Smarkm dontoption(int), 9787155Smarkm edithost(char *, char *), 9887155Smarkm fatal(int, const char *), 9987155Smarkm fatalperror(int, const char *), 10087155Smarkm get_slc_defaults(void), 10187155Smarkm init_env(void), 10287155Smarkm init_termbuf(void), 10387155Smarkm interrupt(void), 10487155Smarkm localstat(void), 10587155Smarkm flowstat(void), 10687155Smarkm netclear(void), 10787155Smarkm netflush(void), 10829088Smarkm#ifdef DIAGNOSTICS 10987155Smarkm printoption(const char *, int), 11087155Smarkm printdata(const char *, char *, int), 11187155Smarkm printsub(char, unsigned char *, int), 11229088Smarkm#endif 11387155Smarkm process_slc(unsigned char, unsigned char, cc_t), 11487155Smarkm ptyflush(void), 11587155Smarkm putchr(int), 11687155Smarkm putf(char *, char *), 11787155Smarkm recv_ayt(void), 11887155Smarkm send_do(int, int), 11987155Smarkm send_dont(int, int), 12087155Smarkm send_slc(void), 12187155Smarkm send_status(void), 12287155Smarkm send_will(int, int), 12387155Smarkm send_wont(int, int), 12487155Smarkm sendbrk(void), 12587155Smarkm sendsusp(void), 12687155Smarkm set_termbuf(void), 12787155Smarkm start_login(char *, int, char *), 12887155Smarkm start_slc(int), 12987139Smarkm#ifdef AUTHENTICATION 13087155Smarkm start_slave(char *), 13129088Smarkm#else 13287155Smarkm start_slave(char *, int, char *), 13329088Smarkm#endif 13487155Smarkm suboption(void), 13587155Smarkm telrcv(void), 13687155Smarkm ttloop(void), 13787155Smarkm tty_binaryin(int), 13887155Smarkm tty_binaryout(int); 13929088Smarkm 14029088Smarkmextern int 14187155Smarkm end_slc(unsigned char **), 14287155Smarkm getnpty(void), 14329088Smarkm#ifndef convex 14487155Smarkm getpty(int *), 14529088Smarkm#endif 14687155Smarkm login_tty(int), 14787155Smarkm spcset(int, cc_t *, cc_t **), 14887155Smarkm stilloob(int), 14987155Smarkm terminit(void), 15087155Smarkm termstat(void), 15187155Smarkm tty_flowmode(void), 15287155Smarkm tty_restartany(void), 15387155Smarkm tty_isbinaryin(void), 15487155Smarkm tty_isbinaryout(void), 15587155Smarkm tty_iscrnl(void), 15687155Smarkm tty_isecho(void), 15787155Smarkm tty_isediting(void), 15887155Smarkm tty_islitecho(void), 15987155Smarkm tty_isnewmap(void), 16087155Smarkm tty_israw(void), 16187155Smarkm tty_issofttab(void), 16287155Smarkm tty_istrapsig(void), 16387155Smarkm tty_linemode(void); 16429088Smarkm 16529088Smarkmextern void 16687155Smarkm tty_rspeed(int), 16787155Smarkm tty_setecho(int), 16887155Smarkm tty_setedit(int), 16987155Smarkm tty_setlinemode(int), 17087155Smarkm tty_setlitecho(int), 17187155Smarkm tty_setsig(int), 17287155Smarkm tty_setsofttab(int), 17387155Smarkm tty_tspeed(int), 17487155Smarkm willoption(int), 17587155Smarkm wontoption(int); 17629088Smarkm 17787155Smarkmint output_data(const char *, ...) __printflike(1, 2); 17887155Smarkmvoid output_datalen(const char *, int); 17987155Smarkmvoid startslave(char *, int, char *); 18079981Sru 18129088Smarkm#ifdef ENCRYPTION 18287155Smarkmextern void (*encrypt_output)(unsigned char *, int); 18387155Smarkmextern int (*decrypt_input)(int); 18429088Smarkmextern char *nclearto; 18529088Smarkm#endif /* ENCRYPTION */ 18629088Smarkm 18729088Smarkm 18829088Smarkm/* 18929088Smarkm * The following are some clocks used to decide how to interpret 19029088Smarkm * the relationship between various variables. 19129088Smarkm */ 19229088Smarkm 19329088Smarkmextern struct { 19429088Smarkm int 19529088Smarkm system, /* what the current time is */ 19629088Smarkm echotoggle, /* last time user entered echo character */ 19729088Smarkm modenegotiated, /* last time operating mode negotiated */ 19829088Smarkm didnetreceive, /* last time we read data from network */ 19929088Smarkm ttypesubopt, /* ttype subopt is received */ 20029088Smarkm tspeedsubopt, /* tspeed subopt is received */ 20129088Smarkm environsubopt, /* environ subopt is received */ 20229088Smarkm oenvironsubopt, /* old environ subopt is received */ 20329088Smarkm xdisplocsubopt, /* xdisploc subopt is received */ 20429088Smarkm baseline, /* time started to do timed action */ 20529088Smarkm gotDM; /* when did we last see a data mark */ 20629088Smarkm} clocks; 20729088Smarkm 20829088Smarkm#ifndef DEFAULT_IM 20929088Smarkm# ifdef ultrix 21029088Smarkm# define DEFAULT_IM "\r\n\r\nULTRIX (%h) (%t)\r\n\r\r\n\r" 21129088Smarkm# else 21229181Smarkm# ifdef __FreeBSD__ 21329181Smarkm# define DEFAULT_IM "\r\n\r\nFreeBSD (%h) (%t)\r\n\r\r\n\r" 21429181Smarkm# else 21529088Smarkm# define DEFAULT_IM "\r\n\r\n4.4 BSD UNIX (%h) (%t)\r\n\r\r\n\r" 21629181Smarkm# endif 21729088Smarkm# endif 21829088Smarkm#endif 219