remove gcc34
[dragonfly.git] / crypto / heimdal-0.6.3 / appl / telnet / telnet / externs.h
blob09f058c2bec616675c617f62336d190d0057818f
1 /*
2 * Copyright (c) 1988, 1990, 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 * @(#)externs.h 8.3 (Berkeley) 5/30/95
36 /* $Id: externs.h,v 1.25 2002/08/28 20:58:23 joda Exp $ */
38 #ifndef BSD
39 # define BSD 43
40 #endif
42 #ifndef _POSIX_VDISABLE
43 # ifdef sun
44 # include <sys/param.h> /* pick up VDISABLE definition, mayby */
45 # endif
46 # ifdef VDISABLE
47 # define _POSIX_VDISABLE VDISABLE
48 # else
49 # define _POSIX_VDISABLE ((cc_t)'\377')
50 # endif
51 #endif
53 #define SUBBUFSIZE 256
55 extern int
56 autologin, /* Autologin enabled */
57 skiprc, /* Don't process the ~/.telnetrc file */
58 eight, /* use eight bit mode (binary in and/or out */
59 binary,
60 flushout, /* flush output */
61 connected, /* Are we connected to the other side? */
62 globalmode, /* Mode tty should be in */
63 telnetport, /* Are we connected to the telnet port? */
64 localflow, /* Flow control handled locally */
65 restartany, /* If flow control, restart output on any character */
66 localchars, /* we recognize interrupt/quit */
67 donelclchars, /* the user has set "localchars" */
68 showoptions,
69 wantencryption, /* User has requested encryption */
70 net, /* Network file descriptor */
71 tin, /* Terminal input file descriptor */
72 tout, /* Terminal output file descriptor */
73 crlf, /* Should '\r' be mapped to <CR><LF> (or <CR><NUL>)? */
74 autoflush, /* flush output when interrupting? */
75 autosynch, /* send interrupt characters with SYNCH? */
76 SYNCHing, /* Is the stream in telnet SYNCH mode? */
77 donebinarytoggle, /* the user has put us in binary */
78 dontlecho, /* do we suppress local echoing right now? */
79 crmod,
80 netdata, /* Print out network data flow */
81 prettydump, /* Print "netdata" output in user readable format */
82 termdata, /* Print out terminal data flow */
83 debug; /* Debug level */
85 extern int intr_happened, intr_waiting; /* for interrupt handling */
87 extern cc_t escape; /* Escape to command mode */
88 extern cc_t rlogin; /* Rlogin mode escape character */
89 #ifdef KLUDGELINEMODE
90 extern cc_t echoc; /* Toggle local echoing */
91 #endif
93 extern char
94 *prompt; /* Prompt for command. */
96 extern char
97 doopt[],
98 dont[],
99 will[],
100 wont[],
101 do_dont_resp[],
102 will_wont_resp[],
103 options[], /* All the little options */
104 *hostname; /* Who are we connected to? */
105 #if defined(ENCRYPTION)
106 extern void (*encrypt_output) (unsigned char *, int);
107 extern int (*decrypt_input) (int);
108 #endif
111 * We keep track of each side of the option negotiation.
114 #define MY_STATE_WILL 0x01
115 #define MY_WANT_STATE_WILL 0x02
116 #define MY_STATE_DO 0x04
117 #define MY_WANT_STATE_DO 0x08
120 * Macros to check the current state of things
123 #define my_state_is_do(opt) (options[opt]&MY_STATE_DO)
124 #define my_state_is_will(opt) (options[opt]&MY_STATE_WILL)
125 #define my_want_state_is_do(opt) (options[opt]&MY_WANT_STATE_DO)
126 #define my_want_state_is_will(opt) (options[opt]&MY_WANT_STATE_WILL)
128 #define my_state_is_dont(opt) (!my_state_is_do(opt))
129 #define my_state_is_wont(opt) (!my_state_is_will(opt))
130 #define my_want_state_is_dont(opt) (!my_want_state_is_do(opt))
131 #define my_want_state_is_wont(opt) (!my_want_state_is_will(opt))
133 #define set_my_state_do(opt) {options[opt] |= MY_STATE_DO;}
134 #define set_my_state_will(opt) {options[opt] |= MY_STATE_WILL;}
135 #define set_my_want_state_do(opt) {options[opt] |= MY_WANT_STATE_DO;}
136 #define set_my_want_state_will(opt) {options[opt] |= MY_WANT_STATE_WILL;}
138 #define set_my_state_dont(opt) {options[opt] &= ~MY_STATE_DO;}
139 #define set_my_state_wont(opt) {options[opt] &= ~MY_STATE_WILL;}
140 #define set_my_want_state_dont(opt) {options[opt] &= ~MY_WANT_STATE_DO;}
141 #define set_my_want_state_wont(opt) {options[opt] &= ~MY_WANT_STATE_WILL;}
144 * Make everything symmetrical
147 #define HIS_STATE_WILL MY_STATE_DO
148 #define HIS_WANT_STATE_WILL MY_WANT_STATE_DO
149 #define HIS_STATE_DO MY_STATE_WILL
150 #define HIS_WANT_STATE_DO MY_WANT_STATE_WILL
152 #define his_state_is_do my_state_is_will
153 #define his_state_is_will my_state_is_do
154 #define his_want_state_is_do my_want_state_is_will
155 #define his_want_state_is_will my_want_state_is_do
157 #define his_state_is_dont my_state_is_wont
158 #define his_state_is_wont my_state_is_dont
159 #define his_want_state_is_dont my_want_state_is_wont
160 #define his_want_state_is_wont my_want_state_is_dont
162 #define set_his_state_do set_my_state_will
163 #define set_his_state_will set_my_state_do
164 #define set_his_want_state_do set_my_want_state_will
165 #define set_his_want_state_will set_my_want_state_do
167 #define set_his_state_dont set_my_state_wont
168 #define set_his_state_wont set_my_state_dont
169 #define set_his_want_state_dont set_my_want_state_wont
170 #define set_his_want_state_wont set_my_want_state_dont
173 extern FILE
174 *NetTrace; /* Where debugging output goes */
175 extern char
176 NetTraceFile[]; /* Name of file where debugging output goes */
177 extern void
178 SetNetTrace (char *); /* Function to change where debugging goes */
180 extern jmp_buf
181 peerdied,
182 toplevel; /* For error conditions. */
184 /* authenc.c */
186 #if defined(AUTHENTICATION) || defined(ENCRYPTION)
187 int telnet_net_write(unsigned char *str, int len);
188 void net_encrypt(void);
189 int telnet_spin(void);
190 char *telnet_getenv(const char *val);
191 char *telnet_gets(char *prompt, char *result, int length, int echo);
192 #endif
194 /* commands.c */
196 struct env_lst *env_define (unsigned char *, unsigned char *);
197 struct env_lst *env_find(unsigned char *var);
198 void env_init (void);
199 void env_undefine (unsigned char *);
200 void env_export (unsigned char *);
201 void env_unexport (unsigned char *);
202 void env_send (unsigned char *);
203 void env_list (void);
204 unsigned char * env_default(int init, int welldefined);
205 unsigned char * env_getvalue(unsigned char *var);
207 void set_escape_char(char *s);
208 int sourceroute(struct addrinfo *ai, char *arg, char **cpp,
209 int *prototp, int *optp);
211 #if defined(AUTHENTICATION)
212 int auth_enable (char *);
213 int auth_disable (char *);
214 int auth_status (void);
215 #endif
217 #if defined(ENCRYPTION)
218 int EncryptEnable (char *, char *);
219 int EncryptDisable (char *, char *);
220 int EncryptType (char *, char *);
221 int EncryptStart (char *);
222 int EncryptStartInput (void);
223 int EncryptStartOutput (void);
224 int EncryptStop (char *);
225 int EncryptStopInput (void);
226 int EncryptStopOutput (void);
227 int EncryptStatus (void);
228 #endif
230 #ifdef SIGINFO
231 RETSIGTYPE ayt_status(int);
232 #endif
233 int tn(int argc, char **argv);
234 void command(int top, char *tbuf, int cnt);
236 /* main.c */
238 void tninit(void);
239 void usage(void);
240 void set_forward_options(void);
242 /* network.c */
244 void init_network(void);
245 int stilloob(void);
246 void setneturg(void);
247 int netflush(void);
249 /* sys_bsd.c */
251 void init_sys(void);
252 int TerminalWrite(char *buf, int n);
253 int TerminalRead(unsigned char *buf, int n);
254 int TerminalAutoFlush(void);
255 int TerminalSpecialChars(int c);
256 void TerminalFlushOutput(void);
257 void TerminalSaveState(void);
258 void TerminalDefaultChars(void);
259 void TerminalNewMode(int f);
260 cc_t *tcval(int func);
261 void TerminalSpeeds(long *input_speed, long *output_speed);
262 int TerminalWindowSize(long *rows, long *cols);
263 int NetClose(int fd);
264 void NetNonblockingIO(int fd, int onoff);
265 int process_rings(int netin, int netout, int netex, int ttyin, int ttyout,
266 int poll);
268 /* telnet.c */
270 void init_telnet(void);
272 void tel_leave_binary(int rw);
273 void tel_enter_binary(int rw);
274 int opt_welldefined(char *ep);
275 int telrcv(void);
276 int rlogin_susp(void);
277 void intp(void);
278 void sendbrk(void);
279 void sendabort(void);
280 void sendsusp(void);
281 void sendeof(void);
282 void sendayt(void);
284 void xmitAO(void);
285 void xmitEL(void);
286 void xmitEC(void);
289 void Dump (char, unsigned char *, int);
290 void printoption (char *, int, int);
291 void printsub (int, unsigned char *, int);
292 void sendnaws (void);
293 void setconnmode (int);
294 void setcommandmode (void);
295 void setneturg (void);
296 void sys_telnet_init (void);
297 void my_telnet (char *);
298 void tel_enter_binary (int);
299 void TerminalFlushOutput (void);
300 void TerminalNewMode (int);
301 void TerminalRestoreState (void);
302 void TerminalSaveState (void);
303 void willoption (int);
304 void wontoption (int);
307 void send_do (int, int);
308 void send_dont (int, int);
309 void send_will (int, int);
310 void send_wont (int, int);
312 void lm_will (unsigned char *, int);
313 void lm_wont (unsigned char *, int);
314 void lm_do (unsigned char *, int);
315 void lm_dont (unsigned char *, int);
316 void lm_mode (unsigned char *, int, int);
318 void slc_init (void);
319 void slcstate (void);
320 void slc_mode_export (void);
321 void slc_mode_import (int);
322 void slc_import (int);
323 void slc_export (void);
324 void slc (unsigned char *, int);
325 void slc_check (void);
326 void slc_start_reply (void);
327 void slc_add_reply (unsigned char, unsigned char, cc_t);
328 void slc_end_reply (void);
329 int slc_update (void);
331 void env_opt (unsigned char *, int);
332 void env_opt_start (void);
333 void env_opt_start_info (void);
334 void env_opt_add (unsigned char *);
335 void env_opt_end (int);
337 unsigned char *env_default (int, int);
338 unsigned char *env_getvalue (unsigned char *);
340 int get_status (void);
341 int dosynch (void);
343 cc_t *tcval (int);
345 int quit (void);
347 /* terminal.c */
349 void init_terminal(void);
350 int ttyflush(int drop);
351 int getconnmode(void);
353 /* utilities.c */
355 int SetSockOpt(int fd, int level, int option, int yesno);
356 void SetNetTrace(char *file);
357 void Dump(char direction, unsigned char *buffer, int length);
358 void printoption(char *direction, int cmd, int option);
359 void optionstatus(void);
360 void printsub(int direction, unsigned char *pointer, int length);
361 void EmptyTerminal(void);
362 void SetForExit(void);
363 void Exit(int returnCode);
364 void ExitString(char *string, int returnCode);
366 extern struct termios new_tc;
368 # define termEofChar new_tc.c_cc[VEOF]
369 # define termEraseChar new_tc.c_cc[VERASE]
370 # define termIntChar new_tc.c_cc[VINTR]
371 # define termKillChar new_tc.c_cc[VKILL]
372 # define termQuitChar new_tc.c_cc[VQUIT]
374 # ifndef VSUSP
375 extern cc_t termSuspChar;
376 # else
377 # define termSuspChar new_tc.c_cc[VSUSP]
378 # endif
379 # if defined(VFLUSHO) && !defined(VDISCARD)
380 # define VDISCARD VFLUSHO
381 # endif
382 # ifndef VDISCARD
383 extern cc_t termFlushChar;
384 # else
385 # define termFlushChar new_tc.c_cc[VDISCARD]
386 # endif
387 # ifndef VWERASE
388 extern cc_t termWerasChar;
389 # else
390 # define termWerasChar new_tc.c_cc[VWERASE]
391 # endif
392 # ifndef VREPRINT
393 extern cc_t termRprntChar;
394 # else
395 # define termRprntChar new_tc.c_cc[VREPRINT]
396 # endif
397 # ifndef VLNEXT
398 extern cc_t termLiteralNextChar;
399 # else
400 # define termLiteralNextChar new_tc.c_cc[VLNEXT]
401 # endif
402 # ifndef VSTART
403 extern cc_t termStartChar;
404 # else
405 # define termStartChar new_tc.c_cc[VSTART]
406 # endif
407 # ifndef VSTOP
408 extern cc_t termStopChar;
409 # else
410 # define termStopChar new_tc.c_cc[VSTOP]
411 # endif
412 # ifndef VEOL
413 extern cc_t termForw1Char;
414 # else
415 # define termForw1Char new_tc.c_cc[VEOL]
416 # endif
417 # ifndef VEOL2
418 extern cc_t termForw2Char;
419 # else
420 # define termForw2Char new_tc.c_cc[VEOL]
421 # endif
422 # ifndef VSTATUS
423 extern cc_t termAytChar;
424 #else
425 # define termAytChar new_tc.c_cc[VSTATUS]
426 #endif
428 /* Ring buffer structures which are shared */
430 extern Ring
431 netoring,
432 netiring,
433 ttyoring,
434 ttyiring;
436 extern int resettermname;
437 extern int linemode;
438 #ifdef KLUDGELINEMODE
439 extern int kludgelinemode;
440 #endif
441 extern int want_status_response;