xref: /csrg-svn/usr.bin/uucp/includes/uucp.h (revision 62382)
148650Sbostic /*-
2*62382Sbostic  * Copyright (c) 1985, 1993
3*62382Sbostic  *	The Regents of the University of California.  All rights reserved.
448650Sbostic  *
548650Sbostic  * %sccs.include.proprietary.c%
648650Sbostic  *
7*62382Sbostic  *	@(#)uucp.h	8.1 (Berkeley) 06/06/93
848650Sbostic  */
913632Ssam 
1018624Sralph #include <stdio.h>
1113632Ssam 
1213632Ssam /*
1313632Ssam  * Determine local uucp name of this machine.
1413632Ssam  * Define one of the following:
1513632Ssam  *
1613632Ssam  * For UCB 4.1A and later systems, you will have the gethostname(2) call.
1713632Ssam  * If this call exists, define GETHOSTNAME.
1813632Ssam  *
1913632Ssam  * For USG 3.0 and later systems, you will have the uname(2) call.
2013632Ssam  * If this call exists, define UNAME.
2113632Ssam  *
2213632Ssam  * Some systems have a line of the form '#define sysname "myuucpname",'
2313632Ssam  * in the file /usr/include/whoami.h, to identify their machine.
2413632Ssam  * If your site does that, define WHOAMI.
2513632Ssam  *
2613632Ssam  * If your site has <whoami.h>, but you do not want to read
2713632Ssam  * that file every time uucp runs, you can compile sysname into uucp.
2813632Ssam  * This is faster and more reliable, but binaries do not port.
2913632Ssam  * If you want to do that, define CCWHOAMI.
3013632Ssam  *
3113632Ssam  * Some systems put the local uucp name in a single-line file
3213632Ssam  * named /etc/uucpname or /local/uucpname.
3313632Ssam  * If your site does that, define UUNAME.
3413632Ssam  *
3517842Sralph  * You should also define MYNAME to be your uucp name.
3613632Ssam  *
3713632Ssam  * For each of the above that are defined, uucp checks them in order.
3813632Ssam  * It stops on the first method that returns a non null name.
3913632Ssam  * If everything fails, it uses "unknown" for the system name.
4013632Ssam  */
4123681Sbloom #define	GETHOSTNAME	/**/
4223681Sbloom /* #define UNAME	/**/
4323681Sbloom /* #define WHOAMI	/**/
4423681Sbloom /* #define CCWHOAMI	/**/
4523681Sbloom /* #define UUNAME	/**/
4613632Ssam /* If the above fails ... */
4723681Sbloom #define	MYNAME	"erehwon"
4813632Ssam 
4913632Ssam /*
5013632Ssam  * Define the various kinds of connections to include.
5113632Ssam  * The complete list is in the condevs array in condevs.c
5213632Ssam  */
5333976Srick #define ATT2224		/* AT&T 2224 */
5433976Srick #define BSDTCP		/* 4.2bsd TCP/IP */
5533976Srick #define CDS224		/* Concord Data Systems 2400 */
5625269Sbloom /* #define DATAKIT	/* ATT's datakit */
5733976Srick #define DF02		/* Dec's DF02/DF03 */
5833976Srick #define DF112		/* Dec's DF112 */
5933976Srick #define DN11		/* "standard" DEC dialer */
6017872Sralph #define HAYES		/* Hayes' Smartmodem */
6133976Srick #define HAYES2400	/* Hayes' 2400 baud Smartmodem */
6225269Sbloom /* #define MICOM	/* Micom Mux port */
6333976Srick #define NOVATION	/* Novation modem */
6433976Srick #define PAD		/* X.25 PAD */
6533976Srick #define PENRIL		/* PENRIL Dialer */
6625269Sbloom /* #define PNET		/* Purdue network */
6733976Srick #define RVMACS		/* Racal-Vadic MACS  820 dialer, 831 adaptor */
6825269Sbloom /* #define SYTEK	/* Sytek Local Area Net */
6925269Sbloom /* #define UNETTCP	/* 3Com's UNET */
7026152Sbloom #define USR2400		/* USRobotics Courier 2400 */
7133976Srick #define VA212		/* Racal-Vadic 212 */
7233976Srick #define VA811S		/* Racal-Vadic 811S dialer, 831 adaptor */
7333976Srick #define VA820		/* Racal-Vadic 820 dialer, 831 adaptor */
7433976Srick #define VADIC		/* Racal-Vadic 345x */
7533976Srick #define VENTEL		/* Ventel Dialer */
7633976Srick #define VMACS		/* Racal-Vadic MACS  811 dialer, 831 adaptor */
7713632Ssam 
7826152Sbloom #if defined(USR2400) && !defined(HAYES)
7926152Sbloom #define HAYES
8060033Storek #endif /* USR2400 && !HAYES */
8126152Sbloom 
8217842Sralph #if defined(UNETTCP) || defined(BSDTCP)
8317842Sralph #define TCPIP
8417842Sralph #endif
8517842Sralph 
8613632Ssam /*
8725707Sbloom  * We need a timer to write slowly to certain modems.
8825707Sbloom  * and for generating breaks.
8925707Sbloom  *
9023728Sbloom  * define INTERVALTIMER to use 4.[23] bsd interval timer.
9113632Ssam  * define FASTTIMER if you have the nap() system call.
9213632Ssam  * define FTIME if you have the ftime() system call.
9313632Ssam  * define BUSYLOOP if you must do a busy loop.
9413632Ssam  * Look at uucpdelay() in condevs.c for details.
9513632Ssam  */
9623681Sbloom #define	INTERVALTIMER
9725269Sbloom /*#define FASTTIMER /**/
9825269Sbloom /*#define FTIME /**/
9925269Sbloom /*#define BUSYLOOP /**/
10013632Ssam 
10113632Ssam /*
10213632Ssam  * If your site is using "ndir.h" to retrofit the Berkeley
10313632Ssam  * directory reading routines, define NDIR.
10413632Ssam  * You will probably also have to set LIBNDIR in Makefile.
10513632Ssam  * Otherwise, <dir.h> is assumed to have the Berkeley directory definitions.
10613632Ssam  */
10723681Sbloom /*#define	NDIR	/**/
10813632Ssam 
10913632Ssam /*
11023681Sbloom  * If yours is a BTL system III, IV, V or so-on site, define USG.
11113632Ssam  */
11223681Sbloom /*#define	USG	/**/
11313632Ssam 
11417842Sralph /*
11523728Sbloom  * If you are running 4.3bsd, define BSD4_3 and BSD4_2
11623728Sbloom  * If you are just running 4.2bsd, define BSD4_2
11726152Sbloom  * If you are running the BRL version of 4.2BSD define BRL4_2, NOT BSD4_3
11817842Sralph  */
11946993Sbostic #ifndef BSD4_3
12023728Sbloom #define BSD4_3 	/**/
12146993Sbostic #endif
12246993Sbostic #ifndef BSD4_2
12323681Sbloom #define BSD4_2 	/**/
12446993Sbostic #endif
12526152Sbloom /*#define BRL4_2 /**/
12617842Sralph 
12726152Sbloom #if defined(BRL4_2) && !defined(BSD4_2)
12826152Sbloom #define BSD4_2
12926152Sbloom #undef BSD4_3
13060033Storek #endif
13126152Sbloom 
13217842Sralph /*
13317842Sralph  * If you are using /etc/inetd with 4.2bsd, define BSDINETD
13417842Sralph  */
13523681Sbloom #define BSDINETD	/**/
13617842Sralph 
13723728Sbloom /*
13826152Sbloom  * If you are running 4.3bsd or BRL 4.2, you are running the inetd
13923728Sbloom  */
14023728Sbloom 
14126152Sbloom #if (defined(BSD4_3) || defined(BRL4_2)) && !defined(BSDINETD)
14223728Sbloom #define BSDINETD
14360033Storek #endif
14423728Sbloom 
14517842Sralph /*#define VMSDTR	/* Turn on modem control on vms(works DTR) for
14617842Sralph 			   develcon and gandalf ports to gain access */
14718624Sralph /*
14818624Sralph  *	If you want to use the same modem for dialing in and out define
14918624Sralph  *	DIALINOUT to be the localtion of the acucntrl program
15018624Sralph  */
15133976Srick /* #define DIALINOUT	"/usr/lib/uucp/acucntrl" /**/
15217842Sralph 
15323681Sbloom /*
15423681Sbloom  *	If you want all ACU lines to be DIALINOUT, define ALLACUINOUT
15523681Sbloom  */
15633976Srick /* #define ALLACUINOUT	/**/
15713632Ssam 
15813632Ssam /* define the value of WFMASK - for umask call - used for all uucp work files */
15913632Ssam #define WFMASK 0137
16013632Ssam 
16113632Ssam /* define the value of LOGMASK - for LOGFILE, SYSLOG, ERRLOG */
16223681Sbloom #define	LOGMASK		0133
16313632Ssam 
16413632Ssam /* All files are given at least the following at the final destination */
16513632Ssam /* It is also the default mode, so '666' is recommended */
16613632Ssam /* and 444 is minimal (minimally useful, maximally annoying) */
16713632Ssam #define	BASEMODE	0666
16813632Ssam 
16917842Sralph /*
17017842Sralph  * Define NOSTRANGERS if you don't want to accept transactions from
17117842Sralph  * sites that are not in your L.sys file (see cico.c)
17217842Sralph  */
17323681Sbloom #define NOSTRANGERS	/**/
17426152Sbloom 
17517842Sralph /*
17644709Strent  * Traditionally LCK (lock) files have been kept in /var/spool/uucp.
17717842Sralph  * If you want that define LOCKDIR to be ".".
17825269Sbloom  * If you want the locks kept in a subdirectory, define LOCKDIR as "LCK".
17917842Sralph  * Good news about LCK. subdirectory: the directory can be mode 777 so
18017842Sralph  * unprivileged programs can share the uucp locking system,
18117842Sralph  * and the subdirectory keeps down clutter in the main directory.
18217842Sralph  * The BAD news: you have to change 'tip' and another programs that
18317842Sralph  * know where the LCK files are kept, and you have to change your /etc/rc
18417842Sralph  * if your rc cleans out the lock files (as it should).
18517842Sralph  */
18633976Srick /* #define	LOCKDIR	"LCK"	/**/
18733976Srick #define LOCKDIR	"." /**/
18813632Ssam 
18925269Sbloom /*
19017842Sralph  * If you want uucp and uux to copy the data files by default,
19117842Sralph  * don't define DONTCOPY (This is the way older 4bsd uucps worked)
19217842Sralph  * If you want uucp and uux to use the original files instead of
19317842Sralph  * copies, define DONTCOPY (This is the way System III and V work)
19417842Sralph  */
19523681Sbloom #define DONTCOPY	/**/
19617842Sralph 
19717842Sralph /*
19818624Sralph  * Very few (that I know of) systems use the sequence checking feature.
19917842Sralph  * If you are not going to use it (hint: you are not),
20017842Sralph  * do not define GNXSEQ.  This saves precious room on PDP11s.
20117842Sralph  */
20223681Sbloom /*#define	GNXSEQ	/* comment this out to save space */
20317842Sralph 
20418624Sralph /*
20518624Sralph  * If you want the logfile stored in a file for each site instead
20618624Sralph  * of one file
20718624Sralph  * define LOGBYSITE as the directory to put the files in
20818624Sralph  */
20944709Strent /* #define LOGBYSITE	"/var/spool/uucp/LOG" /**/
21018624Sralph 
21133587Srick /*
21233960Srick  * define USE_SYSLOG if you want error messages to use SYSLOG instead
21344709Strent  * of being written to /var/spool/log/ERRLOG
21433960Srick  */
21533960Srick #define USE_SYSLOG	/**/
21633960Srick 
21733960Srick /*
21833587Srick  * If you are doing rebilling and need connect accounting,
21933960Srick  * define DO_CONNECT_ACCOUNTING to be the accounting file name
22033587Srick  */
22144709Strent /*#define DO_CONNECT_ACCOUNTING	"/var/spool/uucp/CONNECT"	/**/
22233587Srick 
22344709Strent #define XQTDIR		"/var/spool/uucp/XTMP"
22413632Ssam #define SQFILE		"/usr/lib/uucp/SQFILE"
22513632Ssam #define SQTMP		"/usr/lib/uucp/SQTMP"
22613632Ssam #define SLCKTIME	5400	/* system/device timeout (LCK.. files) */
22713632Ssam #define SEQFILE		"/usr/lib/uucp/SEQF"
22813632Ssam #define SYSFILE		"/usr/lib/uucp/L.sys"
22913632Ssam #define DEVFILE		"/usr/lib/uucp/L-devices"
23013632Ssam #define DIALFILE	"/usr/lib/uucp/L-dialcodes"
23113632Ssam #define USERFILE	"/usr/lib/uucp/USERFILE"
23213632Ssam #define	CMDFILE		"/usr/lib/uucp/L.cmds"
23318624Sralph #define	ALIASFILE	"/usr/lib/uucp/L.aliases"
23413632Ssam 
23544709Strent #define SPOOL		"/var/spool/uucp"
23644709Strent #define SYSLOG		"/var/spool/uucp/SYSLOG"
23744709Strent #define PUBDIR		"/var/spool/uucppublic"
23813632Ssam 
23926152Sbloom #define SQLOCK		"SQ"
24025269Sbloom #define SEQLOCK		"SEQL"
24113632Ssam #define CMDPRE		'C'
24213632Ssam #define DATAPRE		'D'
24313632Ssam #define XQTPRE		'X'
24413632Ssam 
24544709Strent #define LOGFILE		"/var/spool/uucp/LOGFILE"
24644709Strent #define ERRLOG		"/var/spool/uucp/ERRLOG"
24744709Strent #define CMDSDIR		"/var/spool/uucp/C."
24844709Strent #define DATADIR		"/var/spool/uucp/D."
24944709Strent #define XEQTDIR		"/var/spool/uucp/X."
25013632Ssam 
25113632Ssam #define RMTDEBUG	"AUDIT"
25217842Sralph #define CORRUPT		"CORRUPT"
25313632Ssam #define SQTIME		60
25413632Ssam #define TRYCALLS	2	/* number of tries to dial call */
25513632Ssam 
25633587Srick #define LLEN	150
25717842Sralph #define MAXRQST	250
25817842Sralph 
25913632Ssam #define DEBUG(l, f, s) if (Debug >= l) fprintf(stderr, f, s); else
26013632Ssam 
26125269Sbloom #define delock(dev)	rmlock(dev)
26225269Sbloom #define mlock(dev)	ulockf(dev, SLCKTIME)
26325269Sbloom 
26423681Sbloom #define SAME		0
26523681Sbloom #define ANYREAD		0004
26623681Sbloom #define ANYWRITE	02
26723681Sbloom #define FAIL		-1
26823681Sbloom #define SUCCESS		0
26923681Sbloom #define CNULL		(char *) 0
27023681Sbloom #define STBNULL		(struct sgttyb *) 0
27123681Sbloom #define MASTER		1
27223681Sbloom #define SLAVE		0
27323681Sbloom #define MAXFULLNAME	255
27423681Sbloom #define MAXMSGTIME	45
27523681Sbloom #define NAMESIZE	255
27623681Sbloom #define MAXBASENAME	14
27723681Sbloom #define SYSNSIZE	(MAXBASENAME-1-1-1-4)
27823681Sbloom #define EOTMSG		"\04\n\04\n"
27923681Sbloom #define CALLBACK	1
28023681Sbloom #define ONEDAY		86400L
28113632Ssam 
28213632Ssam 	/*  commands  */
28313632Ssam #define SHELL		"/bin/sh"
28417842Sralph #define MAIL		"/usr/lib/sendmail"
28513632Ssam #define UUCICO		"/usr/lib/uucp/uucico"
28613632Ssam #define UUXQT		"/usr/lib/uucp/uuxqt"
28713632Ssam #define UUCP		"uucp"
28813632Ssam 
28913632Ssam 	/*  call connect fail stuff  */
29013632Ssam #define CF_SYSTEM	-1
29113632Ssam #define CF_TIME		-2
29213632Ssam #define CF_LOCK		-3
29313632Ssam #define	CF_NODEV	-4
29413632Ssam #define CF_DIAL		-5
29513632Ssam #define CF_LOGIN	-6
29613632Ssam 
29723681Sbloom #define F_NAME		0
29823681Sbloom #define F_TIME		1
29923681Sbloom #define F_LINE		2
30023681Sbloom #define F_CLASS		3	/* an optional prefix and the speed */
30123681Sbloom #define F_PHONE		4
30223681Sbloom #define F_LOGIN		5
30313632Ssam 
30423681Sbloom #define MAXPH		60	/* maximum length of a phone number */
30513632Ssam 
30613632Ssam 	/* This structure tells how to get to a device */
30713632Ssam struct condev {
30813632Ssam 	char *CU_meth;		/* method, such as 'ACU' or 'DIR' */
30913632Ssam 	char *CU_brand;		/* brand, such as 'Hayes' or 'Vadic' */
31013632Ssam 	int (*CU_gen)();	/* what to call to search for brands */
31113632Ssam 	int (*CU_open)();	/* what to call to open brand */
31213632Ssam 	int (*CU_clos)();	/* what to call to close brand */
31313632Ssam };
31413632Ssam 
31513632Ssam 	/* This structure tells about a device */
31613632Ssam struct Devices {
31717842Sralph #define	D_type		D_arg[0]
31817842Sralph #define	D_line		D_arg[1]
31917842Sralph #define	D_calldev	D_arg[2]
32017842Sralph #define	D_class		D_arg[3]
32117842Sralph #define	D_brand		D_arg[4]
32217842Sralph #define	D_CHAT		5
32317842Sralph 	int  D_numargs;
32417842Sralph 	int  D_speed;
32517842Sralph 	char *D_arg[20];
32617842Sralph 	char D_argbfr[100];
32713632Ssam };
32813632Ssam 
32913632Ssam 	/*  system status stuff  */
33013632Ssam #define SS_OK		0
33113632Ssam #define SS_NODEVICE	1
33213632Ssam #define SS_CALLBACK	2
33313632Ssam #define SS_INPROGRESS	3
33423681Sbloom #define SS_FAIL		4
33513632Ssam #define SS_BADSEQ	5
33617842Sralph #define SS_WRONGTIME	6
33713632Ssam 
33813632Ssam 	/*  fail/retry parameters  */
33923681Sbloom #define RETRYTIME	600
34023681Sbloom #define MAXRECALLS	25
34113632Ssam 
34213632Ssam 	/*  stuff for command execution  */
34313632Ssam #define X_RQDFILE	'F'
34413632Ssam #define X_STDIN		'I'
34513632Ssam #define X_STDOUT	'O'
34613632Ssam #define X_CMD		'C'
34713632Ssam #define X_USER		'U'
34813632Ssam #define X_SENDFILE	'S'
34913632Ssam #define	X_NONOTI	'N'
35017842Sralph #define X_RETURNTO	'R'
35113632Ssam #define	X_NONZERO	'Z'
35225269Sbloom #define X_LOCK		"XQT"
35323681Sbloom #define X_LOCKTIME	3600L
35413632Ssam 
35523681Sbloom #define WKDSIZE		100	/*  size of work dir name  */
35613632Ssam 
35718624Sralph #include <sys/types.h>
35818624Sralph #ifndef USG
35918624Sralph #include <sys/timeb.h>
36060033Storek #else
36118624Sralph struct timeb
36218624Sralph {
36318624Sralph 	time_t	time;
36418624Sralph 	unsigned short millitm;
36518624Sralph 	short	timezone;
36618624Sralph 	short	dstflag;
36718624Sralph };
36823681Sbloom #define rindex strrchr
36923681Sbloom #define index strchr
37060033Storek #endif
37118624Sralph 
37233960Srick #ifdef BSD4_2
37333960Srick #include <syslog.h>
37433960Srick #endif /* BSD4_2 */
37533960Srick 
37618624Sralph extern struct timeb Now;
37718624Sralph 
37813632Ssam extern int Ifn, Ofn;
37918624Sralph extern char *Rmtname;
38013632Ssam extern char User[];
38113632Ssam extern char Loginuser[];
38213632Ssam extern char *Spool;
38313632Ssam extern char Myname[];
38417842Sralph extern char Myfullname[];
38513632Ssam extern int Debug;
38613632Ssam extern int Bspeed;
38713632Ssam extern char Wrkdir[];
38823681Sbloom extern time_t Retrytime;
38917842Sralph extern short Usrf;
39017842Sralph extern int IsTcpIp;
39113632Ssam extern char Progname[];
39213632Ssam extern int (*CU_end)();
39313632Ssam extern struct condev condevs[];
39417842Sralph extern char NOLOGIN[];
39513632Ssam 
39617842Sralph extern	char DLocal[], DLocalX[], *subfile(), *subdir();
39713632Ssam 
39813632Ssam /* Commonly called routines which return non-int value */
39913632Ssam extern	char *ttyname(), *strcpy(), *strcat(), *index(), *rindex(),
40017842Sralph 		*fgets(), *calloc(), *malloc(), *fdig(), *ttyname(),
40123681Sbloom 		*cfgets(), *getwd(), *strpbrk(), *strncpy();
40260423Sbostic extern	off_t lseek();
40323681Sbloom extern time_t time();
40417842Sralph 
40517842Sralph extern char _FAILED[], CANTOPEN[], DEVNULL[];
40623681Sbloom 
40723681Sbloom #ifdef lint
40823681Sbloom /* This horrible gross kludge is the only way I know to
40923681Sbloom  * convince lint that signal(SIGINT,SIG_IGN) is legal. It hates SIG_IGN.
41023681Sbloom  */
41123681Sbloom #undef SIG_IGN
41223681Sbloom #define SIG_IGN	main
41323681Sbloom extern int main();
41423681Sbloom #undef DEBUG
41523681Sbloom #define DEBUG(a,b,c)
41623681Sbloom #endif /* lint */
417