xref: /csrg-svn/usr.bin/uucp/includes/uucp.h (revision 33960)
1*33960Srick /*	@(#)uucp.h	5.13	04/05/88	*/
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  */
60*33960Srick /* #define ATT2224		/* AT&T 2224 */
6125269Sbloom #define BSDTCP		/* 4.2bsd or 2.9bsd TCP/IP */
62*33960Srick /* #define CDS224		/* Concord Data Systems 2400 */
6325269Sbloom /* #define DATAKIT	/* ATT's datakit */
64*33960Srick /* #define DF02		/* Dec's DF02/DF03 */
65*33960Srick /* #define DF112		/* Dec's DF112 */
66*33960Srick /* #define DN11		/* "standard" DEC dialer */
6717872Sralph #define HAYES		/* Hayes' Smartmodem */
68*33960Srick /* #define HAYES2400	/* Hayes' 2400 baud Smartmodem */
6925269Sbloom /* #define MICOM	/* Micom Mux port */
70*33960Srick /* #define NOVATION	/* Novation modem */
71*33960Srick /* #define PAD		/* X.25 PAD */
72*33960Srick /* #define PENRIL		/* PENRIL Dialer */
7325269Sbloom /* #define PNET		/* Purdue network */
74*33960Srick /* #define RVMACS		/* Racal-Vadic MACS  820 dialer, 831 adaptor */
7525269Sbloom /* #define SYTEK	/* Sytek Local Area Net */
7625269Sbloom /* #define UNETTCP	/* 3Com's UNET */
7726152Sbloom #define USR2400		/* USRobotics Courier 2400 */
78*33960Srick /* #define VA212		/* Racal-Vadic 212 */
79*33960Srick /* #define VA811S		/* Racal-Vadic 811S dialer, 831 adaptor */
80*33960Srick /* #define VA820		/* Racal-Vadic 820 dialer, 831 adaptor */
81*33960Srick /* #define VADIC		/* Racal-Vadic 345x */
82*33960Srick /* #define VENTEL		/* Ventel Dialer */
83*33960Srick /* #define VMACS		/* Racal-Vadic MACS  811 dialer, 831 adaptor */
8413632Ssam 
8526152Sbloom #if defined(USR2400) && !defined(HAYES)
8626152Sbloom #define HAYES
8726152Sbloom #endif USR2400 && !HAYES
8826152Sbloom 
8917842Sralph #if defined(UNETTCP) || defined(BSDTCP)
9017842Sralph #define TCPIP
9117842Sralph #endif
9217842Sralph 
9313632Ssam /*
9425707Sbloom  * We need a timer to write slowly to certain modems.
9525707Sbloom  * and for generating breaks.
9625707Sbloom  *
9723728Sbloom  * define INTERVALTIMER to use 4.[23] bsd interval timer.
9813632Ssam  * define FASTTIMER if you have the nap() system call.
9913632Ssam  * define FTIME if you have the ftime() system call.
10013632Ssam  * define BUSYLOOP if you must do a busy loop.
10113632Ssam  * Look at uucpdelay() in condevs.c for details.
10213632Ssam  */
10323681Sbloom #define	INTERVALTIMER
10425269Sbloom /*#define FASTTIMER /**/
10525269Sbloom /*#define FTIME /**/
10625269Sbloom /*#define BUSYLOOP /**/
10713632Ssam 
10813632Ssam /*
10913632Ssam  * If your site is using "ndir.h" to retrofit the Berkeley
11013632Ssam  * directory reading routines, define NDIR.
11113632Ssam  * You will probably also have to set LIBNDIR in Makefile.
11213632Ssam  * Otherwise, <dir.h> is assumed to have the Berkeley directory definitions.
11313632Ssam  */
11423681Sbloom /*#define	NDIR	/**/
11513632Ssam 
11613632Ssam /*
11723681Sbloom  * If yours is a BTL system III, IV, V or so-on site, define USG.
11813632Ssam  */
11923681Sbloom /*#define	USG	/**/
12013632Ssam 
12117842Sralph /*
12223728Sbloom  * If you are running 4.3bsd, define BSD4_3 and BSD4_2
12323728Sbloom  * If you are just running 4.2bsd, define BSD4_2
12426152Sbloom  * If you are running the BRL version of 4.2BSD define BRL4_2, NOT BSD4_3
12517842Sralph  */
12623728Sbloom #define BSD4_3 	/**/
12723681Sbloom #define BSD4_2 	/**/
12826152Sbloom /*#define BRL4_2 /**/
12917842Sralph 
13026152Sbloom #if defined(BRL4_2) && !defined(BSD4_2)
13126152Sbloom #define BSD4_2
13226152Sbloom #undef BSD4_3
13326152Sbloom #endif BRL4_2
13426152Sbloom 
13517842Sralph /*
13617842Sralph  * If you are using /etc/inetd with 4.2bsd, define BSDINETD
13717842Sralph  */
13823681Sbloom #define BSDINETD	/**/
13917842Sralph 
14023728Sbloom /*
14126152Sbloom  * If you are running 4.3bsd or BRL 4.2, you are running the inetd
14223728Sbloom  */
14323728Sbloom 
14426152Sbloom #if (defined(BSD4_3) || defined(BRL4_2)) && !defined(BSDINETD)
14523728Sbloom #define BSDINETD
14626152Sbloom #endif (BSD4_3 ||BRL4_2) && !BSDINETD
14723728Sbloom 
14817842Sralph /*#define VMSDTR	/* Turn on modem control on vms(works DTR) for
14917842Sralph 			   develcon and gandalf ports to gain access */
15018624Sralph /*
15118624Sralph  *	If you want to use the same modem for dialing in and out define
15218624Sralph  *	DIALINOUT to be the localtion of the acucntrl program
15318624Sralph  */
154*33960Srick #define DIALINOUT	"/usr/lib/uucp/acucntrl" /**/
15517842Sralph 
15623681Sbloom /*
15723681Sbloom  *	If you want all ACU lines to be DIALINOUT, define ALLACUINOUT
15823681Sbloom  */
159*33960Srick #define ALLACUINOUT	/**/
16013632Ssam 
16113632Ssam /* define the value of WFMASK - for umask call - used for all uucp work files */
16213632Ssam #define WFMASK 0137
16313632Ssam 
16413632Ssam /* define the value of LOGMASK - for LOGFILE, SYSLOG, ERRLOG */
16523681Sbloom #define	LOGMASK		0133
16613632Ssam 
16713632Ssam /* All files are given at least the following at the final destination */
16813632Ssam /* It is also the default mode, so '666' is recommended */
16913632Ssam /* and 444 is minimal (minimally useful, maximally annoying) */
17013632Ssam #define	BASEMODE	0666
17113632Ssam 
17217842Sralph /*
17317842Sralph  * Define NOSTRANGERS if you don't want to accept transactions from
17417842Sralph  * sites that are not in your L.sys file (see cico.c)
17517842Sralph  */
17623681Sbloom #define NOSTRANGERS	/**/
17726152Sbloom 
17817842Sralph /*
17917842Sralph  * Traditionally LCK (lock) files have been kept in /usr/spool/uucp.
18017842Sralph  * If you want that define LOCKDIR to be ".".
18125269Sbloom  * If you want the locks kept in a subdirectory, define LOCKDIR as "LCK".
18217842Sralph  * Good news about LCK. subdirectory: the directory can be mode 777 so
18317842Sralph  * unprivileged programs can share the uucp locking system,
18417842Sralph  * and the subdirectory keeps down clutter in the main directory.
18517842Sralph  * The BAD news: you have to change 'tip' and another programs that
18617842Sralph  * know where the LCK files are kept, and you have to change your /etc/rc
18717842Sralph  * if your rc cleans out the lock files (as it should).
18817842Sralph  */
189*33960Srick #define	LOCKDIR	"LCK"	/**/
190*33960Srick /* #define LOCKDIR	"." /**/
19113632Ssam 
19225269Sbloom /*
19317842Sralph  * If you want uucp and uux to copy the data files by default,
19417842Sralph  * don't define DONTCOPY (This is the way older 4bsd uucps worked)
19517842Sralph  * If you want uucp and uux to use the original files instead of
19617842Sralph  * copies, define DONTCOPY (This is the way System III and V work)
19717842Sralph  */
19823681Sbloom #define DONTCOPY	/**/
19917842Sralph 
20017842Sralph /*
20118624Sralph  * Very few (that I know of) systems use the sequence checking feature.
20217842Sralph  * If you are not going to use it (hint: you are not),
20317842Sralph  * do not define GNXSEQ.  This saves precious room on PDP11s.
20417842Sralph  */
20523681Sbloom /*#define	GNXSEQ	/* comment this out to save space */
20617842Sralph 
20718624Sralph /*
20818624Sralph  * If you want the logfile stored in a file for each site instead
20918624Sralph  * of one file
21018624Sralph  * define LOGBYSITE as the directory to put the files in
21118624Sralph  */
212*33960Srick #define LOGBYSITE	"/usr/spool/uucp/LOG" /**/
21318624Sralph 
21433587Srick /*
215*33960Srick  * define USE_SYSLOG if you want error messages to use SYSLOG instead
216*33960Srick  * of being written to /usr/spool/log/ERRLOG
217*33960Srick  */
218*33960Srick #define USE_SYSLOG	/**/
219*33960Srick 
220*33960Srick /*
22133587Srick  * If you are doing rebilling and need connect accounting,
222*33960Srick  * define DO_CONNECT_ACCOUNTING to be the accounting file name
22333587Srick  */
224*33960Srick /*#define DO_CONNECT_ACCOUNTING	"/usr/spool/uucp/CONNECT"	/**/
22533587Srick 
22613632Ssam #define XQTDIR		"/usr/spool/uucp/XTMP"
22713632Ssam #define SQFILE		"/usr/lib/uucp/SQFILE"
22813632Ssam #define SQTMP		"/usr/lib/uucp/SQTMP"
22913632Ssam #define SLCKTIME	5400	/* system/device timeout (LCK.. files) */
23013632Ssam #define SEQFILE		"/usr/lib/uucp/SEQF"
23113632Ssam #define SYSFILE		"/usr/lib/uucp/L.sys"
23213632Ssam #define DEVFILE		"/usr/lib/uucp/L-devices"
23313632Ssam #define DIALFILE	"/usr/lib/uucp/L-dialcodes"
23413632Ssam #define USERFILE	"/usr/lib/uucp/USERFILE"
23513632Ssam #define	CMDFILE		"/usr/lib/uucp/L.cmds"
23618624Sralph #define	ALIASFILE	"/usr/lib/uucp/L.aliases"
23713632Ssam 
23813632Ssam #define SPOOL		"/usr/spool/uucp"
23913632Ssam #define SYSLOG		"/usr/spool/uucp/SYSLOG"
24013632Ssam #define PUBDIR		"/usr/spool/uucppublic"
24113632Ssam 
24226152Sbloom #define SQLOCK		"SQ"
24325269Sbloom #define SEQLOCK		"SEQL"
24413632Ssam #define CMDPRE		'C'
24513632Ssam #define DATAPRE		'D'
24613632Ssam #define XQTPRE		'X'
24713632Ssam 
24823681Sbloom #define LOGFILE		"/usr/spool/uucp/LOGFILE"
24923681Sbloom #define ERRLOG		"/usr/spool/uucp/ERRLOG"
25023681Sbloom #define CMDSDIR		"/usr/spool/uucp/C."
25123681Sbloom #define DATADIR		"/usr/spool/uucp/D."
25223681Sbloom #define XEQTDIR		"/usr/spool/uucp/X."
25313632Ssam 
25413632Ssam #define RMTDEBUG	"AUDIT"
25517842Sralph #define CORRUPT		"CORRUPT"
25613632Ssam #define SQTIME		60
25713632Ssam #define TRYCALLS	2	/* number of tries to dial call */
25813632Ssam 
25933587Srick #define LLEN	150
26017842Sralph #define MAXRQST	250
26117842Sralph 
26213632Ssam #define DEBUG(l, f, s) if (Debug >= l) fprintf(stderr, f, s); else
26313632Ssam 
26425269Sbloom #define delock(dev)	rmlock(dev)
26525269Sbloom #define mlock(dev)	ulockf(dev, SLCKTIME)
26625269Sbloom 
26723681Sbloom #define SAME		0
26823681Sbloom #define ANYREAD		0004
26923681Sbloom #define ANYWRITE	02
27023681Sbloom #define FAIL		-1
27123681Sbloom #define SUCCESS		0
27223681Sbloom #define CNULL		(char *) 0
27323681Sbloom #define STBNULL		(struct sgttyb *) 0
27423681Sbloom #define MASTER		1
27523681Sbloom #define SLAVE		0
27623681Sbloom #define MAXFULLNAME	255
27723681Sbloom #define MAXMSGTIME	45
27823681Sbloom #define NAMESIZE	255
27923681Sbloom #define MAXBASENAME	14
28023681Sbloom #define SYSNSIZE	(MAXBASENAME-1-1-1-4)
28123681Sbloom #define EOTMSG		"\04\n\04\n"
28223681Sbloom #define CALLBACK	1
28323681Sbloom #define ONEDAY		86400L
28413632Ssam 
28513632Ssam 	/*  commands  */
28613632Ssam #define SHELL		"/bin/sh"
28717842Sralph #define MAIL		"/usr/lib/sendmail"
28813632Ssam #define UUCICO		"/usr/lib/uucp/uucico"
28913632Ssam #define UUXQT		"/usr/lib/uucp/uuxqt"
29013632Ssam #define UUCP		"uucp"
29113632Ssam 
29213632Ssam 	/*  call connect fail stuff  */
29313632Ssam #define CF_SYSTEM	-1
29413632Ssam #define CF_TIME		-2
29513632Ssam #define CF_LOCK		-3
29613632Ssam #define	CF_NODEV	-4
29713632Ssam #define CF_DIAL		-5
29813632Ssam #define CF_LOGIN	-6
29913632Ssam 
30023681Sbloom #define F_NAME		0
30123681Sbloom #define F_TIME		1
30223681Sbloom #define F_LINE		2
30323681Sbloom #define F_CLASS		3	/* an optional prefix and the speed */
30423681Sbloom #define F_PHONE		4
30523681Sbloom #define F_LOGIN		5
30613632Ssam 
30723681Sbloom #define MAXPH		60	/* maximum length of a phone number */
30813632Ssam 
30913632Ssam 	/* This structure tells how to get to a device */
31013632Ssam struct condev {
31113632Ssam 	char *CU_meth;		/* method, such as 'ACU' or 'DIR' */
31213632Ssam 	char *CU_brand;		/* brand, such as 'Hayes' or 'Vadic' */
31313632Ssam 	int (*CU_gen)();	/* what to call to search for brands */
31413632Ssam 	int (*CU_open)();	/* what to call to open brand */
31513632Ssam 	int (*CU_clos)();	/* what to call to close brand */
31613632Ssam };
31713632Ssam 
31813632Ssam 	/* This structure tells about a device */
31913632Ssam struct Devices {
32017842Sralph #define	D_type		D_arg[0]
32117842Sralph #define	D_line		D_arg[1]
32217842Sralph #define	D_calldev	D_arg[2]
32317842Sralph #define	D_class		D_arg[3]
32417842Sralph #define	D_brand		D_arg[4]
32517842Sralph #define	D_CHAT		5
32617842Sralph 	int  D_numargs;
32717842Sralph 	int  D_speed;
32817842Sralph 	char *D_arg[20];
32917842Sralph 	char D_argbfr[100];
33013632Ssam };
33113632Ssam 
33213632Ssam 	/*  system status stuff  */
33313632Ssam #define SS_OK		0
33413632Ssam #define SS_NODEVICE	1
33513632Ssam #define SS_CALLBACK	2
33613632Ssam #define SS_INPROGRESS	3
33723681Sbloom #define SS_FAIL		4
33813632Ssam #define SS_BADSEQ	5
33917842Sralph #define SS_WRONGTIME	6
34013632Ssam 
34113632Ssam 	/*  fail/retry parameters  */
34223681Sbloom #define RETRYTIME	600
34323681Sbloom #define MAXRECALLS	25
34413632Ssam 
34513632Ssam 	/*  stuff for command execution  */
34613632Ssam #define X_RQDFILE	'F'
34713632Ssam #define X_STDIN		'I'
34813632Ssam #define X_STDOUT	'O'
34913632Ssam #define X_CMD		'C'
35013632Ssam #define X_USER		'U'
35113632Ssam #define X_SENDFILE	'S'
35213632Ssam #define	X_NONOTI	'N'
35317842Sralph #define X_RETURNTO	'R'
35413632Ssam #define	X_NONZERO	'Z'
35525269Sbloom #define X_LOCK		"XQT"
35623681Sbloom #define X_LOCKTIME	3600L
35713632Ssam 
35823681Sbloom #define WKDSIZE		100	/*  size of work dir name  */
35913632Ssam 
36018624Sralph #include <sys/types.h>
36118624Sralph #ifndef USG
36218624Sralph #include <sys/timeb.h>
36318624Sralph #else USG
36418624Sralph struct timeb
36518624Sralph {
36618624Sralph 	time_t	time;
36718624Sralph 	unsigned short millitm;
36818624Sralph 	short	timezone;
36918624Sralph 	short	dstflag;
37018624Sralph };
37123681Sbloom #define rindex strrchr
37223681Sbloom #define index strchr
37318624Sralph #endif USG
37418624Sralph 
375*33960Srick #ifdef BSD4_2
376*33960Srick #include <syslog.h>
377*33960Srick #endif /* BSD4_2 */
378*33960Srick 
37918624Sralph extern struct timeb Now;
38018624Sralph 
38113632Ssam extern int Ifn, Ofn;
38218624Sralph extern char *Rmtname;
38313632Ssam extern char User[];
38413632Ssam extern char Loginuser[];
38513632Ssam extern char *Spool;
38613632Ssam extern char Myname[];
38717842Sralph extern char Myfullname[];
38813632Ssam extern int Debug;
38913632Ssam extern int Bspeed;
39013632Ssam extern char Wrkdir[];
39123681Sbloom extern time_t Retrytime;
39217842Sralph extern short Usrf;
39317842Sralph extern int IsTcpIp;
39413632Ssam extern char Progname[];
39513632Ssam extern int (*CU_end)();
39613632Ssam extern struct condev condevs[];
39717842Sralph extern char NOLOGIN[];
39813632Ssam 
39917842Sralph extern	char DLocal[], DLocalX[], *subfile(), *subdir();
40013632Ssam 
40113632Ssam /* Commonly called routines which return non-int value */
40213632Ssam extern	char *ttyname(), *strcpy(), *strcat(), *index(), *rindex(),
40317842Sralph 		*fgets(), *calloc(), *malloc(), *fdig(), *ttyname(),
40423681Sbloom 		*cfgets(), *getwd(), *strpbrk(), *strncpy();
40513632Ssam extern	long lseek();
40623681Sbloom extern time_t time();
40717842Sralph 
40817842Sralph extern char _FAILED[], CANTOPEN[], DEVNULL[];
40923681Sbloom 
41023681Sbloom #ifdef lint
41123681Sbloom /* This horrible gross kludge is the only way I know to
41223681Sbloom  * convince lint that signal(SIGINT,SIG_IGN) is legal. It hates SIG_IGN.
41323681Sbloom  */
41423681Sbloom #ifdef SIG_IGN
41523681Sbloom #undef SIG_IGN
41623681Sbloom #endif /* SIG_IGN */
41723681Sbloom #define SIG_IGN	main
41823681Sbloom extern int main();
41923681Sbloom #ifdef DEBUG
42023681Sbloom #undef DEBUG
42123681Sbloom #endif DEBUG
42223681Sbloom #define DEBUG(a,b,c)
42323681Sbloom #endif /* lint */
424