xref: /csrg-svn/usr.bin/uucp/includes/uucp.h (revision 46993)
1*46993Sbostic /*	@(#)uucp.h	5.18	03/05/91	*/
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  *
2817842Sralph  * You should also define MYNAME to be your uucp name.
2913632Ssam  *
3013632Ssam  * For each of the above that are defined, uucp checks them in order.
3113632Ssam  * It stops on the first method that returns a non null name.
3213632Ssam  * If everything fails, it uses "unknown" for the system name.
3313632Ssam  */
3423681Sbloom #define	GETHOSTNAME	/**/
3523681Sbloom /* #define UNAME	/**/
3623681Sbloom /* #define WHOAMI	/**/
3723681Sbloom /* #define CCWHOAMI	/**/
3823681Sbloom /* #define UUNAME	/**/
3913632Ssam /* If the above fails ... */
4023681Sbloom #define	MYNAME	"erehwon"
4113632Ssam 
4213632Ssam /*
4313632Ssam  * Define the various kinds of connections to include.
4413632Ssam  * The complete list is in the condevs array in condevs.c
4513632Ssam  */
4633976Srick #define ATT2224		/* AT&T 2224 */
4733976Srick #define BSDTCP		/* 4.2bsd TCP/IP */
4833976Srick #define CDS224		/* Concord Data Systems 2400 */
4925269Sbloom /* #define DATAKIT	/* ATT's datakit */
5033976Srick #define DF02		/* Dec's DF02/DF03 */
5133976Srick #define DF112		/* Dec's DF112 */
5233976Srick #define DN11		/* "standard" DEC dialer */
5317872Sralph #define HAYES		/* Hayes' Smartmodem */
5433976Srick #define HAYES2400	/* Hayes' 2400 baud Smartmodem */
5525269Sbloom /* #define MICOM	/* Micom Mux port */
5633976Srick #define NOVATION	/* Novation modem */
5733976Srick #define PAD		/* X.25 PAD */
5833976Srick #define PENRIL		/* PENRIL Dialer */
5925269Sbloom /* #define PNET		/* Purdue network */
6033976Srick #define RVMACS		/* Racal-Vadic MACS  820 dialer, 831 adaptor */
6125269Sbloom /* #define SYTEK	/* Sytek Local Area Net */
6225269Sbloom /* #define UNETTCP	/* 3Com's UNET */
6326152Sbloom #define USR2400		/* USRobotics Courier 2400 */
6433976Srick #define VA212		/* Racal-Vadic 212 */
6533976Srick #define VA811S		/* Racal-Vadic 811S dialer, 831 adaptor */
6633976Srick #define VA820		/* Racal-Vadic 820 dialer, 831 adaptor */
6733976Srick #define VADIC		/* Racal-Vadic 345x */
6833976Srick #define VENTEL		/* Ventel Dialer */
6933976Srick #define VMACS		/* Racal-Vadic MACS  811 dialer, 831 adaptor */
7013632Ssam 
7126152Sbloom #if defined(USR2400) && !defined(HAYES)
7226152Sbloom #define HAYES
7326152Sbloom #endif USR2400 && !HAYES
7426152Sbloom 
7517842Sralph #if defined(UNETTCP) || defined(BSDTCP)
7617842Sralph #define TCPIP
7717842Sralph #endif
7817842Sralph 
7913632Ssam /*
8025707Sbloom  * We need a timer to write slowly to certain modems.
8125707Sbloom  * and for generating breaks.
8225707Sbloom  *
8323728Sbloom  * define INTERVALTIMER to use 4.[23] bsd interval timer.
8413632Ssam  * define FASTTIMER if you have the nap() system call.
8513632Ssam  * define FTIME if you have the ftime() system call.
8613632Ssam  * define BUSYLOOP if you must do a busy loop.
8713632Ssam  * Look at uucpdelay() in condevs.c for details.
8813632Ssam  */
8923681Sbloom #define	INTERVALTIMER
9025269Sbloom /*#define FASTTIMER /**/
9125269Sbloom /*#define FTIME /**/
9225269Sbloom /*#define BUSYLOOP /**/
9313632Ssam 
9413632Ssam /*
9513632Ssam  * If your site is using "ndir.h" to retrofit the Berkeley
9613632Ssam  * directory reading routines, define NDIR.
9713632Ssam  * You will probably also have to set LIBNDIR in Makefile.
9813632Ssam  * Otherwise, <dir.h> is assumed to have the Berkeley directory definitions.
9913632Ssam  */
10023681Sbloom /*#define	NDIR	/**/
10113632Ssam 
10213632Ssam /*
10323681Sbloom  * If yours is a BTL system III, IV, V or so-on site, define USG.
10413632Ssam  */
10523681Sbloom /*#define	USG	/**/
10613632Ssam 
10717842Sralph /*
10823728Sbloom  * If you are running 4.3bsd, define BSD4_3 and BSD4_2
10923728Sbloom  * If you are just running 4.2bsd, define BSD4_2
11026152Sbloom  * If you are running the BRL version of 4.2BSD define BRL4_2, NOT BSD4_3
11117842Sralph  */
112*46993Sbostic #ifndef BSD4_3
11323728Sbloom #define BSD4_3 	/**/
114*46993Sbostic #endif
115*46993Sbostic #ifndef BSD4_2
11623681Sbloom #define BSD4_2 	/**/
117*46993Sbostic #endif
11826152Sbloom /*#define BRL4_2 /**/
11917842Sralph 
12026152Sbloom #if defined(BRL4_2) && !defined(BSD4_2)
12126152Sbloom #define BSD4_2
12226152Sbloom #undef BSD4_3
12326152Sbloom #endif BRL4_2
12426152Sbloom 
12517842Sralph /*
12617842Sralph  * If you are using /etc/inetd with 4.2bsd, define BSDINETD
12717842Sralph  */
12823681Sbloom #define BSDINETD	/**/
12917842Sralph 
13023728Sbloom /*
13126152Sbloom  * If you are running 4.3bsd or BRL 4.2, you are running the inetd
13223728Sbloom  */
13323728Sbloom 
13426152Sbloom #if (defined(BSD4_3) || defined(BRL4_2)) && !defined(BSDINETD)
13523728Sbloom #define BSDINETD
13626152Sbloom #endif (BSD4_3 ||BRL4_2) && !BSDINETD
13723728Sbloom 
13817842Sralph /*#define VMSDTR	/* Turn on modem control on vms(works DTR) for
13917842Sralph 			   develcon and gandalf ports to gain access */
14018624Sralph /*
14118624Sralph  *	If you want to use the same modem for dialing in and out define
14218624Sralph  *	DIALINOUT to be the localtion of the acucntrl program
14318624Sralph  */
14433976Srick /* #define DIALINOUT	"/usr/lib/uucp/acucntrl" /**/
14517842Sralph 
14623681Sbloom /*
14723681Sbloom  *	If you want all ACU lines to be DIALINOUT, define ALLACUINOUT
14823681Sbloom  */
14933976Srick /* #define ALLACUINOUT	/**/
15013632Ssam 
15113632Ssam /* define the value of WFMASK - for umask call - used for all uucp work files */
15213632Ssam #define WFMASK 0137
15313632Ssam 
15413632Ssam /* define the value of LOGMASK - for LOGFILE, SYSLOG, ERRLOG */
15523681Sbloom #define	LOGMASK		0133
15613632Ssam 
15713632Ssam /* All files are given at least the following at the final destination */
15813632Ssam /* It is also the default mode, so '666' is recommended */
15913632Ssam /* and 444 is minimal (minimally useful, maximally annoying) */
16013632Ssam #define	BASEMODE	0666
16113632Ssam 
16217842Sralph /*
16317842Sralph  * Define NOSTRANGERS if you don't want to accept transactions from
16417842Sralph  * sites that are not in your L.sys file (see cico.c)
16517842Sralph  */
16623681Sbloom #define NOSTRANGERS	/**/
16726152Sbloom 
16817842Sralph /*
16944709Strent  * Traditionally LCK (lock) files have been kept in /var/spool/uucp.
17017842Sralph  * If you want that define LOCKDIR to be ".".
17125269Sbloom  * If you want the locks kept in a subdirectory, define LOCKDIR as "LCK".
17217842Sralph  * Good news about LCK. subdirectory: the directory can be mode 777 so
17317842Sralph  * unprivileged programs can share the uucp locking system,
17417842Sralph  * and the subdirectory keeps down clutter in the main directory.
17517842Sralph  * The BAD news: you have to change 'tip' and another programs that
17617842Sralph  * know where the LCK files are kept, and you have to change your /etc/rc
17717842Sralph  * if your rc cleans out the lock files (as it should).
17817842Sralph  */
17933976Srick /* #define	LOCKDIR	"LCK"	/**/
18033976Srick #define LOCKDIR	"." /**/
18113632Ssam 
18225269Sbloom /*
18317842Sralph  * If you want uucp and uux to copy the data files by default,
18417842Sralph  * don't define DONTCOPY (This is the way older 4bsd uucps worked)
18517842Sralph  * If you want uucp and uux to use the original files instead of
18617842Sralph  * copies, define DONTCOPY (This is the way System III and V work)
18717842Sralph  */
18823681Sbloom #define DONTCOPY	/**/
18917842Sralph 
19017842Sralph /*
19118624Sralph  * Very few (that I know of) systems use the sequence checking feature.
19217842Sralph  * If you are not going to use it (hint: you are not),
19317842Sralph  * do not define GNXSEQ.  This saves precious room on PDP11s.
19417842Sralph  */
19523681Sbloom /*#define	GNXSEQ	/* comment this out to save space */
19617842Sralph 
19718624Sralph /*
19818624Sralph  * If you want the logfile stored in a file for each site instead
19918624Sralph  * of one file
20018624Sralph  * define LOGBYSITE as the directory to put the files in
20118624Sralph  */
20244709Strent /* #define LOGBYSITE	"/var/spool/uucp/LOG" /**/
20318624Sralph 
20433587Srick /*
20533960Srick  * define USE_SYSLOG if you want error messages to use SYSLOG instead
20644709Strent  * of being written to /var/spool/log/ERRLOG
20733960Srick  */
20833960Srick #define USE_SYSLOG	/**/
20933960Srick 
21033960Srick /*
21133587Srick  * If you are doing rebilling and need connect accounting,
21233960Srick  * define DO_CONNECT_ACCOUNTING to be the accounting file name
21333587Srick  */
21444709Strent /*#define DO_CONNECT_ACCOUNTING	"/var/spool/uucp/CONNECT"	/**/
21533587Srick 
21644709Strent #define XQTDIR		"/var/spool/uucp/XTMP"
21713632Ssam #define SQFILE		"/usr/lib/uucp/SQFILE"
21813632Ssam #define SQTMP		"/usr/lib/uucp/SQTMP"
21913632Ssam #define SLCKTIME	5400	/* system/device timeout (LCK.. files) */
22013632Ssam #define SEQFILE		"/usr/lib/uucp/SEQF"
22113632Ssam #define SYSFILE		"/usr/lib/uucp/L.sys"
22213632Ssam #define DEVFILE		"/usr/lib/uucp/L-devices"
22313632Ssam #define DIALFILE	"/usr/lib/uucp/L-dialcodes"
22413632Ssam #define USERFILE	"/usr/lib/uucp/USERFILE"
22513632Ssam #define	CMDFILE		"/usr/lib/uucp/L.cmds"
22618624Sralph #define	ALIASFILE	"/usr/lib/uucp/L.aliases"
22713632Ssam 
22844709Strent #define SPOOL		"/var/spool/uucp"
22944709Strent #define SYSLOG		"/var/spool/uucp/SYSLOG"
23044709Strent #define PUBDIR		"/var/spool/uucppublic"
23113632Ssam 
23226152Sbloom #define SQLOCK		"SQ"
23325269Sbloom #define SEQLOCK		"SEQL"
23413632Ssam #define CMDPRE		'C'
23513632Ssam #define DATAPRE		'D'
23613632Ssam #define XQTPRE		'X'
23713632Ssam 
23844709Strent #define LOGFILE		"/var/spool/uucp/LOGFILE"
23944709Strent #define ERRLOG		"/var/spool/uucp/ERRLOG"
24044709Strent #define CMDSDIR		"/var/spool/uucp/C."
24144709Strent #define DATADIR		"/var/spool/uucp/D."
24244709Strent #define XEQTDIR		"/var/spool/uucp/X."
24313632Ssam 
24413632Ssam #define RMTDEBUG	"AUDIT"
24517842Sralph #define CORRUPT		"CORRUPT"
24613632Ssam #define SQTIME		60
24713632Ssam #define TRYCALLS	2	/* number of tries to dial call */
24813632Ssam 
24933587Srick #define LLEN	150
25017842Sralph #define MAXRQST	250
25117842Sralph 
25213632Ssam #define DEBUG(l, f, s) if (Debug >= l) fprintf(stderr, f, s); else
25313632Ssam 
25425269Sbloom #define delock(dev)	rmlock(dev)
25525269Sbloom #define mlock(dev)	ulockf(dev, SLCKTIME)
25625269Sbloom 
25723681Sbloom #define SAME		0
25823681Sbloom #define ANYREAD		0004
25923681Sbloom #define ANYWRITE	02
26023681Sbloom #define FAIL		-1
26123681Sbloom #define SUCCESS		0
26223681Sbloom #define CNULL		(char *) 0
26323681Sbloom #define STBNULL		(struct sgttyb *) 0
26423681Sbloom #define MASTER		1
26523681Sbloom #define SLAVE		0
26623681Sbloom #define MAXFULLNAME	255
26723681Sbloom #define MAXMSGTIME	45
26823681Sbloom #define NAMESIZE	255
26923681Sbloom #define MAXBASENAME	14
27023681Sbloom #define SYSNSIZE	(MAXBASENAME-1-1-1-4)
27123681Sbloom #define EOTMSG		"\04\n\04\n"
27223681Sbloom #define CALLBACK	1
27323681Sbloom #define ONEDAY		86400L
27413632Ssam 
27513632Ssam 	/*  commands  */
27613632Ssam #define SHELL		"/bin/sh"
27717842Sralph #define MAIL		"/usr/lib/sendmail"
27813632Ssam #define UUCICO		"/usr/lib/uucp/uucico"
27913632Ssam #define UUXQT		"/usr/lib/uucp/uuxqt"
28013632Ssam #define UUCP		"uucp"
28113632Ssam 
28213632Ssam 	/*  call connect fail stuff  */
28313632Ssam #define CF_SYSTEM	-1
28413632Ssam #define CF_TIME		-2
28513632Ssam #define CF_LOCK		-3
28613632Ssam #define	CF_NODEV	-4
28713632Ssam #define CF_DIAL		-5
28813632Ssam #define CF_LOGIN	-6
28913632Ssam 
29023681Sbloom #define F_NAME		0
29123681Sbloom #define F_TIME		1
29223681Sbloom #define F_LINE		2
29323681Sbloom #define F_CLASS		3	/* an optional prefix and the speed */
29423681Sbloom #define F_PHONE		4
29523681Sbloom #define F_LOGIN		5
29613632Ssam 
29723681Sbloom #define MAXPH		60	/* maximum length of a phone number */
29813632Ssam 
29913632Ssam 	/* This structure tells how to get to a device */
30013632Ssam struct condev {
30113632Ssam 	char *CU_meth;		/* method, such as 'ACU' or 'DIR' */
30213632Ssam 	char *CU_brand;		/* brand, such as 'Hayes' or 'Vadic' */
30313632Ssam 	int (*CU_gen)();	/* what to call to search for brands */
30413632Ssam 	int (*CU_open)();	/* what to call to open brand */
30513632Ssam 	int (*CU_clos)();	/* what to call to close brand */
30613632Ssam };
30713632Ssam 
30813632Ssam 	/* This structure tells about a device */
30913632Ssam struct Devices {
31017842Sralph #define	D_type		D_arg[0]
31117842Sralph #define	D_line		D_arg[1]
31217842Sralph #define	D_calldev	D_arg[2]
31317842Sralph #define	D_class		D_arg[3]
31417842Sralph #define	D_brand		D_arg[4]
31517842Sralph #define	D_CHAT		5
31617842Sralph 	int  D_numargs;
31717842Sralph 	int  D_speed;
31817842Sralph 	char *D_arg[20];
31917842Sralph 	char D_argbfr[100];
32013632Ssam };
32113632Ssam 
32213632Ssam 	/*  system status stuff  */
32313632Ssam #define SS_OK		0
32413632Ssam #define SS_NODEVICE	1
32513632Ssam #define SS_CALLBACK	2
32613632Ssam #define SS_INPROGRESS	3
32723681Sbloom #define SS_FAIL		4
32813632Ssam #define SS_BADSEQ	5
32917842Sralph #define SS_WRONGTIME	6
33013632Ssam 
33113632Ssam 	/*  fail/retry parameters  */
33223681Sbloom #define RETRYTIME	600
33323681Sbloom #define MAXRECALLS	25
33413632Ssam 
33513632Ssam 	/*  stuff for command execution  */
33613632Ssam #define X_RQDFILE	'F'
33713632Ssam #define X_STDIN		'I'
33813632Ssam #define X_STDOUT	'O'
33913632Ssam #define X_CMD		'C'
34013632Ssam #define X_USER		'U'
34113632Ssam #define X_SENDFILE	'S'
34213632Ssam #define	X_NONOTI	'N'
34317842Sralph #define X_RETURNTO	'R'
34413632Ssam #define	X_NONZERO	'Z'
34525269Sbloom #define X_LOCK		"XQT"
34623681Sbloom #define X_LOCKTIME	3600L
34713632Ssam 
34823681Sbloom #define WKDSIZE		100	/*  size of work dir name  */
34913632Ssam 
35018624Sralph #include <sys/types.h>
35118624Sralph #ifndef USG
35218624Sralph #include <sys/timeb.h>
35318624Sralph #else USG
35418624Sralph struct timeb
35518624Sralph {
35618624Sralph 	time_t	time;
35718624Sralph 	unsigned short millitm;
35818624Sralph 	short	timezone;
35918624Sralph 	short	dstflag;
36018624Sralph };
36123681Sbloom #define rindex strrchr
36223681Sbloom #define index strchr
36318624Sralph #endif USG
36418624Sralph 
36533960Srick #ifdef BSD4_2
36633960Srick #include <syslog.h>
36733960Srick #endif /* BSD4_2 */
36833960Srick 
36918624Sralph extern struct timeb Now;
37018624Sralph 
37113632Ssam extern int Ifn, Ofn;
37218624Sralph extern char *Rmtname;
37313632Ssam extern char User[];
37413632Ssam extern char Loginuser[];
37513632Ssam extern char *Spool;
37613632Ssam extern char Myname[];
37717842Sralph extern char Myfullname[];
37813632Ssam extern int Debug;
37913632Ssam extern int Bspeed;
38013632Ssam extern char Wrkdir[];
38123681Sbloom extern time_t Retrytime;
38217842Sralph extern short Usrf;
38317842Sralph extern int IsTcpIp;
38413632Ssam extern char Progname[];
38513632Ssam extern int (*CU_end)();
38613632Ssam extern struct condev condevs[];
38717842Sralph extern char NOLOGIN[];
38813632Ssam 
38917842Sralph extern	char DLocal[], DLocalX[], *subfile(), *subdir();
39013632Ssam 
39113632Ssam /* Commonly called routines which return non-int value */
39213632Ssam extern	char *ttyname(), *strcpy(), *strcat(), *index(), *rindex(),
39317842Sralph 		*fgets(), *calloc(), *malloc(), *fdig(), *ttyname(),
39423681Sbloom 		*cfgets(), *getwd(), *strpbrk(), *strncpy();
39513632Ssam extern	long lseek();
39623681Sbloom extern time_t time();
39717842Sralph 
39817842Sralph extern char _FAILED[], CANTOPEN[], DEVNULL[];
39923681Sbloom 
40023681Sbloom #ifdef lint
40123681Sbloom /* This horrible gross kludge is the only way I know to
40223681Sbloom  * convince lint that signal(SIGINT,SIG_IGN) is legal. It hates SIG_IGN.
40323681Sbloom  */
40423681Sbloom #ifdef SIG_IGN
40523681Sbloom #undef SIG_IGN
40623681Sbloom #endif /* SIG_IGN */
40723681Sbloom #define SIG_IGN	main
40823681Sbloom extern int main();
40923681Sbloom #ifdef DEBUG
41023681Sbloom #undef DEBUG
41123681Sbloom #endif DEBUG
41223681Sbloom #define DEBUG(a,b,c)
41323681Sbloom #endif /* lint */
414