xref: /original-bsd/usr.bin/uucp/includes/uucp.h (revision 7d595439)
1 /*	uucp.h	5.11	86/02/12	*/
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 running 2.9bsd, define BSD2_9
137  */
138 /*#define BSD2_9 	/**/
139 
140 /*
141  * If you are using /etc/inetd with 4.2bsd, define BSDINETD
142  */
143 #define BSDINETD	/**/
144 
145 /*
146  * If you are running 4.3bsd or BRL 4.2, you are running the inetd
147  */
148 
149 #if (defined(BSD4_3) || defined(BRL4_2)) && !defined(BSDINETD)
150 #define BSDINETD
151 #endif (BSD4_3 ||BRL4_2) && !BSDINETD
152 
153 /*#define VMSDTR	/* Turn on modem control on vms(works DTR) for
154 			   develcon and gandalf ports to gain access */
155 /*
156  *	If you want to use the same modem for dialing in and out define
157  *	DIALINOUT to be the localtion of the acucntrl program
158  */
159 /* #define DIALINOUT	"/usr/lib/uucp/acucntrl" /**/
160 
161 /*
162  *	If you want all ACU lines to be DIALINOUT, define ALLACUINOUT
163  */
164 /* #define ALLACUINOUT	/**/
165 
166 /* define the value of WFMASK - for umask call - used for all uucp work files */
167 #define WFMASK 0137
168 
169 /* define the value of LOGMASK - for LOGFILE, SYSLOG, ERRLOG */
170 #define	LOGMASK		0133
171 
172 /* All files are given at least the following at the final destination */
173 /* It is also the default mode, so '666' is recommended */
174 /* and 444 is minimal (minimally useful, maximally annoying) */
175 #define	BASEMODE	0666
176 
177 /*
178  * Define NOSTRANGERS if you don't want to accept transactions from
179  * sites that are not in your L.sys file (see cico.c)
180  */
181 #define NOSTRANGERS	/**/
182 
183 /*
184  * Traditionally LCK (lock) files have been kept in /usr/spool/uucp.
185  * If you want that define LOCKDIR to be ".".
186  * If you want the locks kept in a subdirectory, define LOCKDIR as "LCK".
187  * Good news about LCK. subdirectory: the directory can be mode 777 so
188  * unprivileged programs can share the uucp locking system,
189  * and the subdirectory keeps down clutter in the main directory.
190  * The BAD news: you have to change 'tip' and another programs that
191  * know where the LCK files are kept, and you have to change your /etc/rc
192  * if your rc cleans out the lock files (as it should).
193  */
194 /*#define	LOCKDIR	"LCK"	/**/
195 #define LOCKDIR	"." /**/
196 
197 /*
198  * If you want uucp and uux to copy the data files by default,
199  * don't define DONTCOPY (This is the way older 4bsd uucps worked)
200  * If you want uucp and uux to use the original files instead of
201  * copies, define DONTCOPY (This is the way System III and V work)
202  */
203 #define DONTCOPY	/**/
204 
205 /*
206  * Very few (that I know of) systems use the sequence checking feature.
207  * If you are not going to use it (hint: you are not),
208  * do not define GNXSEQ.  This saves precious room on PDP11s.
209  */
210 /*#define	GNXSEQ	/* comment this out to save space */
211 
212 /*
213  * If you want the logfile stored in a file for each site instead
214  * of one file
215  * define LOGBYSITE as the directory to put the files in
216  */
217 /*#define LOGBYSITE	"/usr/spool/uucp/LOG" /**/
218 
219 #define XQTDIR		"/usr/spool/uucp/XTMP"
220 #define SQFILE		"/usr/lib/uucp/SQFILE"
221 #define SQTMP		"/usr/lib/uucp/SQTMP"
222 #define SLCKTIME	5400	/* system/device timeout (LCK.. files) */
223 #define SEQFILE		"/usr/lib/uucp/SEQF"
224 #define SYSFILE		"/usr/lib/uucp/L.sys"
225 #define DEVFILE		"/usr/lib/uucp/L-devices"
226 #define DIALFILE	"/usr/lib/uucp/L-dialcodes"
227 #define USERFILE	"/usr/lib/uucp/USERFILE"
228 #define	CMDFILE		"/usr/lib/uucp/L.cmds"
229 #define	ALIASFILE	"/usr/lib/uucp/L.aliases"
230 
231 #define SPOOL		"/usr/spool/uucp"
232 #define SYSLOG		"/usr/spool/uucp/SYSLOG"
233 #define PUBDIR		"/usr/spool/uucppublic"
234 
235 #define SQLOCK		"SQ"
236 #define SEQLOCK		"SEQL"
237 #define CMDPRE		'C'
238 #define DATAPRE		'D'
239 #define XQTPRE		'X'
240 
241 #define LOGFILE		"/usr/spool/uucp/LOGFILE"
242 #define ERRLOG		"/usr/spool/uucp/ERRLOG"
243 #define CMDSDIR		"/usr/spool/uucp/C."
244 #define DATADIR		"/usr/spool/uucp/D."
245 #define XEQTDIR		"/usr/spool/uucp/X."
246 
247 #define RMTDEBUG	"AUDIT"
248 #define CORRUPT		"CORRUPT"
249 #define SQTIME		60
250 #define TRYCALLS	2	/* number of tries to dial call */
251 
252 #define LLEN	50
253 #define MAXRQST	250
254 
255 #define DEBUG(l, f, s) if (Debug >= l) fprintf(stderr, f, s); else
256 
257 #define ASSERT(e, s1, s2, i1) if (!(e)) {assert(s1, s2, i1);cleanup(FAIL);}else
258 
259 #define delock(dev)	rmlock(dev)
260 #define mlock(dev)	ulockf(dev, SLCKTIME)
261 
262 #define SAME		0
263 #define ANYREAD		0004
264 #define ANYWRITE	02
265 #define FAIL		-1
266 #define SUCCESS		0
267 #define CNULL		(char *) 0
268 #define STBNULL		(struct sgttyb *) 0
269 #define MASTER		1
270 #define SLAVE		0
271 #define MAXFULLNAME	255
272 #define MAXMSGTIME	45
273 #define NAMESIZE	255
274 #define MAXBASENAME	14
275 #define SYSNSIZE	(MAXBASENAME-1-1-1-4)
276 #define EOTMSG		"\04\n\04\n"
277 #define CALLBACK	1
278 #define ONEDAY		86400L
279 
280 	/*  commands  */
281 #define SHELL		"/bin/sh"
282 #define MAIL		"/usr/lib/sendmail"
283 #define UUCICO		"/usr/lib/uucp/uucico"
284 #define UUXQT		"/usr/lib/uucp/uuxqt"
285 #define UUCP		"uucp"
286 
287 	/*  call connect fail stuff  */
288 #define CF_SYSTEM	-1
289 #define CF_TIME		-2
290 #define CF_LOCK		-3
291 #define	CF_NODEV	-4
292 #define CF_DIAL		-5
293 #define CF_LOGIN	-6
294 
295 #define F_NAME		0
296 #define F_TIME		1
297 #define F_LINE		2
298 #define F_CLASS		3	/* an optional prefix and the speed */
299 #define F_PHONE		4
300 #define F_LOGIN		5
301 
302 #define MAXPH		60	/* maximum length of a phone number */
303 
304 	/* This structure tells how to get to a device */
305 struct condev {
306 	char *CU_meth;		/* method, such as 'ACU' or 'DIR' */
307 	char *CU_brand;		/* brand, such as 'Hayes' or 'Vadic' */
308 	int (*CU_gen)();	/* what to call to search for brands */
309 	int (*CU_open)();	/* what to call to open brand */
310 	int (*CU_clos)();	/* what to call to close brand */
311 };
312 
313 	/* This structure tells about a device */
314 struct Devices {
315 #define	D_type		D_arg[0]
316 #define	D_line		D_arg[1]
317 #define	D_calldev	D_arg[2]
318 #define	D_class		D_arg[3]
319 #define	D_brand		D_arg[4]
320 #define	D_CHAT		5
321 	int  D_numargs;
322 	int  D_speed;
323 	char *D_arg[20];
324 	char D_argbfr[100];
325 };
326 
327 	/*  system status stuff  */
328 #define SS_OK		0
329 #define SS_NODEVICE	1
330 #define SS_CALLBACK	2
331 #define SS_INPROGRESS	3
332 #define SS_FAIL		4
333 #define SS_BADSEQ	5
334 #define SS_WRONGTIME	6
335 
336 	/*  fail/retry parameters  */
337 #define RETRYTIME	600
338 #define MAXRECALLS	25
339 
340 	/*  stuff for command execution  */
341 #define X_RQDFILE	'F'
342 #define X_STDIN		'I'
343 #define X_STDOUT	'O'
344 #define X_CMD		'C'
345 #define X_USER		'U'
346 #define X_SENDFILE	'S'
347 #define	X_NONOTI	'N'
348 #define X_RETURNTO	'R'
349 #define	X_NONZERO	'Z'
350 #define X_LOCK		"XQT"
351 #define X_LOCKTIME	3600L
352 
353 #define WKDSIZE		100	/*  size of work dir name  */
354 
355 #include <sys/types.h>
356 #ifndef USG
357 #include <sys/timeb.h>
358 #else USG
359 struct timeb
360 {
361 	time_t	time;
362 	unsigned short millitm;
363 	short	timezone;
364 	short	dstflag;
365 };
366 #define rindex strrchr
367 #define index strchr
368 #endif USG
369 
370 extern struct timeb Now;
371 
372 extern int Ifn, Ofn;
373 extern char *Rmtname;
374 extern char User[];
375 extern char Loginuser[];
376 extern char *Spool;
377 extern char Myname[];
378 extern char Myfullname[];
379 extern int Debug;
380 extern int Bspeed;
381 extern char Wrkdir[];
382 extern time_t Retrytime;
383 extern short Usrf;
384 extern int IsTcpIp;
385 extern char Progname[];
386 extern int (*CU_end)();
387 extern struct condev condevs[];
388 extern char NOLOGIN[];
389 
390 extern	char DLocal[], DLocalX[], *subfile(), *subdir();
391 
392 /* Commonly called routines which return non-int value */
393 extern	char *ttyname(), *strcpy(), *strcat(), *index(), *rindex(),
394 		*fgets(), *calloc(), *malloc(), *fdig(), *ttyname(),
395 		*cfgets(), *getwd(), *strpbrk(), *strncpy();
396 extern	long lseek();
397 extern	FILE *rpopen();
398 extern time_t time();
399 
400 extern char _FAILED[], CANTOPEN[], DEVNULL[];
401 
402 #ifdef lint
403 /* This horrible gross kludge is the only way I know to
404  * convince lint that signal(SIGINT,SIG_IGN) is legal. It hates SIG_IGN.
405  */
406 #ifdef SIG_IGN
407 #undef SIG_IGN
408 #endif /* SIG_IGN */
409 #define SIG_IGN	main
410 extern int main();
411 #ifdef DEBUG
412 #undef DEBUG
413 #endif DEBUG
414 #define DEBUG(a,b,c)
415 #endif /* lint */
416