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