xref: /csrg-svn/usr.bin/uucp/includes/uucp.h (revision 44709)
1*44709Strent /*	@(#)uucp.h	5.17	06/29/90	*/
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  */
11223728Sbloom #define BSD4_3 	/**/
11323681Sbloom #define BSD4_2 	/**/
11426152Sbloom /*#define BRL4_2 /**/
11517842Sralph 
11626152Sbloom #if defined(BRL4_2) && !defined(BSD4_2)
11726152Sbloom #define BSD4_2
11826152Sbloom #undef BSD4_3
11926152Sbloom #endif BRL4_2
12026152Sbloom 
12117842Sralph /*
12217842Sralph  * If you are using /etc/inetd with 4.2bsd, define BSDINETD
12317842Sralph  */
12423681Sbloom #define BSDINETD	/**/
12517842Sralph 
12623728Sbloom /*
12726152Sbloom  * If you are running 4.3bsd or BRL 4.2, you are running the inetd
12823728Sbloom  */
12923728Sbloom 
13026152Sbloom #if (defined(BSD4_3) || defined(BRL4_2)) && !defined(BSDINETD)
13123728Sbloom #define BSDINETD
13226152Sbloom #endif (BSD4_3 ||BRL4_2) && !BSDINETD
13323728Sbloom 
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  */
14033976Srick /* #define DIALINOUT	"/usr/lib/uucp/acucntrl" /**/
14117842Sralph 
14223681Sbloom /*
14323681Sbloom  *	If you want all ACU lines to be DIALINOUT, define ALLACUINOUT
14423681Sbloom  */
14533976Srick /* #define ALLACUINOUT	/**/
14613632Ssam 
14713632Ssam /* define the value of WFMASK - for umask call - used for all uucp work files */
14813632Ssam #define WFMASK 0137
14913632Ssam 
15013632Ssam /* define the value of LOGMASK - for LOGFILE, SYSLOG, ERRLOG */
15123681Sbloom #define	LOGMASK		0133
15213632Ssam 
15313632Ssam /* All files are given at least the following at the final destination */
15413632Ssam /* It is also the default mode, so '666' is recommended */
15513632Ssam /* and 444 is minimal (minimally useful, maximally annoying) */
15613632Ssam #define	BASEMODE	0666
15713632Ssam 
15817842Sralph /*
15917842Sralph  * Define NOSTRANGERS if you don't want to accept transactions from
16017842Sralph  * sites that are not in your L.sys file (see cico.c)
16117842Sralph  */
16223681Sbloom #define NOSTRANGERS	/**/
16326152Sbloom 
16417842Sralph /*
165*44709Strent  * Traditionally LCK (lock) files have been kept in /var/spool/uucp.
16617842Sralph  * If you want that define LOCKDIR to be ".".
16725269Sbloom  * If you want the locks kept in a subdirectory, define LOCKDIR as "LCK".
16817842Sralph  * Good news about LCK. subdirectory: the directory can be mode 777 so
16917842Sralph  * unprivileged programs can share the uucp locking system,
17017842Sralph  * and the subdirectory keeps down clutter in the main directory.
17117842Sralph  * The BAD news: you have to change 'tip' and another programs that
17217842Sralph  * know where the LCK files are kept, and you have to change your /etc/rc
17317842Sralph  * if your rc cleans out the lock files (as it should).
17417842Sralph  */
17533976Srick /* #define	LOCKDIR	"LCK"	/**/
17633976Srick #define LOCKDIR	"." /**/
17713632Ssam 
17825269Sbloom /*
17917842Sralph  * If you want uucp and uux to copy the data files by default,
18017842Sralph  * don't define DONTCOPY (This is the way older 4bsd uucps worked)
18117842Sralph  * If you want uucp and uux to use the original files instead of
18217842Sralph  * copies, define DONTCOPY (This is the way System III and V work)
18317842Sralph  */
18423681Sbloom #define DONTCOPY	/**/
18517842Sralph 
18617842Sralph /*
18718624Sralph  * Very few (that I know of) systems use the sequence checking feature.
18817842Sralph  * If you are not going to use it (hint: you are not),
18917842Sralph  * do not define GNXSEQ.  This saves precious room on PDP11s.
19017842Sralph  */
19123681Sbloom /*#define	GNXSEQ	/* comment this out to save space */
19217842Sralph 
19318624Sralph /*
19418624Sralph  * If you want the logfile stored in a file for each site instead
19518624Sralph  * of one file
19618624Sralph  * define LOGBYSITE as the directory to put the files in
19718624Sralph  */
198*44709Strent /* #define LOGBYSITE	"/var/spool/uucp/LOG" /**/
19918624Sralph 
20033587Srick /*
20133960Srick  * define USE_SYSLOG if you want error messages to use SYSLOG instead
202*44709Strent  * of being written to /var/spool/log/ERRLOG
20333960Srick  */
20433960Srick #define USE_SYSLOG	/**/
20533960Srick 
20633960Srick /*
20733587Srick  * If you are doing rebilling and need connect accounting,
20833960Srick  * define DO_CONNECT_ACCOUNTING to be the accounting file name
20933587Srick  */
210*44709Strent /*#define DO_CONNECT_ACCOUNTING	"/var/spool/uucp/CONNECT"	/**/
21133587Srick 
212*44709Strent #define XQTDIR		"/var/spool/uucp/XTMP"
21313632Ssam #define SQFILE		"/usr/lib/uucp/SQFILE"
21413632Ssam #define SQTMP		"/usr/lib/uucp/SQTMP"
21513632Ssam #define SLCKTIME	5400	/* system/device timeout (LCK.. files) */
21613632Ssam #define SEQFILE		"/usr/lib/uucp/SEQF"
21713632Ssam #define SYSFILE		"/usr/lib/uucp/L.sys"
21813632Ssam #define DEVFILE		"/usr/lib/uucp/L-devices"
21913632Ssam #define DIALFILE	"/usr/lib/uucp/L-dialcodes"
22013632Ssam #define USERFILE	"/usr/lib/uucp/USERFILE"
22113632Ssam #define	CMDFILE		"/usr/lib/uucp/L.cmds"
22218624Sralph #define	ALIASFILE	"/usr/lib/uucp/L.aliases"
22313632Ssam 
224*44709Strent #define SPOOL		"/var/spool/uucp"
225*44709Strent #define SYSLOG		"/var/spool/uucp/SYSLOG"
226*44709Strent #define PUBDIR		"/var/spool/uucppublic"
22713632Ssam 
22826152Sbloom #define SQLOCK		"SQ"
22925269Sbloom #define SEQLOCK		"SEQL"
23013632Ssam #define CMDPRE		'C'
23113632Ssam #define DATAPRE		'D'
23213632Ssam #define XQTPRE		'X'
23313632Ssam 
234*44709Strent #define LOGFILE		"/var/spool/uucp/LOGFILE"
235*44709Strent #define ERRLOG		"/var/spool/uucp/ERRLOG"
236*44709Strent #define CMDSDIR		"/var/spool/uucp/C."
237*44709Strent #define DATADIR		"/var/spool/uucp/D."
238*44709Strent #define XEQTDIR		"/var/spool/uucp/X."
23913632Ssam 
24013632Ssam #define RMTDEBUG	"AUDIT"
24117842Sralph #define CORRUPT		"CORRUPT"
24213632Ssam #define SQTIME		60
24313632Ssam #define TRYCALLS	2	/* number of tries to dial call */
24413632Ssam 
24533587Srick #define LLEN	150
24617842Sralph #define MAXRQST	250
24717842Sralph 
24813632Ssam #define DEBUG(l, f, s) if (Debug >= l) fprintf(stderr, f, s); else
24913632Ssam 
25025269Sbloom #define delock(dev)	rmlock(dev)
25125269Sbloom #define mlock(dev)	ulockf(dev, SLCKTIME)
25225269Sbloom 
25323681Sbloom #define SAME		0
25423681Sbloom #define ANYREAD		0004
25523681Sbloom #define ANYWRITE	02
25623681Sbloom #define FAIL		-1
25723681Sbloom #define SUCCESS		0
25823681Sbloom #define CNULL		(char *) 0
25923681Sbloom #define STBNULL		(struct sgttyb *) 0
26023681Sbloom #define MASTER		1
26123681Sbloom #define SLAVE		0
26223681Sbloom #define MAXFULLNAME	255
26323681Sbloom #define MAXMSGTIME	45
26423681Sbloom #define NAMESIZE	255
26523681Sbloom #define MAXBASENAME	14
26623681Sbloom #define SYSNSIZE	(MAXBASENAME-1-1-1-4)
26723681Sbloom #define EOTMSG		"\04\n\04\n"
26823681Sbloom #define CALLBACK	1
26923681Sbloom #define ONEDAY		86400L
27013632Ssam 
27113632Ssam 	/*  commands  */
27213632Ssam #define SHELL		"/bin/sh"
27317842Sralph #define MAIL		"/usr/lib/sendmail"
27413632Ssam #define UUCICO		"/usr/lib/uucp/uucico"
27513632Ssam #define UUXQT		"/usr/lib/uucp/uuxqt"
27613632Ssam #define UUCP		"uucp"
27713632Ssam 
27813632Ssam 	/*  call connect fail stuff  */
27913632Ssam #define CF_SYSTEM	-1
28013632Ssam #define CF_TIME		-2
28113632Ssam #define CF_LOCK		-3
28213632Ssam #define	CF_NODEV	-4
28313632Ssam #define CF_DIAL		-5
28413632Ssam #define CF_LOGIN	-6
28513632Ssam 
28623681Sbloom #define F_NAME		0
28723681Sbloom #define F_TIME		1
28823681Sbloom #define F_LINE		2
28923681Sbloom #define F_CLASS		3	/* an optional prefix and the speed */
29023681Sbloom #define F_PHONE		4
29123681Sbloom #define F_LOGIN		5
29213632Ssam 
29323681Sbloom #define MAXPH		60	/* maximum length of a phone number */
29413632Ssam 
29513632Ssam 	/* This structure tells how to get to a device */
29613632Ssam struct condev {
29713632Ssam 	char *CU_meth;		/* method, such as 'ACU' or 'DIR' */
29813632Ssam 	char *CU_brand;		/* brand, such as 'Hayes' or 'Vadic' */
29913632Ssam 	int (*CU_gen)();	/* what to call to search for brands */
30013632Ssam 	int (*CU_open)();	/* what to call to open brand */
30113632Ssam 	int (*CU_clos)();	/* what to call to close brand */
30213632Ssam };
30313632Ssam 
30413632Ssam 	/* This structure tells about a device */
30513632Ssam struct Devices {
30617842Sralph #define	D_type		D_arg[0]
30717842Sralph #define	D_line		D_arg[1]
30817842Sralph #define	D_calldev	D_arg[2]
30917842Sralph #define	D_class		D_arg[3]
31017842Sralph #define	D_brand		D_arg[4]
31117842Sralph #define	D_CHAT		5
31217842Sralph 	int  D_numargs;
31317842Sralph 	int  D_speed;
31417842Sralph 	char *D_arg[20];
31517842Sralph 	char D_argbfr[100];
31613632Ssam };
31713632Ssam 
31813632Ssam 	/*  system status stuff  */
31913632Ssam #define SS_OK		0
32013632Ssam #define SS_NODEVICE	1
32113632Ssam #define SS_CALLBACK	2
32213632Ssam #define SS_INPROGRESS	3
32323681Sbloom #define SS_FAIL		4
32413632Ssam #define SS_BADSEQ	5
32517842Sralph #define SS_WRONGTIME	6
32613632Ssam 
32713632Ssam 	/*  fail/retry parameters  */
32823681Sbloom #define RETRYTIME	600
32923681Sbloom #define MAXRECALLS	25
33013632Ssam 
33113632Ssam 	/*  stuff for command execution  */
33213632Ssam #define X_RQDFILE	'F'
33313632Ssam #define X_STDIN		'I'
33413632Ssam #define X_STDOUT	'O'
33513632Ssam #define X_CMD		'C'
33613632Ssam #define X_USER		'U'
33713632Ssam #define X_SENDFILE	'S'
33813632Ssam #define	X_NONOTI	'N'
33917842Sralph #define X_RETURNTO	'R'
34013632Ssam #define	X_NONZERO	'Z'
34125269Sbloom #define X_LOCK		"XQT"
34223681Sbloom #define X_LOCKTIME	3600L
34313632Ssam 
34423681Sbloom #define WKDSIZE		100	/*  size of work dir name  */
34513632Ssam 
34618624Sralph #include <sys/types.h>
34718624Sralph #ifndef USG
34818624Sralph #include <sys/timeb.h>
34918624Sralph #else USG
35018624Sralph struct timeb
35118624Sralph {
35218624Sralph 	time_t	time;
35318624Sralph 	unsigned short millitm;
35418624Sralph 	short	timezone;
35518624Sralph 	short	dstflag;
35618624Sralph };
35723681Sbloom #define rindex strrchr
35823681Sbloom #define index strchr
35918624Sralph #endif USG
36018624Sralph 
36133960Srick #ifdef BSD4_2
36233960Srick #include <syslog.h>
36333960Srick #endif /* BSD4_2 */
36433960Srick 
36518624Sralph extern struct timeb Now;
36618624Sralph 
36713632Ssam extern int Ifn, Ofn;
36818624Sralph extern char *Rmtname;
36913632Ssam extern char User[];
37013632Ssam extern char Loginuser[];
37113632Ssam extern char *Spool;
37213632Ssam extern char Myname[];
37317842Sralph extern char Myfullname[];
37413632Ssam extern int Debug;
37513632Ssam extern int Bspeed;
37613632Ssam extern char Wrkdir[];
37723681Sbloom extern time_t Retrytime;
37817842Sralph extern short Usrf;
37917842Sralph extern int IsTcpIp;
38013632Ssam extern char Progname[];
38113632Ssam extern int (*CU_end)();
38213632Ssam extern struct condev condevs[];
38317842Sralph extern char NOLOGIN[];
38413632Ssam 
38517842Sralph extern	char DLocal[], DLocalX[], *subfile(), *subdir();
38613632Ssam 
38713632Ssam /* Commonly called routines which return non-int value */
38813632Ssam extern	char *ttyname(), *strcpy(), *strcat(), *index(), *rindex(),
38917842Sralph 		*fgets(), *calloc(), *malloc(), *fdig(), *ttyname(),
39023681Sbloom 		*cfgets(), *getwd(), *strpbrk(), *strncpy();
39113632Ssam extern	long lseek();
39223681Sbloom extern time_t time();
39317842Sralph 
39417842Sralph extern char _FAILED[], CANTOPEN[], DEVNULL[];
39523681Sbloom 
39623681Sbloom #ifdef lint
39723681Sbloom /* This horrible gross kludge is the only way I know to
39823681Sbloom  * convince lint that signal(SIGINT,SIG_IGN) is legal. It hates SIG_IGN.
39923681Sbloom  */
40023681Sbloom #ifdef SIG_IGN
40123681Sbloom #undef SIG_IGN
40223681Sbloom #endif /* SIG_IGN */
40323681Sbloom #define SIG_IGN	main
40423681Sbloom extern int main();
40523681Sbloom #ifdef DEBUG
40623681Sbloom #undef DEBUG
40723681Sbloom #endif DEBUG
40823681Sbloom #define DEBUG(a,b,c)
40923681Sbloom #endif /* lint */
410