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