ext.h revision 57416
198937Sdes/*
2124208Sdes * Copyright (c) 1989, 1993
3124208Sdes *	The Regents of the University of California.  All rights reserved.
498937Sdes *
598937Sdes * Redistribution and use in source and binary forms, with or without
698937Sdes * modification, are permitted provided that the following conditions
798937Sdes * are met:
898937Sdes * 1. Redistributions of source code must retain the above copyright
998937Sdes *    notice, this list of conditions and the following disclaimer.
1098937Sdes * 2. Redistributions in binary form must reproduce the above copyright
1198937Sdes *    notice, this list of conditions and the following disclaimer in the
1298937Sdes *    documentation and/or other materials provided with the distribution.
1398937Sdes * 3. All advertising materials mentioning features or use of this software
1498937Sdes *    must display the following acknowledgement:
1598937Sdes *	This product includes software developed by the University of
1698937Sdes *	California, Berkeley and its contributors.
1798937Sdes * 4. Neither the name of the University nor the names of its contributors
1898937Sdes *    may be used to endorse or promote products derived from this software
1998937Sdes *    without specific prior written permission.
2098937Sdes *
2198937Sdes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2298937Sdes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2398937Sdes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2498937Sdes * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2598937Sdes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2698937Sdes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2798937Sdes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2898937Sdes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2998937Sdes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3098937Sdes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3198937Sdes * SUCH DAMAGE.
3298937Sdes *
3398937Sdes *	@(#)ext.h	8.2 (Berkeley) 12/15/93
3498937Sdes */
3598937Sdes
3698937Sdes/* $Id: ext.h,v 1.19 1999/09/05 19:15:21 assar Exp $ */
3798937Sdes
3898937Sdes#ifndef __EXT_H__
3998937Sdes#define __EXT_H__
4098937Sdes
4198937Sdes/*
4298937Sdes * Telnet server variable declarations
43124208Sdes */
4498937Sdesextern char	options[256];
4598937Sdesextern char	do_dont_resp[256];
4698937Sdesextern char	will_wont_resp[256];
4798937Sdesextern int	flowmode;	/* current flow control state */
4898937Sdesextern int	restartany;	/* restart output on any character state */
4998937Sdes#ifdef DIAGNOSTICS
5098937Sdesextern int	diagnostic;	/* telnet diagnostic capabilities */
5198937Sdes#endif /* DIAGNOSTICS */
5298937Sdesextern int	require_otp;
5398937Sdes#ifdef AUTHENTICATION
5498937Sdesextern int	auth_level;
5598937Sdes#endif
5698937Sdesextern const char *new_login;
5798937Sdes
5898937Sdesextern slcfun	slctab[NSLC + 1];	/* slc mapping table */
5998937Sdes
6098937Sdesextern char	*terminaltype;
6198937Sdes
6298937Sdes/*
6398937Sdes * I/O data buffers, pointers, and counters.
6498937Sdes */
6598937Sdesextern char	ptyobuf[BUFSIZ+NETSLOP], *pfrontp, *pbackp;
6698937Sdes
6798937Sdesextern char	netibuf[BUFSIZ], *netip;
6898937Sdes
6998937Sdesextern char	netobuf[BUFSIZ+NETSLOP], *nfrontp, *nbackp;
7098937Sdesextern char	*neturg;		/* one past last bye of urgent data */
7198937Sdes
7298937Sdesextern int	pcc, ncc;
7398937Sdes
7498937Sdesextern int	ourpty, net;
7598937Sdesextern char	*line;
7698937Sdesextern int	SYNCHing;		/* we are in TELNET SYNCH mode */
7798937Sdes
7898937Sdesint telnet_net_write (unsigned char *str, int len);
7998937Sdesvoid net_encrypt (void);
8098937Sdesint telnet_spin (void);
8198937Sdeschar *telnet_getenv (char *val);
8298937Sdeschar *telnet_gets (char *prompt, char *result, int length, int echo);
8398937Sdesvoid get_slc_defaults (void);
8498937Sdesvoid telrcv (void);
8598937Sdesvoid send_do (int option, int init);
8698937Sdesvoid willoption (int option);
8798937Sdesvoid send_dont (int option, int init);
8898937Sdesvoid wontoption (int option);
8998937Sdesvoid send_will (int option, int init);
9098937Sdesvoid dooption (int option);
9198937Sdesvoid send_wont (int option, int init);
9298937Sdesvoid dontoption (int option);
9398937Sdesvoid suboption (void);
9498937Sdesvoid doclientstat (void);
9598937Sdesvoid send_status (void);
9698937Sdesvoid init_termbuf (void);
9798937Sdesvoid set_termbuf (void);
9898937Sdesint spcset (int func, cc_t *valp, cc_t **valpp);
9998937Sdesvoid set_utid (void);
10098937Sdesint getpty (int *ptynum);
10198937Sdesint tty_isecho (void);
10298937Sdesint tty_flowmode (void);
10398937Sdesint tty_restartany (void);
104void tty_setecho (int on);
105int tty_israw (void);
106void tty_binaryin (int on);
107void tty_binaryout (int on);
108int tty_isbinaryin (void);
109int tty_isbinaryout (void);
110int tty_issofttab (void);
111void tty_setsofttab (int on);
112int tty_islitecho (void);
113void tty_setlitecho (int on);
114int tty_iscrnl (void);
115void tty_tspeed (int val);
116void tty_rspeed (int val);
117void getptyslave (void);
118int cleanopen (char *line);
119void startslave (char *host, int autologin, char *autoname);
120void init_env (void);
121void start_login (char *host, int autologin, char *name);
122void cleanup (int sig);
123int main (int argc, char **argv);
124int getterminaltype (char *name, size_t);
125void _gettermname (void);
126int terminaltypeok (char *s);
127void my_telnet (int f, int p, char*, int, char*);
128void interrupt (void);
129void sendbrk (void);
130void sendsusp (void);
131void recv_ayt (void);
132void doeof (void);
133void flowstat (void);
134void clientstat (int code, int parm1, int parm2);
135int ttloop (void);
136int stilloob (int s);
137void ptyflush (void);
138char *nextitem (char *current);
139void netclear (void);
140void netflush (void);
141void writenet (unsigned char *ptr, int len);
142void fatal (int f, char *msg);
143void fatalperror (int f, const char *msg);
144void edithost (char *pat, char *host);
145void putstr (char *s);
146void putchr (int cc);
147void putf (char *cp, char *where);
148void printoption (char *fmt, int option);
149void printsub (int direction, unsigned char *pointer, int length);
150void printdata (char *tag, char *ptr, int cnt);
151int login_tty(int t);
152
153#ifdef ENCRYPTION
154extern void	(*encrypt_output) (unsigned char *, int);
155extern int	(*decrypt_input) (int);
156extern char	*nclearto;
157#endif
158
159
160/*
161 * The following are some clocks used to decide how to interpret
162 * the relationship between various variables.
163 */
164
165struct clocks_t{
166    int
167	system,			/* what the current time is */
168	echotoggle,		/* last time user entered echo character */
169	modenegotiated,		/* last time operating mode negotiated */
170	didnetreceive,		/* last time we read data from network */
171	ttypesubopt,		/* ttype subopt is received */
172	tspeedsubopt,		/* tspeed subopt is received */
173	environsubopt,		/* environ subopt is received */
174	oenvironsubopt,		/* old environ subopt is received */
175	xdisplocsubopt,		/* xdisploc subopt is received */
176	baseline,		/* time started to do timed action */
177	gotDM;			/* when did we last see a data mark */
178};
179extern struct clocks_t clocks;
180
181extern int log_unauth;
182extern int no_warn;
183
184#ifdef STREAMSPTY
185extern int really_stream;
186#endif
187
188#ifndef USE_IM
189# ifdef CRAY
190#  define USE_IM "Cray UNICOS (%h) (%t)"
191# endif
192# ifdef _AIX
193#  define USE_IM "%s %v.%r (%h) (%t)"
194# endif
195# ifndef USE_IM
196#  define USE_IM "%s %r (%h) (%t)"
197# endif
198#endif
199
200#define DEFAULT_IM "\r\n\r\n" USE_IM "\r\n\r\n\r\n"
201
202#endif /* __EXT_H__ */
203