]>
git.saurik.com Git - apple/network_cmds.git/blob - telnet.tproj/externs.h
2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
7 * Reserved. This file contains Original Code and/or Modifications of
8 * Original Code as defined in and that are subject to the Apple Public
9 * Source License Version 1.0 (the 'License'). You may not use this file
10 * except in compliance with the License. Please obtain a copy of the
11 * License at http://www.apple.com/publicsource and read it before using
14 * The Original Code and all software distributed under the License are
15 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
19 * License for the specific language governing rights and limitations
22 * @APPLE_LICENSE_HEADER_END@
25 * Copyright (c) 1988, 1990, 1993
26 * The Regents of the University of California. All rights reserved.
28 * Redistribution and use in source and binary forms, with or without
29 * modification, are permitted provided that the following conditions
31 * 1. Redistributions of source code must retain the above copyright
32 * notice, this list of conditions and the following disclaimer.
33 * 2. Redistributions in binary form must reproduce the above copyright
34 * notice, this list of conditions and the following disclaimer in the
35 * documentation and/or other materials provided with the distribution.
36 * 3. All advertising materials mentioning features or use of this software
37 * must display the following acknowledgement:
38 * This product includes software developed by the University of
39 * California, Berkeley and its contributors.
40 * 4. Neither the name of the University nor the names of its contributors
41 * may be used to endorse or promote products derived from this software
42 * without specific prior written permission.
44 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
45 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
46 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
47 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
48 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
49 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
50 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
51 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
52 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
53 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
56 * @(#)externs.h 8.3 (Berkeley) 5/30/95
64 * ucb stdio.h defines BSD as something wierd
66 #if defined(sun) && defined(__svr4__)
71 # if BSD > 43 || defined(SYSV_TERMIO)
78 #if defined(CRAY) && !defined(NO_BSD_SETJMP)
79 #include <bsdsetjmp.h>
82 #include <sys/ioctl.h>
84 #include <sys/filio.h>
92 # include <sys/termio.h>
94 # include <sys/termios.h>
95 # define termio termios
99 #if defined(NO_CC_T) || !defined(USE_TERMIO)
100 # if !defined(USE_TERMIO)
103 typedef unsigned char cc_t
;
113 #ifndef _POSIX_VDISABLE
115 # include <sys/param.h> /* pick up VDISABLE definition, mayby */
118 # define _POSIX_VDISABLE VDISABLE
120 # define _POSIX_VDISABLE ((cc_t)'\377')
124 #define SUBBUFSIZE 256
127 extern int errno
; /* outside this world */
139 autologin
, /* Autologin enabled */
140 skiprc
, /* Don't process the ~/.telnetrc file */
141 eight
, /* use eight bit mode (binary in and/or out */
142 flushout
, /* flush output */
143 connected
, /* Are we connected to the other side? */
144 globalmode
, /* Mode tty should be in */
145 In3270
, /* Are we in 3270 mode? */
146 telnetport
, /* Are we connected to the telnet port? */
147 localflow
, /* Flow control handled locally */
148 restartany
, /* If flow control, restart output on any character */
149 localchars
, /* we recognize interrupt/quit */
150 donelclchars
, /* the user has set "localchars" */
152 net
, /* Network file descriptor */
153 tin
, /* Terminal input file descriptor */
154 tout
, /* Terminal output file descriptor */
155 crlf
, /* Should '\r' be mapped to <CR><LF> (or <CR><NUL>)? */
156 autoflush
, /* flush output when interrupting? */
157 autosynch
, /* send interrupt characters with SYNCH? */
158 SYNCHing
, /* Is the stream in telnet SYNCH mode? */
159 donebinarytoggle
, /* the user has put us in binary */
160 dontlecho
, /* do we suppress local echoing right now? */
162 netdata
, /* Print out network data flow */
163 prettydump
, /* Print "netdata" output in user readable format */
164 #if defined(unix) || defined(__APPLE__)
166 cursesdata
, /* Print out curses data flow */
167 apitrace
, /* Trace API transactions */
168 #endif /* defined(TN3270) */
169 termdata
, /* Print out terminal data flow */
170 #endif /* defined(unix) || defined(__APPLE__) */
171 debug
; /* Debug level */
173 extern cc_t escape
; /* Escape to command mode */
174 extern cc_t rlogin
; /* Rlogin mode escape character */
175 #ifdef KLUDGELINEMODE
176 extern cc_t echoc
; /* Toggle local echoing */
180 *prompt
; /* Prompt for command. */
187 options
[], /* All the little options */
188 *hostname
; /* Who are we connected to? */
190 extern void (*encrypt_output
) P((unsigned char *, int));
191 extern int (*decrypt_input
) P((int));
192 #endif /* ENCRYPTION */
195 * We keep track of each side of the option negotiation.
198 #define MY_STATE_WILL 0x01
199 #define MY_WANT_STATE_WILL 0x02
200 #define MY_STATE_DO 0x04
201 #define MY_WANT_STATE_DO 0x08
204 * Macros to check the current state of things
207 #define my_state_is_do(opt) (options[opt]&MY_STATE_DO)
208 #define my_state_is_will(opt) (options[opt]&MY_STATE_WILL)
209 #define my_want_state_is_do(opt) (options[opt]&MY_WANT_STATE_DO)
210 #define my_want_state_is_will(opt) (options[opt]&MY_WANT_STATE_WILL)
212 #define my_state_is_dont(opt) (!my_state_is_do(opt))
213 #define my_state_is_wont(opt) (!my_state_is_will(opt))
214 #define my_want_state_is_dont(opt) (!my_want_state_is_do(opt))
215 #define my_want_state_is_wont(opt) (!my_want_state_is_will(opt))
217 #define set_my_state_do(opt) {options[opt] |= MY_STATE_DO;}
218 #define set_my_state_will(opt) {options[opt] |= MY_STATE_WILL;}
219 #define set_my_want_state_do(opt) {options[opt] |= MY_WANT_STATE_DO;}
220 #define set_my_want_state_will(opt) {options[opt] |= MY_WANT_STATE_WILL;}
222 #define set_my_state_dont(opt) {options[opt] &= ~MY_STATE_DO;}
223 #define set_my_state_wont(opt) {options[opt] &= ~MY_STATE_WILL;}
224 #define set_my_want_state_dont(opt) {options[opt] &= ~MY_WANT_STATE_DO;}
225 #define set_my_want_state_wont(opt) {options[opt] &= ~MY_WANT_STATE_WILL;}
228 * Make everything symetrical
231 #define HIS_STATE_WILL MY_STATE_DO
232 #define HIS_WANT_STATE_WILL MY_WANT_STATE_DO
233 #define HIS_STATE_DO MY_STATE_WILL
234 #define HIS_WANT_STATE_DO MY_WANT_STATE_WILL
236 #define his_state_is_do my_state_is_will
237 #define his_state_is_will my_state_is_do
238 #define his_want_state_is_do my_want_state_is_will
239 #define his_want_state_is_will my_want_state_is_do
241 #define his_state_is_dont my_state_is_wont
242 #define his_state_is_wont my_state_is_dont
243 #define his_want_state_is_dont my_want_state_is_wont
244 #define his_want_state_is_wont my_want_state_is_dont
246 #define set_his_state_do set_my_state_will
247 #define set_his_state_will set_my_state_do
248 #define set_his_want_state_do set_my_want_state_will
249 #define set_his_want_state_will set_my_want_state_do
251 #define set_his_state_dont set_my_state_wont
252 #define set_his_state_wont set_my_state_dont
253 #define set_his_want_state_dont set_my_want_state_wont
254 #define set_his_want_state_wont set_my_want_state_dont
258 *NetTrace
; /* Where debugging output goes */
260 NetTraceFile
[]; /* Name of file where debugging output goes */
262 SetNetTrace
P((char *)); /* Function to change where debugging goes */
266 toplevel
; /* For error conditions. */
269 command
P((int, char *, int)),
270 Dump
P((int, unsigned char *, int)),
272 printoption
P((char *, int, int)),
273 printsub
P((int, unsigned char *, int)),
275 setconnmode
P((int)),
276 setcommandmode
P((void)),
278 sys_telnet_init
P((void)),
280 tel_enter_binary
P((int)),
281 TerminalFlushOutput
P((void)),
282 TerminalNewMode
P((int)),
283 TerminalRestoreState
P((void)),
284 TerminalSaveState
P((void)),
291 send_do
P((int, int)),
292 send_dont
P((int, int)),
293 send_will
P((int, int)),
294 send_wont
P((int, int));
297 lm_will
P((unsigned char *, int)),
298 lm_wont
P((unsigned char *, int)),
299 lm_do
P((unsigned char *, int)),
300 lm_dont
P((unsigned char *, int)),
301 lm_mode
P((unsigned char *, int, int));
306 slc_mode_export
P((void)),
307 slc_mode_import
P((int)),
309 slc_export
P((void)),
310 slc
P((unsigned char *, int)),
312 slc_start_reply
P((void)),
313 slc_add_reply
P((int, int, int)),
314 slc_end_reply
P((void));
316 slc_update
P((void));
319 env_opt
P((unsigned char *, int)),
320 env_opt_start
P((void)),
321 env_opt_start_info
P((void)),
322 env_opt_add
P((unsigned char *)),
323 env_opt_end
P((int));
326 *env_default
P((int, int)),
327 *env_getvalue
P((unsigned char *));
330 get_status
P((void)),
338 extern struct tchars ntc
;
339 extern struct ltchars nltc
;
340 extern struct sgttyb nttyb
;
342 # define termEofChar ntc.t_eofc
343 # define termEraseChar nttyb.sg_erase
344 # define termFlushChar nltc.t_flushc
345 # define termIntChar ntc.t_intrc
346 # define termKillChar nttyb.sg_kill
347 # define termLiteralNextChar nltc.t_lnextc
348 # define termQuitChar ntc.t_quitc
349 # define termSuspChar nltc.t_suspc
350 # define termRprntChar nltc.t_rprntc
351 # define termWerasChar nltc.t_werasc
352 # define termStartChar ntc.t_startc
353 # define termStopChar ntc.t_stopc
354 # define termForw1Char ntc.t_brkc
355 extern cc_t termForw2Char
;
356 extern cc_t termAytChar
;
358 # define termEofCharp (cc_t *)&ntc.t_eofc
359 # define termEraseCharp (cc_t *)&nttyb.sg_erase
360 # define termFlushCharp (cc_t *)&nltc.t_flushc
361 # define termIntCharp (cc_t *)&ntc.t_intrc
362 # define termKillCharp (cc_t *)&nttyb.sg_kill
363 # define termLiteralNextCharp (cc_t *)&nltc.t_lnextc
364 # define termQuitCharp (cc_t *)&ntc.t_quitc
365 # define termSuspCharp (cc_t *)&nltc.t_suspc
366 # define termRprntCharp (cc_t *)&nltc.t_rprntc
367 # define termWerasCharp (cc_t *)&nltc.t_werasc
368 # define termStartCharp (cc_t *)&ntc.t_startc
369 # define termStopCharp (cc_t *)&ntc.t_stopc
370 # define termForw1Charp (cc_t *)&ntc.t_brkc
371 # define termForw2Charp (cc_t *)&termForw2Char
372 # define termAytCharp (cc_t *)&termAytChar
376 extern struct termio new_tc
;
378 # define termEofChar new_tc.c_cc[VEOF]
379 # define termEraseChar new_tc.c_cc[VERASE]
380 # define termIntChar new_tc.c_cc[VINTR]
381 # define termKillChar new_tc.c_cc[VKILL]
382 # define termQuitChar new_tc.c_cc[VQUIT]
385 extern cc_t termSuspChar
;
387 # define termSuspChar new_tc.c_cc[VSUSP]
389 # if defined(VFLUSHO) && !defined(VDISCARD)
390 # define VDISCARD VFLUSHO
393 extern cc_t termFlushChar
;
395 # define termFlushChar new_tc.c_cc[VDISCARD]
398 extern cc_t termWerasChar
;
400 # define termWerasChar new_tc.c_cc[VWERASE]
403 extern cc_t termRprntChar
;
405 # define termRprntChar new_tc.c_cc[VREPRINT]
408 extern cc_t termLiteralNextChar
;
410 # define termLiteralNextChar new_tc.c_cc[VLNEXT]
413 extern cc_t termStartChar
;
415 # define termStartChar new_tc.c_cc[VSTART]
418 extern cc_t termStopChar
;
420 # define termStopChar new_tc.c_cc[VSTOP]
423 extern cc_t termForw1Char
;
425 # define termForw1Char new_tc.c_cc[VEOL]
428 extern cc_t termForw2Char
;
430 # define termForw2Char new_tc.c_cc[VEOL]
433 extern cc_t termAytChar
;
435 # define termAytChar new_tc.c_cc[VSTATUS]
438 # if !defined(CRAY) || defined(__STDC__)
439 # define termEofCharp &termEofChar
440 # define termEraseCharp &termEraseChar
441 # define termIntCharp &termIntChar
442 # define termKillCharp &termKillChar
443 # define termQuitCharp &termQuitChar
444 # define termSuspCharp &termSuspChar
445 # define termFlushCharp &termFlushChar
446 # define termWerasCharp &termWerasChar
447 # define termRprntCharp &termRprntChar
448 # define termLiteralNextCharp &termLiteralNextChar
449 # define termStartCharp &termStartChar
450 # define termStopCharp &termStopChar
451 # define termForw1Charp &termForw1Char
452 # define termForw2Charp &termForw2Char
453 # define termAytCharp &termAytChar
455 /* Work around a compiler bug */
456 # define termEofCharp 0
457 # define termEraseCharp 0
458 # define termIntCharp 0
459 # define termKillCharp 0
460 # define termQuitCharp 0
461 # define termSuspCharp 0
462 # define termFlushCharp 0
463 # define termWerasCharp 0
464 # define termRprntCharp 0
465 # define termLiteralNextCharp 0
466 # define termStartCharp 0
467 # define termStopCharp 0
468 # define termForw1Charp 0
469 # define termForw2Charp 0
470 # define termAytCharp 0
475 /* Ring buffer structures which are shared */
487 HaveInput
, /* Whether an asynchronous I/O indication came in */
488 noasynchtty
, /* Don't do signals on I/O (SIGURG, SIGIO) */
489 noasynchnet
, /* Don't do signals on I/O (SIGURG, SIGIO) */
490 sigiocount
, /* Count of SIGIO receptions */
491 shell_active
; /* Subshell is active */
494 *Ibackp
, /* Oldest byte of 3270 data */
495 Ibuf
[], /* 3270 buffer */
496 *Ifrontp
, /* Where next 3270 byte goes */
498 *transcom
; /* Transparent command */
501 settranscom
P((int, char**));
504 inputAvailable
P((int));
505 #endif /* defined(TN3270) */