fix
[heimdal.git] / appl / telnet / telnetd / ext.h
blobe13c3cc2ea33a53a06421f55f4b098fbd461f28a
1 /*
2 * Copyright (c) 1989, 1993
3 * The Regents of the University of California. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
15 * This product includes software developed by the University of
16 * California, Berkeley and its contributors.
17 * 4. Neither the name of the University nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
33 * @(#)ext.h 8.2 (Berkeley) 12/15/93
36 /* $Id$ */
38 #ifndef __EXT_H__
39 #define __EXT_H__
42 * Telnet server variable declarations
44 extern char options[256];
45 extern char do_dont_resp[256];
46 extern char will_wont_resp[256];
47 extern int flowmode; /* current flow control state */
48 extern int restartany; /* restart output on any character state */
49 #ifdef DIAGNOSTICS
50 extern int diagnostic; /* telnet diagnostic capabilities */
51 #endif /* DIAGNOSTICS */
52 extern int require_otp;
53 #ifdef AUTHENTICATION
54 extern int auth_level;
55 #endif
56 extern const char *new_login;
58 extern slcfun slctab[NSLC + 1]; /* slc mapping table */
60 extern char *terminaltype;
63 * I/O data buffers, pointers, and counters.
65 extern char ptyobuf[BUFSIZ+NETSLOP], *pfrontp, *pbackp;
67 extern char netibuf[BUFSIZ], *netip;
69 extern char netobuf[BUFSIZ+NETSLOP], *nfrontp, *nbackp;
70 extern char *neturg; /* one past last bye of urgent data */
72 extern int pcc, ncc;
74 extern int ourpty, net;
75 extern char *line;
76 extern int SYNCHing; /* we are in TELNET SYNCH mode */
78 int telnet_net_write (unsigned char *str, int len);
79 void net_encrypt (void);
80 int telnet_spin (void);
81 char *telnet_getenv (char *val);
82 char *telnet_gets (char *prompt, char *result, int length, int echo);
83 void get_slc_defaults (void);
84 void telrcv (void);
85 void send_do (int option, int init);
86 void willoption (int option);
87 void send_dont (int option, int init);
88 void wontoption (int option);
89 void send_will (int option, int init);
90 void dooption (int option);
91 void send_wont (int option, int init);
92 void dontoption (int option);
93 void suboption (void);
94 void doclientstat (void);
95 void send_status (void);
96 void init_termbuf (void);
97 void set_termbuf (void);
98 int spcset (int func, cc_t *valp, cc_t **valpp);
99 void set_utid (void);
100 int getpty (int *ptynum);
101 int tty_isecho (void);
102 int tty_flowmode (void);
103 int tty_restartany (void);
104 void tty_setecho (int on);
105 int tty_israw (void);
106 void tty_binaryin (int on);
107 void tty_binaryout (int on);
108 int tty_isbinaryin (void);
109 int tty_isbinaryout (void);
110 int tty_issofttab (void);
111 void tty_setsofttab (int on);
112 int tty_islitecho (void);
113 void tty_setlitecho (int on);
114 int tty_iscrnl (void);
115 void tty_tspeed (int val);
116 void tty_rspeed (int val);
117 void getptyslave (void);
118 int cleanopen (char *line);
119 void startslave (char *host, int autologin, char *autoname);
120 void init_env (void);
121 void start_login (char *host, int autologin, char *name);
122 void cleanup (int sig);
123 int main (int argc, char **argv);
124 void usage (void);
125 int getterminaltype (char *name, size_t);
126 void _gettermname (void);
127 int terminaltypeok (char *s);
128 void doit (struct sockaddr_in *who);
129 void my_telnet (int f, int p, char*, int, char*);
130 void interrupt (void);
131 void sendbrk (void);
132 void sendsusp (void);
133 void recv_ayt (void);
134 void doeof (void);
135 void flowstat (void);
136 void clientstat (int code, int parm1, int parm2);
137 void ttloop (void);
138 int stilloob (int s);
139 void ptyflush (void);
140 char *nextitem (char *current);
141 void netclear (void);
142 void netflush (void);
143 void writenet (unsigned char *ptr, int len);
144 void fatal (int f, char *msg);
145 void fatalperror (int f, const char *msg);
146 void edithost (char *pat, char *host);
147 void putstr (char *s);
148 void putchr (int cc);
149 void putf (char *cp, char *where);
150 void printoption (char *fmt, int option);
151 void printsub (int direction, unsigned char *pointer, int length);
152 void printdata (char *tag, char *ptr, int cnt);
153 int login_tty(int t);
155 #ifdef ENCRYPTION
156 extern void (*encrypt_output) (unsigned char *, int);
157 extern int (*decrypt_input) (int);
158 extern char *nclearto;
159 #endif
163 * The following are some clocks used to decide how to interpret
164 * the relationship between various variables.
167 struct clocks_t{
169 system, /* what the current time is */
170 echotoggle, /* last time user entered echo character */
171 modenegotiated, /* last time operating mode negotiated */
172 didnetreceive, /* last time we read data from network */
173 ttypesubopt, /* ttype subopt is received */
174 tspeedsubopt, /* tspeed subopt is received */
175 environsubopt, /* environ subopt is received */
176 oenvironsubopt, /* old environ subopt is received */
177 xdisplocsubopt, /* xdisploc subopt is received */
178 baseline, /* time started to do timed action */
179 gotDM; /* when did we last see a data mark */
181 extern struct clocks_t clocks;
183 extern int log_unauth;
184 extern int no_warn;
186 #ifdef STREAMSPTY
187 extern int really_stream;
188 #endif
190 #ifndef USE_IM
191 # ifdef CRAY
192 # define USE_IM "Cray UNICOS (%h) (%t)"
193 # endif
194 # ifdef _AIX
195 # define USE_IM "%s %v.%r (%h) (%t)"
196 # endif
197 # ifndef USE_IM
198 # define USE_IM "%s %r (%h) (%t)"
199 # endif
200 #endif
202 #define DEFAULT_IM "\r\n\r\n" USE_IM "\r\n\r\n\r\n"
204 #endif /* __EXT_H__ */