ext.h revision 78527
1697Spaul/*
21156Sjkh * Copyright (c) 1989, 1993
31156Sjkh *	The Regents of the University of California.  All rights reserved.
41156Sjkh *
51156Sjkh * Redistribution and use in source and binary forms, with or without
61156Sjkh * modification, are permitted provided that the following conditions
71156Sjkh * are met:
81156Sjkh * 1. Redistributions of source code must retain the above copyright
91156Sjkh *    notice, this list of conditions and the following disclaimer.
101156Sjkh * 2. Redistributions in binary form must reproduce the above copyright
111156Sjkh *    notice, this list of conditions and the following disclaimer in the
121156Sjkh *    documentation and/or other materials provided with the distribution.
131156Sjkh * 3. All advertising materials mentioning features or use of this software
141156Sjkh *    must display the following acknowledgement:
151156Sjkh *	This product includes software developed by the University of
161156Sjkh *	California, Berkeley and its contributors.
1713771Smpp * 4. Neither the name of the University nor the names of its contributors
181156Sjkh *    may be used to endorse or promote products derived from this software
191156Sjkh *    without specific prior written permission.
201156Sjkh *
211156Sjkh * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
221156Sjkh * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
231156Sjkh * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
241156Sjkh * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
251156Sjkh * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
261156Sjkh * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
271156Sjkh * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
281156Sjkh * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
291156Sjkh * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3050473Speter * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
311156Sjkh * SUCH DAMAGE.
321156Sjkh *
33102286Speter *	@(#)ext.h	8.2 (Berkeley) 12/15/93
34 */
35
36/* $Id: ext.h,v 1.22 2001/04/24 23:12:11 assar Exp $ */
37
38#ifndef __EXT_H__
39#define __EXT_H__
40
41/*
42 * Telnet server variable declarations
43 */
44extern char	options[256];
45extern char	do_dont_resp[256];
46extern char	will_wont_resp[256];
47extern int	flowmode;	/* current flow control state */
48extern int	restartany;	/* restart output on any character state */
49#ifdef DIAGNOSTICS
50extern int	diagnostic;	/* telnet diagnostic capabilities */
51#endif /* DIAGNOSTICS */
52extern int	require_otp;
53#ifdef AUTHENTICATION
54extern int	auth_level;
55#endif
56extern const char *new_login;
57
58extern slcfun	slctab[NSLC + 1];	/* slc mapping table */
59
60extern char	*terminaltype;
61
62/*
63 * I/O data buffers, pointers, and counters.
64 */
65extern char	ptyobuf[BUFSIZ+NETSLOP], *pfrontp, *pbackp;
66
67extern char	netibuf[BUFSIZ], *netip;
68
69extern char	netobuf[BUFSIZ+NETSLOP], *nfrontp, *nbackp;
70extern char	*neturg;		/* one past last bye of urgent data */
71
72extern int	pcc, ncc;
73
74extern int	ourpty, net;
75extern char	*line;
76extern int	SYNCHing;		/* we are in TELNET SYNCH mode */
77
78int telnet_net_write (unsigned char *str, int len);
79void net_encrypt (void);
80int telnet_spin (void);
81char *telnet_getenv (const char *val);
82char *telnet_gets (char *prompt, char *result, int length, int echo);
83void get_slc_defaults (void);
84void telrcv (void);
85void send_do (int option, int init);
86void willoption (int option);
87void send_dont (int option, int init);
88void wontoption (int option);
89void send_will (int option, int init);
90void dooption (int option);
91void send_wont (int option, int init);
92void dontoption (int option);
93void suboption (void);
94void doclientstat (void);
95void send_status (void);
96void init_termbuf (void);
97void set_termbuf (void);
98int spcset (int func, cc_t *valp, cc_t **valpp);
99void set_utid (void);
100int getpty (int *ptynum);
101int tty_isecho (void);
102int tty_flowmode (void);
103int 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 (const char *host, const char *, int autologin, char *autoname);
120void init_env (void);
121void start_login (const 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, const char*, const 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 fatalperror_errno (int f, const char *msg, int error);
145void edithost (char *pat, char *host);
146void putstr (char *s);
147void putchr (int cc);
148void putf (char *cp, char *where);
149void printoption (char *fmt, int option);
150void printsub (int direction, unsigned char *pointer, int length);
151void printdata (char *tag, char *ptr, int cnt);
152int login_tty(int t);
153
154#ifdef ENCRYPTION
155extern void	(*encrypt_output) (unsigned char *, int);
156extern int	(*decrypt_input) (int);
157extern char	*nclearto;
158#endif
159
160
161/*
162 * The following are some clocks used to decide how to interpret
163 * the relationship between various variables.
164 */
165
166struct clocks_t{
167    int
168	system,			/* what the current time is */
169	echotoggle,		/* last time user entered echo character */
170	modenegotiated,		/* last time operating mode negotiated */
171	didnetreceive,		/* last time we read data from network */
172	ttypesubopt,		/* ttype subopt is received */
173	tspeedsubopt,		/* tspeed subopt is received */
174	environsubopt,		/* environ subopt is received */
175	oenvironsubopt,		/* old environ subopt is received */
176	xdisplocsubopt,		/* xdisploc subopt is received */
177	baseline,		/* time started to do timed action */
178	gotDM;			/* when did we last see a data mark */
179};
180extern struct clocks_t clocks;
181
182extern int log_unauth;
183extern int no_warn;
184
185#ifdef STREAMSPTY
186extern int really_stream;
187#endif
188
189#ifndef USE_IM
190# ifdef CRAY
191#  define USE_IM "Cray UNICOS (%h) (%t)"
192# endif
193# ifdef _AIX
194#  define USE_IM "%s %v.%r (%h) (%t)"
195# endif
196# ifndef USE_IM
197#  define USE_IM "%s %r (%h) (%t)"
198# endif
199#endif
200
201#define DEFAULT_IM "\r\n\r\n" USE_IM "\r\n\r\n\r\n"
202
203#endif /* __EXT_H__ */
204