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