xref: /csrg-svn/usr.bin/uucp/includes/uucp.h (revision 13992)
1*13992Sgray /*	uucp.h	5.2	83/07/19	*/
213632Ssam 
313632Ssam #include "stdio.h"
413632Ssam 
513632Ssam /*
613632Ssam  * Determine local uucp name of this machine.
713632Ssam  * Define one of the following:
813632Ssam  *
913632Ssam  * For UCB 4.1A and later systems, you will have the gethostname(2) call.
1013632Ssam  * If this call exists, define GETHOSTNAME.
1113632Ssam  *
1213632Ssam  * For USG 3.0 and later systems, you will have the uname(2) call.
1313632Ssam  * If this call exists, define UNAME.
1413632Ssam  *
1513632Ssam  * Some systems have a line of the form '#define sysname "myuucpname",'
1613632Ssam  * in the file /usr/include/whoami.h, to identify their machine.
1713632Ssam  * If your site does that, define WHOAMI.
1813632Ssam  *
1913632Ssam  * If your site has <whoami.h>, but you do not want to read
2013632Ssam  * that file every time uucp runs, you can compile sysname into uucp.
2113632Ssam  * This is faster and more reliable, but binaries do not port.
2213632Ssam  * If you want to do that, define CCWHOAMI.
2313632Ssam  *
2413632Ssam  * Some systems put the local uucp name in a single-line file
2513632Ssam  * named /etc/uucpname or /local/uucpname.
2613632Ssam  * If your site does that, define UUNAME.
2713632Ssam  *
2813632Ssam  * Systems running 3Com's UNET will have the getmyhname() call.
2913632Ssam  * If you want to, define GETMYHNAME.
3013632Ssam  *
3113632Ssam  * You should also define MYNANE to be your uucp name.
3213632Ssam  *
3313632Ssam  * For each of the above that are defined, uucp checks them in order.
3413632Ssam  * It stops on the first method that returns a non null name.
3513632Ssam  * If everything fails, it uses "unknown" for the system name.
3613632Ssam  */
3713632Ssam #define	GETHOSTNAME
3813632Ssam /* If the above fails ... */
3913632Ssam #define	MYNAME	"erewhon"
4013632Ssam 
4113632Ssam /*
4213632Ssam  * If you have it, include <sysexits.h> to use exit
4313632Ssam  * codes that will be understood by sendmail.
4413632Ssam  * Otherwise, define EX_NOHOST, EX_CANTCREAT, and EX_NOINPUT.
4513632Ssam  */
4613632Ssam #include <sysexits.h>
4713632Ssam /*#define EX_NOHOST	101*/
4813632Ssam /*#define EX_CANTCREAT	1*/
4913632Ssam /*#define EX_NOINPUT	2*/
5013632Ssam 
5113632Ssam /* define UUDIR for uucp subdirectory kludge (recommended) */
5213632Ssam #define	UUDIR
5313632Ssam 
5413632Ssam /*
5513632Ssam  * Define the various kinds of connections to include.
5613632Ssam  * The complete list is in the condevs array in condevs.c
5713632Ssam  */
5813632Ssam #define DN11		/* standard dialer */
5913632Ssam /*#define DATAKIT		/* ATT's datakit */
6013632Ssam /*#define PNET		/* Purdue network */
6113632Ssam /*#define DF02		/* Dec's DF02/DF03 */
6213632Ssam #define HAYES		/* Hayes' Smartmodem */
6313632Ssam #define VENTEL		/* ventel dialer */
6413632Ssam #define VADIC		/* Racal-Vadic 3450 */
6513632Ssam /*#define RVMACS		/* Racal-Vadic MACS 831 */
6613632Ssam /*#define UNET		/* 3Com's UNET */
6713632Ssam /*#define MICOM		/* micom mux port */
6813632Ssam 
6913632Ssam #ifdef	VENTEL
7013632Ssam /*
7113632Ssam  * We need a timer to write slowly to ventels.
7213632Ssam  * define INTERVALTIMER to use 4.2 bsd interval timer.
7313632Ssam  * define FASTTIMER if you have the nap() system call.
7413632Ssam  * define FTIME if you have the ftime() system call.
7513632Ssam  * define BUSYLOOP if you must do a busy loop.
7613632Ssam  * Look at uucpdelay() in condevs.c for details.
7713632Ssam  */
7813632Ssam #define	FTIME
7913632Ssam #endif
8013632Ssam 
8113632Ssam /*
8213632Ssam  * If your site is using "ndir.h" to retrofit the Berkeley
8313632Ssam  * directory reading routines, define NDIR.
8413632Ssam  * You will probably also have to set LIBNDIR in Makefile.
8513632Ssam  * Otherwise, <dir.h> is assumed to have the Berkeley directory definitions.
8613632Ssam  */
8713632Ssam /*#define	NDIR*/
8813632Ssam 
8913632Ssam /*
9013632Ssam  * If yours is a BTL system III, IV, or so-on site, define SYSIII.
9113632Ssam  * Conditional compilations should produce the right code,
9213632Ssam  * but if it doesn't (the compiler will probably complain loudly),
9313632Ssam  * make the needed adjustments and guard the code with
9413632Ssam  * #ifdef SYSIII, (code for system III), #else, (code for V7), #endif
9513632Ssam  */
9613632Ssam /*#define	SYSIII*/
9713632Ssam 
9813632Ssam /* define the last characters for ACU */
9913632Ssam /* burl!lda, rti!trt, isn't "<" more widely used than "-"? */
10013632Ssam /* rti!trt: use -< as is done in 4.1c uucp */
10113632Ssam #define ACULAST "-<"
10213632Ssam 
10313632Ssam /* define the value of WFMASK - for umask call - used for all uucp work files */
10413632Ssam #define WFMASK 0137
10513632Ssam 
10613632Ssam /* define the value of LOGMASK - for LOGFILE, SYSLOG, ERRLOG */
10713632Ssam #define	LOGMASK	0133
10813632Ssam 
10913632Ssam /* All files are given at least the following at the final destination */
11013632Ssam /* It is also the default mode, so '666' is recommended */
11113632Ssam /* and 444 is minimal (minimally useful, maximally annoying) */
11213632Ssam #define	BASEMODE	0666
11313632Ssam 
11413632Ssam /* All users with getuid() <= PRIV_UIDS are 'privileged'. */
11513632Ssam /* Was 10, reduced to 3 as suggested by duke!dbl (David Leonard) */
11613632Ssam #define	PRIV_UIDS	3
11713632Ssam 
11813632Ssam #define XQTDIR		"/usr/spool/uucp/XTMP"
11913632Ssam #define SQFILE		"/usr/lib/uucp/SQFILE"
12013632Ssam #define SQTMP		"/usr/lib/uucp/SQTMP"
12113632Ssam #define SLCKTIME	5400	/* system/device timeout (LCK.. files) */
12213632Ssam #define SEQFILE		"/usr/lib/uucp/SEQF"
12313632Ssam #define SYSFILE		"/usr/lib/uucp/L.sys"
12413632Ssam #define DEVFILE		"/usr/lib/uucp/L-devices"
12513632Ssam #define DIALFILE	"/usr/lib/uucp/L-dialcodes"
12613632Ssam #define USERFILE	"/usr/lib/uucp/USERFILE"
12713632Ssam #define	CMDFILE		"/usr/lib/uucp/L.cmds"
12813632Ssam 
12913632Ssam #define SPOOL		"/usr/spool/uucp"
13013632Ssam #define SQLOCK		"/usr/spool/uucp/LCK.SQ"
13113632Ssam #define SYSLOG		"/usr/spool/uucp/SYSLOG"
13213632Ssam #define PUBDIR		"/usr/spool/uucppublic"
13313632Ssam 
13413632Ssam #define SEQLOCK		"LCK.SEQL"
13513632Ssam #define CMDPRE		'C'
13613632Ssam #define DATAPRE		'D'
13713632Ssam #define XQTPRE		'X'
13813632Ssam 
13913632Ssam #define LOGFILE	"/usr/spool/uucp/LOGFILE"
14013632Ssam #define ERRLOG	"/usr/spool/uucp/ERRLOG"
14113632Ssam 
14213632Ssam #define RMTDEBUG	"AUDIT"
14313632Ssam #define SQTIME		60
14413632Ssam #define TRYCALLS	2	/* number of tries to dial call */
14513632Ssam 
14613632Ssam /*define PROTODEBUG = 1 if testing protocol - introduce errors */
14713632Ssam #define DEBUG(l, f, s) if (Debug >= l) fprintf(stderr, f, s); else
14813632Ssam 
14913632Ssam #define ASSERT(e, s1, s2, i1) if (!(e)) {\
15013632Ssam assert(s1, s2, i1);\
15113632Ssam cleanup(FAIL);} else
15213632Ssam 
15313632Ssam 
15413632Ssam #define SAME 0
15513632Ssam #define ANYREAD 04
15613632Ssam #define ANYWRITE 02
15713632Ssam #define FAIL -1
15813632Ssam #define SUCCESS 0
15913632Ssam #define CNULL (char *) 0
16013632Ssam #define STBNULL (struct sgttyb *) 0
16113632Ssam #define MASTER 1
16213632Ssam #define SLAVE 0
16313632Ssam #define MAXFULLNAME 250
16413632Ssam #define MAXMSGTIME 45
16513632Ssam #define NAMESIZE 15
16613632Ssam #define EOTMSG "\04\n\04\n"
16713632Ssam #define CALLBACK 1
16813632Ssam 
16913632Ssam 	/*  commands  */
17013632Ssam #define SHELL		"/bin/sh"
17113632Ssam #define MAIL		"mail"
17213632Ssam #define UUCICO		"/usr/lib/uucp/uucico"
17313632Ssam #define UUXQT		"/usr/lib/uucp/uuxqt"
17413632Ssam #define UUCP		"uucp"
17513632Ssam 
17613632Ssam 	/*  call connect fail stuff  */
17713632Ssam #define CF_SYSTEM	-1
17813632Ssam #define CF_TIME		-2
17913632Ssam #define CF_LOCK		-3
18013632Ssam #define	CF_NODEV	-4
18113632Ssam #define CF_DIAL		-5
18213632Ssam #define CF_LOGIN	-6
18313632Ssam 
18413632Ssam #define F_NAME 0
18513632Ssam #define F_TIME 1
18613632Ssam #define F_LINE 2
18713632Ssam #define F_CLASS 3	/* an optional prefix and the speed */
18813632Ssam #define F_PHONE 4
18913632Ssam #define F_LOGIN 5
19013632Ssam 
19113632Ssam #define MAXPH	60	/* maximum length of a phone number */
19213632Ssam 
19313632Ssam 	/* This structure tells how to get to a device */
19413632Ssam struct condev {
19513632Ssam 	char *CU_meth;		/* method, such as 'ACU' or 'DIR' */
19613632Ssam 	char *CU_brand;		/* brand, such as 'Hayes' or 'Vadic' */
19713632Ssam 	int (*CU_gen)();	/* what to call to search for brands */
19813632Ssam 	int (*CU_open)();	/* what to call to open brand */
19913632Ssam 	int (*CU_clos)();	/* what to call to close brand */
20013632Ssam };
20113632Ssam 
20213632Ssam 	/* This structure tells about a device */
20313632Ssam struct Devices {
20413632Ssam 	char D_type[20];
20513632Ssam 	char D_line[20];
20613632Ssam 	char D_calldev[20];
20713632Ssam 	char D_class[20];
20813632Ssam 	int D_speed;
20913632Ssam 	char D_brand[20];	/* brand name, as 'Hayes' or 'Vadic' */
21013632Ssam };
21113632Ssam 
21213632Ssam 	/*  system status stuff  */
21313632Ssam #define SS_OK		0
21413632Ssam #define SS_FAIL		4
21513632Ssam #define SS_NODEVICE	1
21613632Ssam #define SS_CALLBACK	2
21713632Ssam #define SS_INPROGRESS	3
21813632Ssam #define SS_BADSEQ	5
21913632Ssam 
22013632Ssam 	/*  fail/retry parameters  */
22113632Ssam #define RETRYTIME 3300
22213632Ssam #define MAXRECALLS 20
22313632Ssam 
22413632Ssam 	/*  stuff for command execution  */
22513632Ssam #define X_RQDFILE	'F'
22613632Ssam #define X_STDIN		'I'
22713632Ssam #define X_STDOUT	'O'
22813632Ssam #define X_CMD		'C'
22913632Ssam #define X_USER		'U'
23013632Ssam #define X_SENDFILE	'S'
23113632Ssam #define	X_NONOTI	'N'
23213632Ssam #define	X_NONZERO	'Z'
23313632Ssam #define X_LOCK		"LCK.XQT"
23413632Ssam #define X_LOCKTIME	3600
23513632Ssam 
23613632Ssam #define WKDSIZE 100	/*  size of work dir name  */
23713632Ssam 
23813632Ssam extern int Ifn, Ofn;
23913632Ssam extern char Rmtname[];
24013632Ssam extern char User[];
24113632Ssam extern char Loginuser[];
24213632Ssam extern char *Spool;
24313632Ssam extern char Myname[];
24413632Ssam extern int Debug;
24513632Ssam extern int Pkdebug;
24613632Ssam extern int Pkdrvon;
24713632Ssam extern int Bspeed;
24813632Ssam extern char Wrkdir[];
24913632Ssam extern long Retrytime;
25013632Ssam extern int Unet;
25113632Ssam extern char Progname[];
25213632Ssam extern int (*CU_end)();
25313632Ssam extern struct condev condevs[];
25413632Ssam 
25513632Ssam #ifdef	UUDIR
25613632Ssam #define	subfile(s)	SubFile(s)
25713632Ssam #define	subdir(d, p)	SubDir(d, p)
25813632Ssam #define	subchdir(d)	SubChDir(d)
25913632Ssam extern	char DLocal[], DLocalX[], *SubFile(), *SubDir();
26013632Ssam #else
26113632Ssam #define	subfile(s)	s
26213632Ssam #define	subdir(d, p)	d
26313632Ssam #define	subchdir(d)	chdir(d)
26413632Ssam #endif
26513632Ssam 
26613632Ssam /* Commonly called routines which return non-int value */
26713632Ssam extern	char *ttyname(), *strcpy(), *strcat(), *index(), *rindex(),
26813632Ssam 		*fgets(), *calloc(), *malloc(),
26913632Ssam 		*cfgets();
27013632Ssam extern	long lseek();
271*13992Sgray extern	FILE *rpopen();
272