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