xref: /csrg-svn/usr.bin/uucp/includes/uucp.h (revision 23728)
1*23728Sbloom /*	uucp.h	5.8	85/06/24	*/
213632Ssam 
318624Sralph #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  *
3117842Sralph  * You should also define MYNAME 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  */
3723681Sbloom #define	GETHOSTNAME	/**/
3823681Sbloom /* #define UNAME	/**/
3923681Sbloom /* #define WHOAMI	/**/
4023681Sbloom /* #define CCWHOAMI	/**/
4123681Sbloom /* #define UUNAME	/**/
4223681Sbloom /* #define GETMYHNAME	/**/
4313632Ssam /* If the above fails ... */
4423681Sbloom #define	MYNAME	"erehwon"
4513632Ssam 
4613632Ssam /*
4713632Ssam  * If you have it, include <sysexits.h> to use exit
4813632Ssam  * codes that will be understood by sendmail.
4913632Ssam  * Otherwise, define EX_NOHOST, EX_CANTCREAT, and EX_NOINPUT.
5013632Ssam  */
5113632Ssam #include <sysexits.h>
5223681Sbloom /*#define EX_NOINPUT	66	/**/
5323681Sbloom /*#define EX_NOHOST	68	/**/
5423681Sbloom /*#define EX_CANTCREAT	73	/**/
5513632Ssam 
5613632Ssam /*
5713632Ssam  * Define the various kinds of connections to include.
5813632Ssam  * The complete list is in the condevs array in condevs.c
5913632Ssam  */
6017872Sralph #define DN11		/* standard dialer */
6117842Sralph /*#define DATAKIT	/* ATT's datakit */
6213632Ssam /*#define PNET		/* Purdue network */
6317872Sralph #define DF02		/* Dec's DF02/DF03 */
6418624Sralph #define DF112		/* Dec's DF112 */
6517872Sralph #define HAYES		/* Hayes' Smartmodem */
6623681Sbloom #define VENTEL		/* Ventel Dialer */
6718624Sralph #define PENRIL		/* PENRIL Dialer */
6817872Sralph #define VADIC		/* Racal-Vadic 345x */
6917872Sralph #define VA212		/* Racal-Vadic 212 */
7017872Sralph #define VA811S		/* Racal-Vadic 811S dialer, 831 adaptor */
7117842Sralph #define VA820		/* Racal-Vadic 820 dialer, 831 adaptor */
7217872Sralph #define RVMACS		/* Racal-Vadic MACS  820 dialer, 831 adaptor */
7317872Sralph #define VMACS		/* Racal-Vadic MACS  811 dialer, 831 adaptor */
7417842Sralph /*#define UNETTCP	/* 3Com's UNET */
7523681Sbloom #define BSDTCP		/* 4.2bsd or 2.9bsd TCP/IP */
7617842Sralph #define PAD		/* X.25 PAD */
7713632Ssam /*#define MICOM		/* micom mux port */
7817872Sralph #define NOVATION	/* Novation modem */
7913632Ssam 
8017842Sralph #if defined(UNETTCP) || defined(BSDTCP)
8117842Sralph #define TCPIP
8217842Sralph #endif
8317842Sralph 
8418624Sralph #if defined(VENTEL) || defined(NOVATION) || defined(DF112) || defined(PENRIL)
8513632Ssam /*
8613632Ssam  * We need a timer to write slowly to ventels.
87*23728Sbloom  * define INTERVALTIMER to use 4.[23] bsd interval timer.
8813632Ssam  * define FASTTIMER if you have the nap() system call.
8913632Ssam  * define FTIME if you have the ftime() system call.
9013632Ssam  * define BUSYLOOP if you must do a busy loop.
9113632Ssam  * Look at uucpdelay() in condevs.c for details.
9213632Ssam  */
9323681Sbloom #define	INTERVALTIMER
9418624Sralph #endif VENTEL || NOVATION || DF112 || PENRIL
9513632Ssam 
9613632Ssam /*
9713632Ssam  * If your site is using "ndir.h" to retrofit the Berkeley
9813632Ssam  * directory reading routines, define NDIR.
9913632Ssam  * You will probably also have to set LIBNDIR in Makefile.
10013632Ssam  * Otherwise, <dir.h> is assumed to have the Berkeley directory definitions.
10113632Ssam  */
10223681Sbloom /*#define	NDIR	/**/
10313632Ssam 
10413632Ssam /*
10523681Sbloom  * If yours is a BTL system III, IV, V or so-on site, define USG.
10613632Ssam  */
10723681Sbloom /*#define	USG	/**/
10813632Ssam 
10917842Sralph /*
110*23728Sbloom  * If you are running 4.3bsd, define BSD4_3 and BSD4_2
111*23728Sbloom  * If you are just running 4.2bsd, define BSD4_2
11217842Sralph  */
113*23728Sbloom #define BSD4_3 	/**/
11423681Sbloom #define BSD4_2 	/**/
11517842Sralph 
11617842Sralph /*
11723681Sbloom  * If you are running 2.9bsd, define BSD2_9
11823681Sbloom  */
11923681Sbloom /*#define BSD2_9 	/**/
12023681Sbloom 
12123681Sbloom /*
12217842Sralph  * If you are using /etc/inetd with 4.2bsd, define BSDINETD
12317842Sralph  */
12423681Sbloom #define BSDINETD	/**/
12517842Sralph 
126*23728Sbloom /*
127*23728Sbloom  * If you are running 4.3bsd, you are running the inetd
128*23728Sbloom  */
129*23728Sbloom 
130*23728Sbloom #if defined(BSD4_3) && !defined(BSDINETD)
131*23728Sbloom #define BSDINETD
132*23728Sbloom #endif BSD4_3 && !BSDINETD
133*23728Sbloom 
13417842Sralph /*#define VMSDTR	/* Turn on modem control on vms(works DTR) for
13517842Sralph 			   develcon and gandalf ports to gain access */
13618624Sralph /*
13718624Sralph  *	If you want to use the same modem for dialing in and out define
13818624Sralph  *	DIALINOUT to be the localtion of the acucntrl program
13918624Sralph  */
14023681Sbloom /* #define DIALINOUT	"/usr/lib/uucp/acucntrl" /**/
14117842Sralph 
14223681Sbloom /*
14323681Sbloom  *	If you want all ACU lines to be DIALINOUT, define ALLACUINOUT
14423681Sbloom  */
14523681Sbloom /* #define ALLACUINOUT	/**/
14613632Ssam 
14713632Ssam /* define the value of WFMASK - for umask call - used for all uucp work files */
14813632Ssam #define WFMASK 0137
14913632Ssam 
15017842Sralph /* define UUSTAT if you need "uustat" command */
15123681Sbloom /* #define UUSTAT	/**/
15217842Sralph 
15323681Sbloom /* define UUSUB if you need "uusub" command */
15417842Sralph /* #define UUSUB /**/
15517842Sralph 
15613632Ssam /* define the value of LOGMASK - for LOGFILE, SYSLOG, ERRLOG */
15723681Sbloom #define	LOGMASK		0133
15813632Ssam 
15913632Ssam /* All files are given at least the following at the final destination */
16013632Ssam /* It is also the default mode, so '666' is recommended */
16113632Ssam /* and 444 is minimal (minimally useful, maximally annoying) */
16213632Ssam #define	BASEMODE	0666
16313632Ssam 
16417842Sralph /*
16517842Sralph  * Define NOSTRANGERS if you don't want to accept transactions from
16617842Sralph  * sites that are not in your L.sys file (see cico.c)
16717842Sralph  */
16823681Sbloom #define NOSTRANGERS	/**/
16917842Sralph /*
17017842Sralph  * Traditionally LCK (lock) files have been kept in /usr/spool/uucp.
17117842Sralph  * If you want that define LOCKDIR to be ".".
17217842Sralph  * If you want the locks kept in a subdirectory, define LOCKDIR as "LCK.".
17317842Sralph  * Good news about LCK. subdirectory: the directory can be mode 777 so
17417842Sralph  * unprivileged programs can share the uucp locking system,
17517842Sralph  * and the subdirectory keeps down clutter in the main directory.
17617842Sralph  * The BAD news: you have to change 'tip' and another programs that
17717842Sralph  * know where the LCK files are kept, and you have to change your /etc/rc
17817842Sralph  * if your rc cleans out the lock files (as it should).
17917842Sralph  */
18023681Sbloom /*#define	LOCKDIR	"LCK."	/**/
18123681Sbloom #define LOCKDIR	"." /**/
18213632Ssam 
18317842Sralph /*
18417842Sralph  * If you want uucp and uux to copy the data files by default,
18517842Sralph  * don't define DONTCOPY (This is the way older 4bsd uucps worked)
18617842Sralph  * If you want uucp and uux to use the original files instead of
18717842Sralph  * copies, define DONTCOPY (This is the way System III and V work)
18817842Sralph  */
18923681Sbloom #define DONTCOPY	/**/
19017842Sralph 
19117842Sralph /*
19218624Sralph  * Very few (that I know of) systems use the sequence checking feature.
19317842Sralph  * If you are not going to use it (hint: you are not),
19417842Sralph  * do not define GNXSEQ.  This saves precious room on PDP11s.
19517842Sralph  */
19623681Sbloom /*#define	GNXSEQ	/* comment this out to save space */
19717842Sralph 
19818624Sralph /*
19918624Sralph  * If you want the logfile stored in a file for each site instead
20018624Sralph  * of one file
20118624Sralph  * define LOGBYSITE as the directory to put the files in
20218624Sralph  */
20323681Sbloom /*#define LOGBYSITE	"/usr/spool/uucp/LOG" /**/
20418624Sralph 
20513632Ssam #define XQTDIR		"/usr/spool/uucp/XTMP"
20613632Ssam #define SQFILE		"/usr/lib/uucp/SQFILE"
20713632Ssam #define SQTMP		"/usr/lib/uucp/SQTMP"
20813632Ssam #define SLCKTIME	5400	/* system/device timeout (LCK.. files) */
20913632Ssam #define SEQFILE		"/usr/lib/uucp/SEQF"
21013632Ssam #define SYSFILE		"/usr/lib/uucp/L.sys"
21113632Ssam #define DEVFILE		"/usr/lib/uucp/L-devices"
21213632Ssam #define DIALFILE	"/usr/lib/uucp/L-dialcodes"
21313632Ssam #define USERFILE	"/usr/lib/uucp/USERFILE"
21413632Ssam #define	CMDFILE		"/usr/lib/uucp/L.cmds"
21518624Sralph #define	ALIASFILE	"/usr/lib/uucp/L.aliases"
21613632Ssam 
21713632Ssam #define SPOOL		"/usr/spool/uucp"
21817842Sralph #define SQLOCK		"LCK.SQ"
21913632Ssam #define SYSLOG		"/usr/spool/uucp/SYSLOG"
22013632Ssam #define PUBDIR		"/usr/spool/uucppublic"
22113632Ssam 
22213632Ssam #define SEQLOCK		"LCK.SEQL"
22313632Ssam #define CMDPRE		'C'
22413632Ssam #define DATAPRE		'D'
22513632Ssam #define XQTPRE		'X'
22613632Ssam 
22723681Sbloom #define LOGFILE		"/usr/spool/uucp/LOGFILE"
22823681Sbloom #define ERRLOG		"/usr/spool/uucp/ERRLOG"
22923681Sbloom #define CMDSDIR		"/usr/spool/uucp/C."
23023681Sbloom #define DATADIR		"/usr/spool/uucp/D."
23123681Sbloom #define XEQTDIR		"/usr/spool/uucp/X."
23213632Ssam 
23313632Ssam #define RMTDEBUG	"AUDIT"
23417842Sralph #define CORRUPT		"CORRUPT"
23513632Ssam #define SQTIME		60
23613632Ssam #define TRYCALLS	2	/* number of tries to dial call */
23713632Ssam 
23817842Sralph #define LLEN	50
23917842Sralph #define MAXRQST	250
24017842Sralph 
24113632Ssam #define DEBUG(l, f, s) if (Debug >= l) fprintf(stderr, f, s); else
24213632Ssam 
24317842Sralph #define ASSERT(e, s1, s2, i1) if (!(e)) {assert(s1, s2, i1);cleanup(FAIL);}else
24413632Ssam 
24523681Sbloom #define SAME		0
24623681Sbloom #define ANYREAD		0004
24723681Sbloom #define ANYWRITE	02
24823681Sbloom #define FAIL		-1
24923681Sbloom #define SUCCESS		0
25023681Sbloom #define CNULL		(char *) 0
25123681Sbloom #define STBNULL		(struct sgttyb *) 0
25223681Sbloom #define MASTER		1
25323681Sbloom #define SLAVE		0
25423681Sbloom #define MAXFULLNAME	255
25523681Sbloom #define MAXMSGTIME	45
25623681Sbloom #define NAMESIZE	255
25723681Sbloom #define MAXBASENAME	14
25823681Sbloom #define SYSNSIZE	(MAXBASENAME-1-1-1-4)
25923681Sbloom #define EOTMSG		"\04\n\04\n"
26023681Sbloom #define CALLBACK	1
26123681Sbloom #define ONEDAY		86400L
26213632Ssam 
26313632Ssam 	/*  commands  */
26413632Ssam #define SHELL		"/bin/sh"
26517842Sralph #define MAIL		"/usr/lib/sendmail"
26613632Ssam #define UUCICO		"/usr/lib/uucp/uucico"
26713632Ssam #define UUXQT		"/usr/lib/uucp/uuxqt"
26813632Ssam #define UUCP		"uucp"
26913632Ssam 
27013632Ssam 	/*  call connect fail stuff  */
27113632Ssam #define CF_SYSTEM	-1
27213632Ssam #define CF_TIME		-2
27313632Ssam #define CF_LOCK		-3
27413632Ssam #define	CF_NODEV	-4
27513632Ssam #define CF_DIAL		-5
27613632Ssam #define CF_LOGIN	-6
27713632Ssam 
27823681Sbloom #define F_NAME		0
27923681Sbloom #define F_TIME		1
28023681Sbloom #define F_LINE		2
28123681Sbloom #define F_CLASS		3	/* an optional prefix and the speed */
28223681Sbloom #define F_PHONE		4
28323681Sbloom #define F_LOGIN		5
28413632Ssam 
28523681Sbloom #define MAXPH		60	/* maximum length of a phone number */
28613632Ssam 
28713632Ssam 	/* This structure tells how to get to a device */
28813632Ssam struct condev {
28913632Ssam 	char *CU_meth;		/* method, such as 'ACU' or 'DIR' */
29013632Ssam 	char *CU_brand;		/* brand, such as 'Hayes' or 'Vadic' */
29113632Ssam 	int (*CU_gen)();	/* what to call to search for brands */
29213632Ssam 	int (*CU_open)();	/* what to call to open brand */
29313632Ssam 	int (*CU_clos)();	/* what to call to close brand */
29413632Ssam };
29513632Ssam 
29613632Ssam 	/* This structure tells about a device */
29713632Ssam struct Devices {
29817842Sralph #define	D_type		D_arg[0]
29917842Sralph #define	D_line		D_arg[1]
30017842Sralph #define	D_calldev	D_arg[2]
30117842Sralph #define	D_class		D_arg[3]
30217842Sralph #define	D_brand		D_arg[4]
30317842Sralph #define	D_CHAT		5
30417842Sralph 	int  D_numargs;
30517842Sralph 	int  D_speed;
30617842Sralph 	char *D_arg[20];
30717842Sralph 	char D_argbfr[100];
30813632Ssam };
30913632Ssam 
31013632Ssam 	/*  system status stuff  */
31113632Ssam #define SS_OK		0
31213632Ssam #define SS_NODEVICE	1
31313632Ssam #define SS_CALLBACK	2
31413632Ssam #define SS_INPROGRESS	3
31523681Sbloom #define SS_FAIL		4
31613632Ssam #define SS_BADSEQ	5
31717842Sralph #define SS_WRONGTIME	6
31813632Ssam 
31913632Ssam 	/*  fail/retry parameters  */
32023681Sbloom #define RETRYTIME	600
32123681Sbloom #define MAXRECALLS	25
32213632Ssam 
32313632Ssam 	/*  stuff for command execution  */
32413632Ssam #define X_RQDFILE	'F'
32513632Ssam #define X_STDIN		'I'
32613632Ssam #define X_STDOUT	'O'
32713632Ssam #define X_CMD		'C'
32813632Ssam #define X_USER		'U'
32913632Ssam #define X_SENDFILE	'S'
33013632Ssam #define	X_NONOTI	'N'
33117842Sralph #define X_RETURNTO	'R'
33213632Ssam #define	X_NONZERO	'Z'
33313632Ssam #define X_LOCK		"LCK.XQT"
33423681Sbloom #define X_LOCKTIME	3600L
33513632Ssam 
33623681Sbloom #define WKDSIZE		100	/*  size of work dir name  */
33713632Ssam 
33818624Sralph #include <sys/types.h>
33918624Sralph #ifndef USG
34018624Sralph #include <sys/timeb.h>
34118624Sralph #else USG
34218624Sralph struct timeb
34318624Sralph {
34418624Sralph 	time_t	time;
34518624Sralph 	unsigned short millitm;
34618624Sralph 	short	timezone;
34718624Sralph 	short	dstflag;
34818624Sralph };
34923681Sbloom #define rindex strrchr
35023681Sbloom #define index strchr
35118624Sralph #endif USG
35218624Sralph 
35318624Sralph extern struct timeb Now;
35418624Sralph 
35513632Ssam extern int Ifn, Ofn;
35618624Sralph extern char *Rmtname;
35713632Ssam extern char User[];
35813632Ssam extern char Loginuser[];
35913632Ssam extern char *Spool;
36013632Ssam extern char Myname[];
36117842Sralph extern char Myfullname[];
36213632Ssam extern int Debug;
36313632Ssam extern int Bspeed;
36413632Ssam extern char Wrkdir[];
36523681Sbloom extern time_t Retrytime;
36617842Sralph extern short Usrf;
36717842Sralph extern int IsTcpIp;
36813632Ssam extern char Progname[];
36913632Ssam extern int (*CU_end)();
37013632Ssam extern struct condev condevs[];
37117842Sralph extern int nologinflag;
37217842Sralph extern char NOLOGIN[];
37313632Ssam 
37417842Sralph extern	char DLocal[], DLocalX[], *subfile(), *subdir();
37513632Ssam 
37613632Ssam /* Commonly called routines which return non-int value */
37713632Ssam extern	char *ttyname(), *strcpy(), *strcat(), *index(), *rindex(),
37817842Sralph 		*fgets(), *calloc(), *malloc(), *fdig(), *ttyname(),
37923681Sbloom 		*cfgets(), *getwd(), *strpbrk(), *strncpy();
38013632Ssam extern	long lseek();
38113992Sgray extern	FILE *rpopen();
38223681Sbloom extern time_t time();
38317842Sralph 
38417842Sralph extern char _FAILED[], CANTOPEN[], DEVNULL[];
38523681Sbloom 
38623681Sbloom #ifdef lint
38723681Sbloom /* This horrible gross kludge is the only way I know to
38823681Sbloom  * convince lint that signal(SIGINT,SIG_IGN) is legal. It hates SIG_IGN.
38923681Sbloom  */
39023681Sbloom #ifdef SIG_IGN
39123681Sbloom #undef SIG_IGN
39223681Sbloom #endif /* SIG_IGN */
39323681Sbloom #define SIG_IGN	main
39423681Sbloom extern int main();
39523681Sbloom #ifdef DEBUG
39623681Sbloom #undef DEBUG
39723681Sbloom #endif DEBUG
39823681Sbloom #define DEBUG(a,b,c)
39923681Sbloom #endif /* lint */
400