netisr: Use netisr_ncpus to convert hash to cpuid.
[dragonfly.git] / usr.bin / tip / tip.h
blobc9e0b1ca01170fc88a57a3a7dcd25b04fc543310
1 /*
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
8 * are met:
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
28 * SUCH DAMAGE.
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>
41 #include <sys/file.h>
42 #include <sys/time.h>
43 #include <limits.h>
45 #include <sys/ioctl.h> /* for TIOCHPCL */
46 #include <sys/filio.h> /* for FIONREAD */
48 #include <signal.h>
49 #include <stdio.h>
50 #include <stdlib.h>
51 #include <string.h>
52 #include <pwd.h>
53 #include <ctype.h>
54 #include <setjmp.h>
55 #include <termios.h>
56 #include <unistd.h>
57 #include <errno.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 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 */
97 * String value table
99 typedef
100 struct {
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 */
107 value_t;
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 */
122 #define TRUE 1
123 #define FALSE 0
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 */
128 #define TMASK 017
131 * Definition of ACU line description
133 typedef
134 struct {
135 char *acu_name;
136 int (*acu_dialer)(char *, char *);
137 void (*acu_disconnect)(void);
138 void (*acu_abort)(void);
140 acu_t;
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
148 * happy.
150 typedef
151 union {
152 int zz_number;
153 short zz_boolean[2];
154 char zz_character[4];
155 int *zz_address;
157 zzhack;
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])
166 #endif
168 #if BYTE_ORDER == BIG_ENDIAN
169 #define boolean(v) ((((zzhack *)(&(v))))->zz_boolean[1])
170 #define character(v) ((((zzhack *)(&(v))))->zz_character[3])
171 #endif
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).
181 typedef
182 struct {
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 */
188 esctable_t;
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*);
198 void loginit(void);
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); }'
209 #define BEAUTIFY 0
210 #define BAUDRATE 1
211 #define DIALTIMEOUT 2
212 #define EOFREAD 3
213 #define EOFWRITE 4
214 #define EOL 5
215 #define ESCAPE 6
216 #define EXCEPTIONS 7
217 #define FORCE 8
218 #define FRAMESIZE 9
219 #define HOST 10
220 #define LOG 11
221 #define LOGIN 12
222 #define LOGOUT 13
223 #define PHONES 14
224 #define PROMPT 15
225 #define RAISE 16
226 #define RAISECHAR 17
227 #define RECORD 18
228 #define REMOTE 19
229 #define SCRIPT 20
230 #define TABEXPAND 21
231 #define VERBOSE 22
232 #define SHELL 23
233 #define HOME 24
234 #define ECHOCHECK 25
235 #define DISCONNECT 26
236 #define TAND 27
237 #define LDELAY 28
238 #define CDELAY 29
239 #define ETIMEOUT 30
240 #define RAWFTP 31
241 #define HALFDUPLEX 32
242 #define LECHO 33
243 #define PARITY 34
246 Specify default bit rate for connections
248 #define DEFBR 1200
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 */
280 char *ctrl(char);
281 char *vinterp(char *, char);
282 char *connect(void);
283 int size(char *);
284 int any(char, char *);
285 void setscript(void);
286 void tipout(void);
287 void vinit(void);
288 long hunt(char *);
289 int vstring(char *, char *);
290 void setparity(char *);
291 void vlex(char *);
292 void daemon_uid(void);
293 void disconnect(char *);
294 void shell_uid(void);
295 void unraw(void);
296 void user_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);
305 void cleanup(int);
306 void consh(int);
307 void cu_put(int);
308 void cu_take(int);
309 void dollar(int);
310 char *expand(char *);
311 void finish(int);
312 void genbrk(int);
313 void getfl(int);
314 void help(int);
315 void pipefile(int);
316 void pipeout(int);
317 void sendfile(int);
318 void shell(int);
319 int speed(int);
320 void suspend(int);
321 void timeoutfunc(int);
322 void ttysetup(int);
323 void variable(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);
334 void df_abort(void);
335 int df02_dialer(char *, char *);
336 int df03_dialer(char *, char *);
337 void df_disconnect(void);
339 void dn_abort(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);
373 void raw(void);
375 /* end of tip.h */