1 /* $OpenBSD: tip.h,v 1.27 2006/08/18 03:06:18 jason Exp $ */
2 /* $NetBSD: tip.h,v 1.7 1997/04/20 00:02:46 mellon Exp $ */
6 * Copyright (c) 1989, 1993
7 * The Regents of the University of California. All rights reserved.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. Neither the name of the University nor the names of its contributors
19 * may be used to endorse or promote products derived from this software
20 * without specific prior written permission.
22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * @(#)tip.h 8.1 (Berkeley) 6/6/93
38 * tip - terminal interface program
41 #include <sys/types.h>
45 #include <sys/ioctl.h>
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 long BR; /* line speed for conversation */
78 long FS; /* frame size for transfers */
80 short DU; /* this host is dialed up */
81 short HW; /* this device is hardwired, see hunt.c */
82 char *ES; /* escape character */
83 char *EX; /* exceptions */
84 char *FO; /* force (literal next) char*/
85 char *RC; /* raise character */
86 char *RE; /* script record file */
87 char *PR; /* remote prompt */
88 long DL; /* line delay for file transfers to remote */
89 long CL; /* char delay for file transfers to remote */
90 long ET; /* echocheck timeout */
91 long LD; /* line disc */
92 short HD; /* this host is half duplex - do local echo */
99 char *v_name; /* whose name is it */
100 char v_type; /* for interpreting set's */
101 char v_access; /* protection of touchy ones */
102 char *v_abrev; /* possible abbreviation */
103 char *v_value; /* casted to a union later */
107 #define STRING 01 /* string valued */
108 #define BOOL 02 /* true-false value */
109 #define NUMBER 04 /* numeric value */
110 #define CHAR 010 /* character value */
112 #define WRITE 01 /* write access to variable */
113 #define READ 02 /* read access */
115 #define CHANGED 01 /* low bit is used to show modification */
116 #define PUBLIC 1 /* public access rights */
117 #define PRIVATE 03 /* private to definer */
118 #define ROOT 05 /* root defined */
123 #define ENVIRON 020 /* initialize out of the environment */
124 #define IREMOTE 040 /* initialize out of remote structure */
125 #define INIT 0100 /* static data space used for initialization */
129 * Definition of ACU line description
134 int (*acu_dialer)(char *, char *);
135 void (*acu_disconnect)(void);
136 void (*acu_abort)(void);
140 #define equal(a, b) (strcmp(a,b)==0)/* A nice function to string compare */
143 * variable manipulation stuff --
144 * if we defined the value entry in value_t, then we couldn't
145 * initialize it in vars.c, so we cast it as needed to keep lint
149 #define value(v) vtable[v].v_value
150 #define lvalue(v) (long)vtable[v].v_value
152 #define number(v) ((long)(v))
153 #define boolean(v) ((short)(long)(v))
154 #define character(v) ((char)(long)(v))
155 #define address(v) ((long *)(v))
157 #define setnumber(v,n) do { (v) = (char *)(long)(n); } while (0)
158 #define setboolean(v,n) do { (v) = (char *)(long)(n); } while (0)
159 #define setcharacter(v,n) do { (v) = (char *)(long)(n); } while (0)
160 #define setaddress(v,n) do { (v) = (char *)(n); } while (0)
163 * Escape command table definitions --
164 * lookup in this table is performed when ``escapec'' is recognized
165 * at the beginning of a line (as defined by the eolmarks variable).
170 char e_char; /* char to match on */
171 char e_flags; /* experimental, privileged */
172 char *e_help; /* help string */
173 void (*e_func)(int); /* command */
177 #define NORM 00 /* normal protection, execute anyone */
178 #define EXP 01 /* experimental, mark it with a `*' on help */
179 #define PRIV 02 /* privileged, root execute only */
181 extern int vflag; /* verbose during reading of .tiprc file */
182 extern int noesc; /* no escape `~' char */
183 extern value_t vtable[]; /* variable table */
186 #define logent(a, b, c, d)
191 * Definition of indices into variable table so
192 * value(DEFINE) turns into a static address.
197 #define DIALTIMEOUT 2
219 #define DISCONNECT 24
225 #define HALFDUPLEX 30
228 #define HARDWAREFLOW 33
232 #define NOVAL ((value_t *)NULL)
233 #define NOACU ((acu_t *)NULL)
234 #define NOSTR ((char *)NULL)
235 #define NOFILE ((FILE *)NULL)
236 #define NOPWD ((struct passwd *)0)
238 struct termios term; /* current mode of terminal */
239 struct termios defterm; /* initial mode of terminal */
240 struct termios defchars; /* current mode with initial chars */
243 FILE *fscript; /* FILE for scripting */
245 int fildes[2]; /* file transfer synchronization channel */
246 int repdes[2]; /* read process sychronization channel */
247 int FD; /* open file descriptor to remote host */
248 int AC; /* open file descriptor to dialer (v831 only) */
249 int vflag; /* print .tiprc initialization sequence */
250 int noesc; /* no `~' escape char */
251 int sfd; /* for ~< operation */
252 pid_t tipin_pid; /* pid of tipin */
253 pid_t tipout_pid; /* pid of tipout */
254 uid_t uid, euid; /* real and effective user id's */
255 gid_t gid, egid; /* real and effective group id's */
256 int stop; /* stop transfer session flag */
257 int quit; /* same; but on other end */
258 int intflag; /* recognized interrupt */
259 int stoprompt; /* for interrupting a prompt session */
260 int timedout; /* ~> transfer timedout */
261 int cumode; /* simulating the "cu" program */
262 int bits8; /* terminal is 8-bit mode */
263 #define STRIP_PAR (bits8 ? 0377 : 0177)
265 char fname[PATH_MAX]; /* file name buffer for ~< */
266 char copyname[PATH_MAX]; /* file name buffer for ~> */
267 char ccc; /* synchronization character */
268 char *uucplock; /* name of lock file for uucp's */
270 int odisc; /* initial tty line discipline */
271 extern int disc; /* current tty discpline */
273 extern char *__progname; /* program name */
277 char *expand(char *);
278 char *getremote(char *);
279 char *interp(char *);
280 int any(int, char *);
281 int biz22w_dialer(char *, char *);
282 int biz22f_dialer(char *, char *);
283 int biz31w_dialer(char *, char *);
284 int biz31f_dialer(char *, char *);
285 int cour_dialer(char *, char *);
286 int df02_dialer(char *, char *);
287 int df03_dialer(char *, char *);
288 int dn_dialer(char *, char *);
289 int hay_dialer(char *, char *);
290 int prompt(char *, char *, size_t);
292 int t3000_dialer(char *, char *);
295 int uu_unlock(char *);
296 int v3451_dialer(char *, char *);
297 int v831_dialer(char *, char *);
298 int ven_dialer(char *, char *);
299 int vstring(char *, char *);
301 void biz22_disconnect(void);
302 void biz22_abort(void);
303 void biz31_disconnect(void);
304 void biz31_abort(void);
305 void chdirectory(int);
308 void cour_abort(void);
309 void cour_disconnect(void);
312 void cumain(int, char **);
313 void daemon_uid(void);
315 void df_disconnect(void);
316 void disconnect(char *);
318 void dn_disconnect(void);
322 void hay_abort(void);
323 void hay_disconnect(void);
325 void listvariables(int);
326 void logent(char *, char *, char *, char *);
328 void parwrite(int, char *, size_t);
333 void setparity(char *);
334 void setscript(void);
336 void shell_uid(void);
338 void t3000_disconnect(void);
339 void t3000_abort(void);
341 void tipabort(char *);
346 void v3451_abort(void);
347 void v3451_disconnect(void);
348 void v831_disconnect(void);
349 void v831_abort(void);
351 void ven_disconnect(void);
352 void ven_abort(void);