Home | History | Annotate | Line # | Download | only in telnetd
      1 /*	$NetBSD: ext.h,v 1.23 2020/04/23 00:03:40 joerg 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[41];
     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(void),
     81 	add_slc(char, char, cc_t),
     82 	check_slc(void),
     83 	change_slc(int, int, cc_t),
     84 	cleanup(int) __dead,
     85 	clientstat(int, int, int),
     86 	copy_termbuf(char *, int),
     87 	deferslc(void),
     88 	defer_terminit(void),
     89 	do_opt_slc(unsigned char *, int),
     90 	doeof(void),
     91 	dooption(int),
     92 	dontoption(int),
     93 	edithost(const char *, const char *),
     94 	fatal(int, const char *) __dead,
     95 	fatalperror(int, const char *) __dead,
     96 	get_slc_defaults(void),
     97 	init_env(void),
     98 	init_termbuf(void),
     99 	interrupt(void),
    100 	localstat(void),
    101 	flowstat(void),
    102 	netclear(void),
    103 	netflush(void),
    104 #ifdef DIAGNOSTICS
    105 	printoption(const char *, int),
    106 	printdata(const char *, char *, int),
    107 #ifndef ENCRYPTION
    108 	printsub(int, unsigned char *, int),
    109 #endif
    110 #endif
    111 	ptyflush(void),
    112 	putchr(int),
    113 	recv_ayt(void),
    114 	send_do(int, int),
    115 	send_dont(int, int),
    116 	send_slc(void),
    117 	send_status(void),
    118 	send_will(int, int),
    119 	send_wont(int, int),
    120 	sendbrk(void),
    121 	sendsusp(void),
    122 	set_termbuf(void),
    123 	start_login(char *, int, char *) __dead,
    124 	start_slc(int),
    125 	startslave(char *, int, char *),
    126 	suboption(void),
    127 	telrcv(void),
    128 	ttloop(void),
    129 	tty_binaryin(int),
    130 	tty_binaryout(int);
    131 
    132 extern char *
    133 	putf(const char *, char *);
    134 
    135 extern int
    136 	end_slc(unsigned char **),
    137 	getnpty(void),
    138 	getpty(int *),
    139 	spcset(int, cc_t *, cc_t **),
    140 	stilloob(int),
    141 	terminit(void),
    142 	termstat(void),
    143 	tty_flowmode(void),
    144 	tty_restartany(void),
    145 	tty_isbinaryin(void),
    146 	tty_isbinaryout(void),
    147 	tty_iscrnl(void),
    148 	tty_isecho(void),
    149 	tty_isediting(void),
    150 	tty_islitecho(void),
    151 	tty_isnewmap(void),
    152 	tty_israw(void),
    153 	tty_issofttab(void),
    154 	tty_istrapsig(void),
    155 	tty_linemode(void);
    156 
    157 extern void
    158 	tty_rspeed(int),
    159 	tty_setecho(int),
    160 	tty_setedit(int),
    161 	tty_setlinemode(int),
    162 	tty_setlitecho(int),
    163 	tty_setsig(int),
    164 	tty_setsofttab(int),
    165 	tty_tspeed(int),
    166 	willoption(int),
    167 	wontoption(int),
    168 	writenet(unsigned char *, int);
    169 
    170 extern int output_data(const char *, ...)
    171 	__attribute__((__format__(__printf__, 1, 2)));
    172 extern int output_datalen(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 clockstate {
    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