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>
45 #include <sys/ioctl.h> /* for TIOCHPCL */
46 #include <sys/filio.h> /* for FIONREAD */
60 * Remote host attributes
62 char *DV
; /* UNIX device(s) to open */
63 char *EL
; /* chars marking an EOL */
64 char *CM
; /* initial connection message */
65 char *IE
; /* EOT to expect on input */
66 char *OE
; /* EOT to send to complete FT */
67 char *CU
; /* call unit if making a phone call */
68 char *AT
; /* acu type */
69 char *PN
; /* phone number(s) */
70 char *DI
; /* disconnect string */
71 char *PA
; /* parity to be generated */
73 char *PH
; /* phone number file */
74 char *RM
; /* remote file name */
75 char *HO
; /* host name */
77 char *LI
; /* login script */
78 char *LO
; /* logout script */
80 long BR
; /* line speed for conversation */
81 long FS
; /* frame size for transfers */
83 char DU
; /* this host is dialed up */
84 char HW
; /* this device is hardwired, see hunt.c */
85 char *ES
; /* escape character */
86 char *EX
; /* exceptions */
87 char *FO
; /* force (literal next) char*/
88 char *RC
; /* raise character */
89 char *RE
; /* script record file */
90 char *PR
; /* remote prompt */
91 long DL
; /* line delay for file transfers to remote */
92 long CL
; /* char delay for file transfers to remote */
93 long ET
; /* echocheck timeout */
94 char HD
; /* this host is half duplex - do local echo */
101 char *v_name
; /* whose name is it */
102 char v_type
; /* for interpreting set's */
103 char v_access
; /* protection of touchy ones */
104 char *v_abrev
; /* possible abreviation */
105 char *v_value
; /* casted to a union later */
109 #define STRING 01 /* string valued */
110 #define BOOL 02 /* true-false value */
111 #define NUMBER 04 /* numeric value */
112 #define CHAR 010 /* character value */
114 #define WRITE 01 /* write access to variable */
115 #define READ 02 /* read access */
117 #define CHANGED 01 /* low bit is used to show modification */
118 #define PUBLIC 1 /* public access rights */
119 #define PRIVATE 03 /* private to definer */
120 #define ROOT 05 /* root defined */
125 #define ENVIRON 020 /* initialize out of the environment */
126 #define IREMOTE 040 /* initialize out of remote structure */
127 #define INIT 0100 /* static data space used for initialization */
131 * Definition of ACU line description
136 int (*acu_dialer
)(char *, char *);
137 void (*acu_disconnect
)(void);
138 void (*acu_abort
)(void);
142 #define equal(a, b) (strcmp(a,b)==0)/* A nice function to string compare */
145 * variable manipulation stuff --
146 * if we defined the value entry in value_t, then we couldn't
147 * initialize it in vars.c, so we cast it as needed to keep lint
154 char zz_character
[4];
159 #define value(v) vtable[v].v_value
161 #define number(v) ((((zzhack *)(&(v))))->zz_number)
163 #if BYTE_ORDER == LITTLE_ENDIAN
164 #define boolean(v) ((((zzhack *)(&(v))))->zz_boolean[0])
165 #define character(v) ((((zzhack *)(&(v))))->zz_character[0])
168 #if BYTE_ORDER == BIG_ENDIAN
169 #define boolean(v) ((((zzhack *)(&(v))))->zz_boolean[1])
170 #define character(v) ((((zzhack *)(&(v))))->zz_character[3])
173 #define address(v) ((((zzhack *)(&(v))))->zz_address)
176 * Escape command table definitions --
177 * lookup in this table is performed when ``escapec'' is recognized
178 * at the begining of a line (as defined by the eolmarks variable).
183 char e_char
; /* char to match on */
184 char e_flags
; /* experimental, priviledged */
185 char *e_help
; /* help string */
186 void (*e_func
)(int); /* command */
190 #define NORM 00 /* normal protection, execute anyone */
191 #define EXP 01 /* experimental, mark it with a `*' on help */
192 #define PRIV 02 /* priviledged, root execute only */
194 extern int vflag
; /* verbose during reading of .tiprc file */
195 extern value_t vtable
[]; /* variable table */
197 void logent(char *, char *, char *, char*);
201 * Definition of indices into variable table so
202 * value(DEFINE) turns into a static address.
206 'a,.!awk '{ printf("\%s \%s \%d\n", $1, $2, NR - 1); }'
211 #define DIALTIMEOUT 2
235 #define DISCONNECT 26
241 #define HALFDUPLEX 32
246 Specify default bit rate for connections
250 struct termios otermios
;
251 struct termios ctermios
;
253 FILE *fscript
; /* FILE for scripting */
255 int fildes
[2]; /* file transfer synchronization channel */
256 int repdes
[2]; /* read process sychronization channel */
257 int FD
; /* open file descriptor to remote host */
258 int AC
; /* open file descriptor to dialer (v831 only) */
259 int vflag
; /* print .tiprc initialization sequence */
260 int sfd
; /* for ~< operation */
261 int pid
; /* pid of tipout */
262 uid_t uid
, euid
; /* real and effective user id's */
263 gid_t gid
, egid
; /* real and effective group id's */
264 int stop
; /* stop transfer session flag */
265 int quit
; /* same; but on other end */
266 int intflag
; /* recognized interrupt */
267 int stoprompt
; /* for interrupting a prompt session */
268 int timedout
; /* ~> transfer timedout */
269 int cumode
; /* simulating the "cu" program */
271 char fname
[PATH_MAX
]; /* file name buffer for ~< */
272 char copyname
[PATH_MAX
]; /* file name buffer for ~> */
273 char ccc
; /* synchronization character */
274 char ch
; /* for tipout */
275 char *uucplock
; /* name of lock file for uucp's */
277 int odisc
; /* initial tty line discipline */
278 extern int disc
; /* current tty discpline */
281 char *vinterp(char *, char);
284 int any(char, char *);
285 void setscript(void);
289 int vstring(char *, char *);
290 void setparity(char *);
292 void daemon_uid(void);
293 void disconnect(char *);
294 void shell_uid(void);
297 void xpwrite(int, char *, int);
298 int prompt(char *, char *, size_t);
299 void tipabort(char *);
300 void cumain(int, char **);
301 char *getremote(char *);
302 char *interp(char *);
304 void chdirectory(int);
310 char *expand(char *);
321 void timeoutfunc(int);
325 void biz22_abort(void);
326 int biz22f_dialer(char *, char *);
327 int biz22w_dialer(char *, char *);
328 void biz22_disconnect(void);
330 void cour_abort(void);
331 int cour_dialer(char *, char *);
332 void cour_disconnect(void);
335 int df02_dialer(char *, char *);
336 int df03_dialer(char *, char *);
337 void df_disconnect(void);
340 int dn_dialer(char *, char *);
341 void dn_disconnect(void);
343 void hay_abort(void);
344 int hay_dialer(char *, char *);
345 void hay_disconnect(void);
347 void multitech_abort(void);
348 int multitech_dialer(char *, char *);
349 void multitech_disconnect(void);
351 void t3000_abort(void);
352 int t3000_dialer(char *, char *);
353 void t3000_disconnect(void);
355 acu_t
*unidialer_getmodem(const char *);
357 void v3451_abort(void);
358 int v3451_dialer(char *, char *);
359 void v3451_disconnect(void);
361 void v831_abort(void);
362 int v831_dialer(char *, char *);
363 void v831_disconnect(void);
365 void ven_abort(void);
366 int ven_dialer(char *, char *);
367 void ven_disconnect(void);
369 #define TL_VERBOSE 0x00000001
370 #define TL_SIGNAL_TIPOUT 0x00000002
372 int tiplink(char *cmd
, unsigned int flags
);