2 * Copyright (c) 1989, 1993
3 * The Regents of the University of California. All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. Neither the name of the University nor the names of its contributors
15 * may be used to endorse or promote products derived from this software
16 * without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * @(#)tip.h 8.1 (Berkeley) 6/6/93
32 * $FreeBSD: src/usr.bin/tip/tip/tip.h,v 1.5.2.1 2000/07/01 12:24:23 ps Exp $
36 * tip - terminal interface program
39 #include <sys/types.h>
40 #include <machine/endian.h>
44 #include <sys/ioctl.h> /* for TIOCHPCL */
45 #include <sys/filio.h> /* for FIONREAD */
64 * Remote host attributes
66 EXTERN
char *DV
; /* UNIX device(s) to open */
67 EXTERN
char *EL
; /* chars marking an EOL */
68 EXTERN
char *CM
; /* initial connection message */
69 EXTERN
char *IE
; /* EOT to expect on input */
70 EXTERN
char *OE
; /* EOT to send to complete FT */
71 EXTERN
char *CU
; /* call unit if making a phone call */
72 EXTERN
char *AT
; /* acu type */
73 EXTERN
char *PN
; /* phone number(s) */
74 EXTERN
char *DI
; /* disconnect string */
75 EXTERN
char *PA
; /* parity to be generated */
77 EXTERN
char *PH
; /* phone number file */
78 EXTERN
char *RM
; /* remote file name */
79 EXTERN
char *HO
; /* host name */
81 EXTERN
char *LI
; /* login script */
82 EXTERN
char *LO
; /* logout script */
84 EXTERN
long BR
; /* line speed for conversation */
85 EXTERN
long FS
; /* frame size for transfers */
87 EXTERN
char DU
; /* this host is dialed up */
88 EXTERN
char HW
; /* this device is hardwired, see hunt.c */
89 EXTERN
char *ES
; /* escape character */
90 EXTERN
char *EX
; /* exceptions */
91 EXTERN
char *FO
; /* force (literal next) char*/
92 EXTERN
char *RC
; /* raise character */
93 EXTERN
char *RE
; /* script record file */
94 EXTERN
char *PR
; /* remote prompt */
95 EXTERN
long DL
; /* line delay for file transfers to remote */
96 EXTERN
long CL
; /* char delay for file transfers to remote */
97 EXTERN
long ET
; /* echocheck timeout */
98 EXTERN
char HD
; /* this host is half duplex - do local echo */
105 char *v_name
; /* whose name is it */
106 char v_type
; /* for interpreting set's */
107 char v_access
; /* protection of touchy ones */
108 char *v_abrev
; /* possible abreviation */
109 char *v_value
; /* casted to a union later */
113 #define STRING 01 /* string valued */
114 #define BOOL 02 /* true-false value */
115 #define NUMBER 04 /* numeric value */
116 #define CHAR 010 /* character value */
118 #define WRITE 01 /* write access to variable */
119 #define READ 02 /* read access */
121 #define CHANGED 01 /* low bit is used to show modification */
122 #define PUBLIC 1 /* public access rights */
123 #define PRIVATE 03 /* private to definer */
124 #define ROOT 05 /* root defined */
129 #define ENVIRON 020 /* initialize out of the environment */
130 #define IREMOTE 040 /* initialize out of remote structure */
131 #define INIT 0100 /* static data space used for initialization */
135 * Definition of ACU line description
140 int (*acu_dialer
)(char *, char *);
141 void (*acu_disconnect
)(void);
142 void (*acu_abort
)(void);
146 #define equal(a, b) (strcmp(a,b)==0)/* A nice function to string compare */
149 * variable manipulation stuff --
150 * if we defined the value entry in value_t, then we couldn't
151 * initialize it in vars.c, so we cast it as needed to keep lint
158 char zz_character
[4];
163 #define value(v) vtable[v].v_value
165 #define number(v) ((((zzhack *)(&(v))))->zz_number)
167 #if BYTE_ORDER == LITTLE_ENDIAN
168 #define boolean(v) ((((zzhack *)(&(v))))->zz_boolean[0])
169 #define character(v) ((((zzhack *)(&(v))))->zz_character[0])
172 #if BYTE_ORDER == BIG_ENDIAN
173 #define boolean(v) ((((zzhack *)(&(v))))->zz_boolean[1])
174 #define character(v) ((((zzhack *)(&(v))))->zz_character[3])
177 #define address(v) ((((zzhack *)(&(v))))->zz_address)
180 * Escape command table definitions --
181 * lookup in this table is performed when ``escapec'' is recognized
182 * at the begining of a line (as defined by the eolmarks variable).
187 char e_char
; /* char to match on */
188 char e_flags
; /* experimental, priviledged */
189 char *e_help
; /* help string */
190 void (*e_func
)(int); /* command */
194 #define NORM 00 /* normal protection, execute anyone */
195 #define EXP 01 /* experimental, mark it with a `*' on help */
196 #define PRIV 02 /* priviledged, root execute only */
198 extern value_t vtable
[]; /* variable table */
200 void logent(char *, char *, char *, char*);
204 * Definition of indices into variable table so
205 * value(DEFINE) turns into a static address.
209 'a,.!awk '{ printf("\%s \%s \%d\n", $1, $2, NR - 1); }'
214 #define DIALTIMEOUT 2
238 #define DISCONNECT 26
244 #define HALFDUPLEX 32
249 Specify default bit rate for connections
253 EXTERN
struct termios otermios
;
254 EXTERN
struct termios ctermios
;
256 EXTERN
FILE *fscript
; /* FILE for scripting */
258 EXTERN
int fildes
[2]; /* file transfer synchronization channel */
259 EXTERN
int repdes
[2]; /* read process sychronization channel */
260 EXTERN
int FD
; /* open file descriptor to remote host */
261 EXTERN
int AC
; /* open file descriptor to dialer (v831 only) */
262 EXTERN
int vflag
; /* print .tiprc initialization sequence */
263 EXTERN
int sfd
; /* for ~< operation */
264 EXTERN
int pid
; /* pid of tipout */
265 EXTERN uid_t uid
, euid
; /* real and effective user id's */
266 EXTERN gid_t gid
, egid
; /* real and effective group id's */
267 EXTERN
int stop
; /* stop transfer session flag */
268 EXTERN
int quit
; /* same; but on other end */
269 EXTERN
int intflag
; /* recognized interrupt */
270 EXTERN
int stoprompt
; /* for interrupting a prompt session */
271 EXTERN
int timedout
; /* ~> transfer timedout */
272 EXTERN
int cumode
; /* simulating the "cu" program */
274 EXTERN
char fname
[PATH_MAX
]; /* file name buffer for ~< */
275 EXTERN
char copyname
[PATH_MAX
]; /* file name buffer for ~> */
276 EXTERN
char ccc
; /* synchronization character */
277 EXTERN
char ch
; /* for tipout */
278 EXTERN
char *uucplock
; /* name of lock file for uucp's */
280 EXTERN
int odisc
; /* initial tty line discipline */
281 extern int disc
; /* current tty discpline */
284 char *vinterp(char *, char);
287 int any(char, char *);
288 void setscript(void);
289 void tipout(void) __dead2
;
292 int vstring(char *, char *);
293 void setparity(char *);
295 void daemon_uid(void);
296 void disconnect(char *);
297 void shell_uid(void);
300 void xpwrite(int, char *, int);
301 int prompt(char *, char *, size_t);
302 void tipabort(char *) __dead2
;
303 void cumain(int, char **) __dead2
;
304 char *getremote(char *);
305 char *interp(char *);
307 void chdirectory(int);
308 void cleanup(int) __dead2
;
313 char *expand(char *);
314 void finish(int) __dead2
;
324 void timeoutfunc(int);
328 void biz22_abort(void);
329 int biz22f_dialer(char *, char *);
330 int biz22w_dialer(char *, char *);
331 void biz22_disconnect(void);
333 void cour_abort(void);
334 int cour_dialer(char *, char *);
335 void cour_disconnect(void);
338 int df02_dialer(char *, char *);
339 int df03_dialer(char *, char *);
340 void df_disconnect(void);
343 int dn_dialer(char *, char *);
344 void dn_disconnect(void);
346 void hay_abort(void);
347 int hay_dialer(char *, char *);
348 void hay_disconnect(void);
350 void multitech_abort(void);
351 int multitech_dialer(char *, char *);
352 void multitech_disconnect(void);
354 void t3000_abort(void);
355 int t3000_dialer(char *, char *);
356 void t3000_disconnect(void);
358 acu_t
*unidialer_getmodem(const char *);
360 void v3451_abort(void);
361 int v3451_dialer(char *, char *);
362 void v3451_disconnect(void);
364 void v831_abort(void);
365 int v831_dialer(char *, char *);
366 void v831_disconnect(void);
368 void ven_abort(void);
369 int ven_dialer(char *, char *);
370 void ven_disconnect(void);
372 #define TL_VERBOSE 0x00000001
373 #define TL_SIGNAL_TIPOUT 0x00000002
375 int tiplink(char *cmd
, unsigned int flags
);