xref: /original-bsd/usr.bin/uucp/includes/uucp.h (revision 170d87a4)
1 /*-
2  * Copyright (c) 1985, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * %sccs.include.proprietary.c%
6  *
7  *	@(#)uucp.h	8.1 (Berkeley) 06/06/93
8  */
9 
10 #include <stdio.h>
11 
12 /*
13  * Determine local uucp name of this machine.
14  * Define one of the following:
15  *
16  * For UCB 4.1A and later systems, you will have the gethostname(2) call.
17  * If this call exists, define GETHOSTNAME.
18  *
19  * For USG 3.0 and later systems, you will have the uname(2) call.
20  * If this call exists, define UNAME.
21  *
22  * Some systems have a line of the form '#define sysname "myuucpname",'
23  * in the file /usr/include/whoami.h, to identify their machine.
24  * If your site does that, define WHOAMI.
25  *
26  * If your site has <whoami.h>, but you do not want to read
27  * that file every time uucp runs, you can compile sysname into uucp.
28  * This is faster and more reliable, but binaries do not port.
29  * If you want to do that, define CCWHOAMI.
30  *
31  * Some systems put the local uucp name in a single-line file
32  * named /etc/uucpname or /local/uucpname.
33  * If your site does that, define UUNAME.
34  *
35  * You should also define MYNAME to be your uucp name.
36  *
37  * For each of the above that are defined, uucp checks them in order.
38  * It stops on the first method that returns a non null name.
39  * If everything fails, it uses "unknown" for the system name.
40  */
41 #define	GETHOSTNAME	/**/
42 /* #define UNAME	/**/
43 /* #define WHOAMI	/**/
44 /* #define CCWHOAMI	/**/
45 /* #define UUNAME	/**/
46 /* If the above fails ... */
47 #define	MYNAME	"erehwon"
48 
49 /*
50  * Define the various kinds of connections to include.
51  * The complete list is in the condevs array in condevs.c
52  */
53 #define ATT2224		/* AT&T 2224 */
54 #define BSDTCP		/* 4.2bsd TCP/IP */
55 #define CDS224		/* Concord Data Systems 2400 */
56 /* #define DATAKIT	/* ATT's datakit */
57 #define DF02		/* Dec's DF02/DF03 */
58 #define DF112		/* Dec's DF112 */
59 #define DN11		/* "standard" DEC dialer */
60 #define HAYES		/* Hayes' Smartmodem */
61 #define HAYES2400	/* Hayes' 2400 baud Smartmodem */
62 /* #define MICOM	/* Micom Mux port */
63 #define NOVATION	/* Novation modem */
64 #define PAD		/* X.25 PAD */
65 #define PENRIL		/* PENRIL Dialer */
66 /* #define PNET		/* Purdue network */
67 #define RVMACS		/* Racal-Vadic MACS  820 dialer, 831 adaptor */
68 /* #define SYTEK	/* Sytek Local Area Net */
69 /* #define UNETTCP	/* 3Com's UNET */
70 #define USR2400		/* USRobotics Courier 2400 */
71 #define VA212		/* Racal-Vadic 212 */
72 #define VA811S		/* Racal-Vadic 811S dialer, 831 adaptor */
73 #define VA820		/* Racal-Vadic 820 dialer, 831 adaptor */
74 #define VADIC		/* Racal-Vadic 345x */
75 #define VENTEL		/* Ventel Dialer */
76 #define VMACS		/* Racal-Vadic MACS  811 dialer, 831 adaptor */
77 
78 #if defined(USR2400) && !defined(HAYES)
79 #define HAYES
80 #endif /* USR2400 && !HAYES */
81 
82 #if defined(UNETTCP) || defined(BSDTCP)
83 #define TCPIP
84 #endif
85 
86 /*
87  * We need a timer to write slowly to certain modems.
88  * and for generating breaks.
89  *
90  * define INTERVALTIMER to use 4.[23] bsd interval timer.
91  * define FASTTIMER if you have the nap() system call.
92  * define FTIME if you have the ftime() system call.
93  * define BUSYLOOP if you must do a busy loop.
94  * Look at uucpdelay() in condevs.c for details.
95  */
96 #define	INTERVALTIMER
97 /*#define FASTTIMER /**/
98 /*#define FTIME /**/
99 /*#define BUSYLOOP /**/
100 
101 /*
102  * If your site is using "ndir.h" to retrofit the Berkeley
103  * directory reading routines, define NDIR.
104  * You will probably also have to set LIBNDIR in Makefile.
105  * Otherwise, <dir.h> is assumed to have the Berkeley directory definitions.
106  */
107 /*#define	NDIR	/**/
108 
109 /*
110  * If yours is a BTL system III, IV, V or so-on site, define USG.
111  */
112 /*#define	USG	/**/
113 
114 /*
115  * If you are running 4.3bsd, define BSD4_3 and BSD4_2
116  * If you are just running 4.2bsd, define BSD4_2
117  * If you are running the BRL version of 4.2BSD define BRL4_2, NOT BSD4_3
118  */
119 #ifndef BSD4_3
120 #define BSD4_3 	/**/
121 #endif
122 #ifndef BSD4_2
123 #define BSD4_2 	/**/
124 #endif
125 /*#define BRL4_2 /**/
126 
127 #if defined(BRL4_2) && !defined(BSD4_2)
128 #define BSD4_2
129 #undef BSD4_3
130 #endif
131 
132 /*
133  * If you are using /etc/inetd with 4.2bsd, define BSDINETD
134  */
135 #define BSDINETD	/**/
136 
137 /*
138  * If you are running 4.3bsd or BRL 4.2, you are running the inetd
139  */
140 
141 #if (defined(BSD4_3) || defined(BRL4_2)) && !defined(BSDINETD)
142 #define BSDINETD
143 #endif
144 
145 /*#define VMSDTR	/* Turn on modem control on vms(works DTR) for
146 			   develcon and gandalf ports to gain access */
147 /*
148  *	If you want to use the same modem for dialing in and out define
149  *	DIALINOUT to be the localtion of the acucntrl program
150  */
151 /* #define DIALINOUT	"/usr/lib/uucp/acucntrl" /**/
152 
153 /*
154  *	If you want all ACU lines to be DIALINOUT, define ALLACUINOUT
155  */
156 /* #define ALLACUINOUT	/**/
157 
158 /* define the value of WFMASK - for umask call - used for all uucp work files */
159 #define WFMASK 0137
160 
161 /* define the value of LOGMASK - for LOGFILE, SYSLOG, ERRLOG */
162 #define	LOGMASK		0133
163 
164 /* All files are given at least the following at the final destination */
165 /* It is also the default mode, so '666' is recommended */
166 /* and 444 is minimal (minimally useful, maximally annoying) */
167 #define	BASEMODE	0666
168 
169 /*
170  * Define NOSTRANGERS if you don't want to accept transactions from
171  * sites that are not in your L.sys file (see cico.c)
172  */
173 #define NOSTRANGERS	/**/
174 
175 /*
176  * Traditionally LCK (lock) files have been kept in /var/spool/uucp.
177  * If you want that define LOCKDIR to be ".".
178  * If you want the locks kept in a subdirectory, define LOCKDIR as "LCK".
179  * Good news about LCK. subdirectory: the directory can be mode 777 so
180  * unprivileged programs can share the uucp locking system,
181  * and the subdirectory keeps down clutter in the main directory.
182  * The BAD news: you have to change 'tip' and another programs that
183  * know where the LCK files are kept, and you have to change your /etc/rc
184  * if your rc cleans out the lock files (as it should).
185  */
186 /* #define	LOCKDIR	"LCK"	/**/
187 #define LOCKDIR	"." /**/
188 
189 /*
190  * If you want uucp and uux to copy the data files by default,
191  * don't define DONTCOPY (This is the way older 4bsd uucps worked)
192  * If you want uucp and uux to use the original files instead of
193  * copies, define DONTCOPY (This is the way System III and V work)
194  */
195 #define DONTCOPY	/**/
196 
197 /*
198  * Very few (that I know of) systems use the sequence checking feature.
199  * If you are not going to use it (hint: you are not),
200  * do not define GNXSEQ.  This saves precious room on PDP11s.
201  */
202 /*#define	GNXSEQ	/* comment this out to save space */
203 
204 /*
205  * If you want the logfile stored in a file for each site instead
206  * of one file
207  * define LOGBYSITE as the directory to put the files in
208  */
209 /* #define LOGBYSITE	"/var/spool/uucp/LOG" /**/
210 
211 /*
212  * define USE_SYSLOG if you want error messages to use SYSLOG instead
213  * of being written to /var/spool/log/ERRLOG
214  */
215 #define USE_SYSLOG	/**/
216 
217 /*
218  * If you are doing rebilling and need connect accounting,
219  * define DO_CONNECT_ACCOUNTING to be the accounting file name
220  */
221 /*#define DO_CONNECT_ACCOUNTING	"/var/spool/uucp/CONNECT"	/**/
222 
223 #define XQTDIR		"/var/spool/uucp/XTMP"
224 #define SQFILE		"/usr/lib/uucp/SQFILE"
225 #define SQTMP		"/usr/lib/uucp/SQTMP"
226 #define SLCKTIME	5400	/* system/device timeout (LCK.. files) */
227 #define SEQFILE		"/usr/lib/uucp/SEQF"
228 #define SYSFILE		"/usr/lib/uucp/L.sys"
229 #define DEVFILE		"/usr/lib/uucp/L-devices"
230 #define DIALFILE	"/usr/lib/uucp/L-dialcodes"
231 #define USERFILE	"/usr/lib/uucp/USERFILE"
232 #define	CMDFILE		"/usr/lib/uucp/L.cmds"
233 #define	ALIASFILE	"/usr/lib/uucp/L.aliases"
234 
235 #define SPOOL		"/var/spool/uucp"
236 #define SYSLOG		"/var/spool/uucp/SYSLOG"
237 #define PUBDIR		"/var/spool/uucppublic"
238 
239 #define SQLOCK		"SQ"
240 #define SEQLOCK		"SEQL"
241 #define CMDPRE		'C'
242 #define DATAPRE		'D'
243 #define XQTPRE		'X'
244 
245 #define LOGFILE		"/var/spool/uucp/LOGFILE"
246 #define ERRLOG		"/var/spool/uucp/ERRLOG"
247 #define CMDSDIR		"/var/spool/uucp/C."
248 #define DATADIR		"/var/spool/uucp/D."
249 #define XEQTDIR		"/var/spool/uucp/X."
250 
251 #define RMTDEBUG	"AUDIT"
252 #define CORRUPT		"CORRUPT"
253 #define SQTIME		60
254 #define TRYCALLS	2	/* number of tries to dial call */
255 
256 #define LLEN	150
257 #define MAXRQST	250
258 
259 #define DEBUG(l, f, s) if (Debug >= l) fprintf(stderr, f, s); else
260 
261 #define delock(dev)	rmlock(dev)
262 #define mlock(dev)	ulockf(dev, SLCKTIME)
263 
264 #define SAME		0
265 #define ANYREAD		0004
266 #define ANYWRITE	02
267 #define FAIL		-1
268 #define SUCCESS		0
269 #define CNULL		(char *) 0
270 #define STBNULL		(struct sgttyb *) 0
271 #define MASTER		1
272 #define SLAVE		0
273 #define MAXFULLNAME	255
274 #define MAXMSGTIME	45
275 #define NAMESIZE	255
276 #define MAXBASENAME	14
277 #define SYSNSIZE	(MAXBASENAME-1-1-1-4)
278 #define EOTMSG		"\04\n\04\n"
279 #define CALLBACK	1
280 #define ONEDAY		86400L
281 
282 	/*  commands  */
283 #define SHELL		"/bin/sh"
284 #define MAIL		"/usr/lib/sendmail"
285 #define UUCICO		"/usr/lib/uucp/uucico"
286 #define UUXQT		"/usr/lib/uucp/uuxqt"
287 #define UUCP		"uucp"
288 
289 	/*  call connect fail stuff  */
290 #define CF_SYSTEM	-1
291 #define CF_TIME		-2
292 #define CF_LOCK		-3
293 #define	CF_NODEV	-4
294 #define CF_DIAL		-5
295 #define CF_LOGIN	-6
296 
297 #define F_NAME		0
298 #define F_TIME		1
299 #define F_LINE		2
300 #define F_CLASS		3	/* an optional prefix and the speed */
301 #define F_PHONE		4
302 #define F_LOGIN		5
303 
304 #define MAXPH		60	/* maximum length of a phone number */
305 
306 	/* This structure tells how to get to a device */
307 struct condev {
308 	char *CU_meth;		/* method, such as 'ACU' or 'DIR' */
309 	char *CU_brand;		/* brand, such as 'Hayes' or 'Vadic' */
310 	int (*CU_gen)();	/* what to call to search for brands */
311 	int (*CU_open)();	/* what to call to open brand */
312 	int (*CU_clos)();	/* what to call to close brand */
313 };
314 
315 	/* This structure tells about a device */
316 struct Devices {
317 #define	D_type		D_arg[0]
318 #define	D_line		D_arg[1]
319 #define	D_calldev	D_arg[2]
320 #define	D_class		D_arg[3]
321 #define	D_brand		D_arg[4]
322 #define	D_CHAT		5
323 	int  D_numargs;
324 	int  D_speed;
325 	char *D_arg[20];
326 	char D_argbfr[100];
327 };
328 
329 	/*  system status stuff  */
330 #define SS_OK		0
331 #define SS_NODEVICE	1
332 #define SS_CALLBACK	2
333 #define SS_INPROGRESS	3
334 #define SS_FAIL		4
335 #define SS_BADSEQ	5
336 #define SS_WRONGTIME	6
337 
338 	/*  fail/retry parameters  */
339 #define RETRYTIME	600
340 #define MAXRECALLS	25
341 
342 	/*  stuff for command execution  */
343 #define X_RQDFILE	'F'
344 #define X_STDIN		'I'
345 #define X_STDOUT	'O'
346 #define X_CMD		'C'
347 #define X_USER		'U'
348 #define X_SENDFILE	'S'
349 #define	X_NONOTI	'N'
350 #define X_RETURNTO	'R'
351 #define	X_NONZERO	'Z'
352 #define X_LOCK		"XQT"
353 #define X_LOCKTIME	3600L
354 
355 #define WKDSIZE		100	/*  size of work dir name  */
356 
357 #include <sys/types.h>
358 #ifndef USG
359 #include <sys/timeb.h>
360 #else
361 struct timeb
362 {
363 	time_t	time;
364 	unsigned short millitm;
365 	short	timezone;
366 	short	dstflag;
367 };
368 #define rindex strrchr
369 #define index strchr
370 #endif
371 
372 #ifdef BSD4_2
373 #include <syslog.h>
374 #endif /* BSD4_2 */
375 
376 extern struct timeb Now;
377 
378 extern int Ifn, Ofn;
379 extern char *Rmtname;
380 extern char User[];
381 extern char Loginuser[];
382 extern char *Spool;
383 extern char Myname[];
384 extern char Myfullname[];
385 extern int Debug;
386 extern int Bspeed;
387 extern char Wrkdir[];
388 extern time_t Retrytime;
389 extern short Usrf;
390 extern int IsTcpIp;
391 extern char Progname[];
392 extern int (*CU_end)();
393 extern struct condev condevs[];
394 extern char NOLOGIN[];
395 
396 extern	char DLocal[], DLocalX[], *subfile(), *subdir();
397 
398 /* Commonly called routines which return non-int value */
399 extern	char *ttyname(), *strcpy(), *strcat(), *index(), *rindex(),
400 		*fgets(), *calloc(), *malloc(), *fdig(), *ttyname(),
401 		*cfgets(), *getwd(), *strpbrk(), *strncpy();
402 extern	off_t lseek();
403 extern time_t time();
404 
405 extern char _FAILED[], CANTOPEN[], DEVNULL[];
406 
407 #ifdef lint
408 /* This horrible gross kludge is the only way I know to
409  * convince lint that signal(SIGINT,SIG_IGN) is legal. It hates SIG_IGN.
410  */
411 #undef SIG_IGN
412 #define SIG_IGN	main
413 extern int main();
414 #undef DEBUG
415 #define DEBUG(a,b,c)
416 #endif /* lint */
417