xref: /csrg-svn/usr.bin/uucp/includes/uucp.h (revision 18624)
1*18624Sralph /*	uucp.h	5.6	85/04/10	*/
213632Ssam 
3*18624Sralph #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  */
3713632Ssam #define	GETHOSTNAME
3817842Sralph /*#define CCWHOAMI	*/
3913632Ssam /* If the above fails ... */
4013632Ssam #define	MYNAME	"erewhon"
4113632Ssam 
4213632Ssam /*
4313632Ssam  * If you have it, include <sysexits.h> to use exit
4413632Ssam  * codes that will be understood by sendmail.
4513632Ssam  * Otherwise, define EX_NOHOST, EX_CANTCREAT, and EX_NOINPUT.
4613632Ssam  */
4713632Ssam #include <sysexits.h>
4817842Sralph /*#define EX_NOINPUT	66*/
4917842Sralph /*#define EX_NOHOST	68*/
5017842Sralph /*#define EX_CANTCREAT	73*/
5113632Ssam 
5213632Ssam /*
5313632Ssam  * Define the various kinds of connections to include.
5413632Ssam  * The complete list is in the condevs array in condevs.c
5513632Ssam  */
5617872Sralph #define DN11		/* standard dialer */
5717842Sralph /*#define DATAKIT	/* ATT's datakit */
5813632Ssam /*#define PNET		/* Purdue network */
5917872Sralph #define DF02		/* Dec's DF02/DF03 */
60*18624Sralph #define DF112		/* Dec's DF112 */
6117872Sralph #define HAYES		/* Hayes' Smartmodem */
6217872Sralph #define VENTEL		/* ventel dialer */
63*18624Sralph #define PENRIL		/* PENRIL Dialer */
6417872Sralph #define VADIC		/* Racal-Vadic 345x */
6517872Sralph #define VA212		/* Racal-Vadic 212 */
6617872Sralph #define VA811S		/* Racal-Vadic 811S dialer, 831 adaptor */
6717842Sralph #define VA820		/* Racal-Vadic 820 dialer, 831 adaptor */
6817872Sralph #define RVMACS		/* Racal-Vadic MACS  820 dialer, 831 adaptor */
6917872Sralph #define VMACS		/* Racal-Vadic MACS  811 dialer, 831 adaptor */
7017842Sralph /*#define UNETTCP	/* 3Com's UNET */
7117842Sralph #define BSDTCP		/* 4.2bsd TCP/IP */
7217842Sralph #define PAD		/* X.25 PAD */
7313632Ssam /*#define MICOM		/* micom mux port */
7417872Sralph #define NOVATION	/* Novation modem */
7513632Ssam 
7617842Sralph #if defined(UNETTCP) || defined(BSDTCP)
7717842Sralph #define TCPIP
7817842Sralph #endif
7917842Sralph 
80*18624Sralph #if defined(VENTEL) || defined(NOVATION) || defined(DF112) || defined(PENRIL)
8113632Ssam /*
8213632Ssam  * We need a timer to write slowly to ventels.
8313632Ssam  * define INTERVALTIMER to use 4.2 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  */
8913632Ssam #define	FTIME
90*18624Sralph #endif VENTEL || NOVATION || DF112 || PENRIL
9113632Ssam 
9213632Ssam /*
9313632Ssam  * If your site is using "ndir.h" to retrofit the Berkeley
9413632Ssam  * directory reading routines, define NDIR.
9513632Ssam  * You will probably also have to set LIBNDIR in Makefile.
9613632Ssam  * Otherwise, <dir.h> is assumed to have the Berkeley directory definitions.
9713632Ssam  */
9817842Sralph /*#define	NDIR	*/
9913632Ssam 
10013632Ssam /*
10117842Sralph  * If yours is a BTL system III, IV, or so-on site, define USG.
10213632Ssam  */
10317842Sralph /*#define	USG	*/
10413632Ssam 
10517842Sralph /*
10617842Sralph  * If you are running 4.2bsd, define BSD4_2
10717842Sralph  */
10817842Sralph #define BSD4_2
10917842Sralph 
11017842Sralph /*
11117842Sralph  * If you are using /etc/inetd with 4.2bsd, define BSDINETD
11217842Sralph  */
11317842Sralph #define BSDINETD
11417842Sralph 
11517842Sralph /*#define VMSDTR	/* Turn on modem control on vms(works DTR) for
11617842Sralph 			   develcon and gandalf ports to gain access */
117*18624Sralph /*
118*18624Sralph  *	If you want to use the same modem for dialing in and out define
119*18624Sralph  *	DIALINOUT to be the localtion of the acucntrl program
120*18624Sralph  */
121*18624Sralph /* #define DIALINOUT	"/usr/lib/uucp/acucntrl" */
12217842Sralph 
12313632Ssam /* define the last characters for ACU */
12413632Ssam #define ACULAST "-<"
12513632Ssam 
12613632Ssam /* define the value of WFMASK - for umask call - used for all uucp work files */
12713632Ssam #define WFMASK 0137
12813632Ssam 
12917842Sralph /* define UUSTAT if you need "uustat" command */
13017842Sralph /* #define UUSTAT	*/
13117842Sralph 
13217842Sralph /*	define UUSUB if you need "uusub" command */
13317842Sralph /* #define UUSUB /**/
13417842Sralph 
13513632Ssam /* define the value of LOGMASK - for LOGFILE, SYSLOG, ERRLOG */
13613632Ssam #define	LOGMASK	0133
13713632Ssam 
13813632Ssam /* All files are given at least the following at the final destination */
13913632Ssam /* It is also the default mode, so '666' is recommended */
14013632Ssam /* and 444 is minimal (minimally useful, maximally annoying) */
14113632Ssam #define	BASEMODE	0666
14213632Ssam 
14317842Sralph /*
14417842Sralph  * Define NOSTRANGERS if you don't want to accept transactions from
14517842Sralph  * sites that are not in your L.sys file (see cico.c)
14617842Sralph  */
14717842Sralph #define NOSTRANGERS
14817842Sralph /*
14917842Sralph  * Traditionally LCK (lock) files have been kept in /usr/spool/uucp.
15017842Sralph  * If you want that define LOCKDIR to be ".".
15117842Sralph  * If you want the locks kept in a subdirectory, define LOCKDIR as "LCK.".
15217842Sralph  * Good news about LCK. subdirectory: the directory can be mode 777 so
15317842Sralph  * unprivileged programs can share the uucp locking system,
15417842Sralph  * and the subdirectory keeps down clutter in the main directory.
15517842Sralph  * The BAD news: you have to change 'tip' and another programs that
15617842Sralph  * know where the LCK files are kept, and you have to change your /etc/rc
15717842Sralph  * if your rc cleans out the lock files (as it should).
15817842Sralph  */
159*18624Sralph /*#define	LOCKDIR	"LCK" */
16017842Sralph #define	LOCKDIR	"."
16113632Ssam 
16217842Sralph /*
16317842Sralph  * If you want uucp and uux to copy the data files by default,
16417842Sralph  * don't define DONTCOPY (This is the way older 4bsd uucps worked)
16517842Sralph  * If you want uucp and uux to use the original files instead of
16617842Sralph  * copies, define DONTCOPY (This is the way System III and V work)
16717842Sralph  */
16817842Sralph #define DONTCOPY
16917842Sralph 
17017842Sralph /*
171*18624Sralph  * Very few (that I know of) systems use the sequence checking feature.
17217842Sralph  * If you are not going to use it (hint: you are not),
17317842Sralph  * do not define GNXSEQ.  This saves precious room on PDP11s.
17417842Sralph  */
17517842Sralph /*#define	GNXSEQ/* comment this out to save space */
17617842Sralph 
177*18624Sralph /*
178*18624Sralph  * If you want the logfile stored in a file for each site instead
179*18624Sralph  * of one file
180*18624Sralph  * define LOGBYSITE as the directory to put the files in
181*18624Sralph  */
182*18624Sralph /*#define LOGBYSITE	"/usr/spool/uucp/LOG"	*/
183*18624Sralph 
18413632Ssam #define XQTDIR		"/usr/spool/uucp/XTMP"
18513632Ssam #define SQFILE		"/usr/lib/uucp/SQFILE"
18613632Ssam #define SQTMP		"/usr/lib/uucp/SQTMP"
18713632Ssam #define SLCKTIME	5400	/* system/device timeout (LCK.. files) */
18813632Ssam #define SEQFILE		"/usr/lib/uucp/SEQF"
18913632Ssam #define SYSFILE		"/usr/lib/uucp/L.sys"
19013632Ssam #define DEVFILE		"/usr/lib/uucp/L-devices"
19113632Ssam #define DIALFILE	"/usr/lib/uucp/L-dialcodes"
19213632Ssam #define USERFILE	"/usr/lib/uucp/USERFILE"
19313632Ssam #define	CMDFILE		"/usr/lib/uucp/L.cmds"
194*18624Sralph #define	ALIASFILE	"/usr/lib/uucp/L.aliases"
19513632Ssam 
19613632Ssam #define SPOOL		"/usr/spool/uucp"
19717842Sralph #define SQLOCK		"LCK.SQ"
19813632Ssam #define SYSLOG		"/usr/spool/uucp/SYSLOG"
19913632Ssam #define PUBDIR		"/usr/spool/uucppublic"
20013632Ssam 
20113632Ssam #define SEQLOCK		"LCK.SEQL"
20213632Ssam #define CMDPRE		'C'
20313632Ssam #define DATAPRE		'D'
20413632Ssam #define XQTPRE		'X'
20513632Ssam 
20613632Ssam #define LOGFILE	"/usr/spool/uucp/LOGFILE"
20713632Ssam #define ERRLOG	"/usr/spool/uucp/ERRLOG"
20817842Sralph #define CMDSDIR	"/usr/spool/uucp/C."
20917842Sralph #define DATADIR	"/usr/spool/uucp/D."
21017842Sralph #define XEQTDIR	"/usr/spool/uucp/X."
21113632Ssam 
21213632Ssam #define RMTDEBUG	"AUDIT"
21317842Sralph #define CORRUPT		"CORRUPT"
21413632Ssam #define SQTIME		60
21513632Ssam #define TRYCALLS	2	/* number of tries to dial call */
21613632Ssam 
21717842Sralph #define LLEN	50
21817842Sralph #define MAXRQST	250
21917842Sralph 
22013632Ssam #define DEBUG(l, f, s) if (Debug >= l) fprintf(stderr, f, s); else
22113632Ssam 
22217842Sralph #define ASSERT(e, s1, s2, i1) if (!(e)) {assert(s1, s2, i1);cleanup(FAIL);}else
22313632Ssam 
22413632Ssam #define SAME 0
22517842Sralph #define ANYREAD 0004
22613632Ssam #define ANYWRITE 02
22713632Ssam #define FAIL -1
22813632Ssam #define SUCCESS 0
22913632Ssam #define CNULL (char *) 0
23013632Ssam #define STBNULL (struct sgttyb *) 0
23113632Ssam #define MASTER 1
23213632Ssam #define SLAVE 0
23317842Sralph #define MAXFULLNAME 255
23413632Ssam #define MAXMSGTIME 45
23517842Sralph #define NAMESIZE 255
23613632Ssam #define EOTMSG "\04\n\04\n"
23713632Ssam #define CALLBACK 1
23817842Sralph #define ONEDAY	86400L
23913632Ssam 
24013632Ssam 	/*  commands  */
24113632Ssam #define SHELL		"/bin/sh"
24217842Sralph #define MAIL		"/usr/lib/sendmail"
24313632Ssam #define UUCICO		"/usr/lib/uucp/uucico"
24413632Ssam #define UUXQT		"/usr/lib/uucp/uuxqt"
24513632Ssam #define UUCP		"uucp"
24613632Ssam 
24713632Ssam 	/*  call connect fail stuff  */
24813632Ssam #define CF_SYSTEM	-1
24913632Ssam #define CF_TIME		-2
25013632Ssam #define CF_LOCK		-3
25113632Ssam #define	CF_NODEV	-4
25213632Ssam #define CF_DIAL		-5
25313632Ssam #define CF_LOGIN	-6
25413632Ssam 
25513632Ssam #define F_NAME 0
25613632Ssam #define F_TIME 1
25713632Ssam #define F_LINE 2
25813632Ssam #define F_CLASS 3	/* an optional prefix and the speed */
25913632Ssam #define F_PHONE 4
26013632Ssam #define F_LOGIN 5
26113632Ssam 
26213632Ssam #define MAXPH	60	/* maximum length of a phone number */
26313632Ssam 
26413632Ssam 	/* This structure tells how to get to a device */
26513632Ssam struct condev {
26613632Ssam 	char *CU_meth;		/* method, such as 'ACU' or 'DIR' */
26713632Ssam 	char *CU_brand;		/* brand, such as 'Hayes' or 'Vadic' */
26813632Ssam 	int (*CU_gen)();	/* what to call to search for brands */
26913632Ssam 	int (*CU_open)();	/* what to call to open brand */
27013632Ssam 	int (*CU_clos)();	/* what to call to close brand */
27113632Ssam };
27213632Ssam 
27313632Ssam 	/* This structure tells about a device */
27413632Ssam struct Devices {
27517842Sralph #define	D_type		D_arg[0]
27617842Sralph #define	D_line		D_arg[1]
27717842Sralph #define	D_calldev	D_arg[2]
27817842Sralph #define	D_class		D_arg[3]
27917842Sralph #define	D_brand		D_arg[4]
28017842Sralph #define	D_CHAT		5
28117842Sralph 	int  D_numargs;
28217842Sralph 	int  D_speed;
28317842Sralph 	char *D_arg[20];
28417842Sralph 	char D_argbfr[100];
28513632Ssam };
28613632Ssam 
28713632Ssam 	/*  system status stuff  */
28813632Ssam #define SS_OK		0
28913632Ssam #define SS_FAIL		4
29013632Ssam #define SS_NODEVICE	1
29113632Ssam #define SS_CALLBACK	2
29213632Ssam #define SS_INPROGRESS	3
29313632Ssam #define SS_BADSEQ	5
29417842Sralph #define SS_WRONGTIME	6
29513632Ssam 
29613632Ssam 	/*  fail/retry parameters  */
29717842Sralph #define RETRYTIME 600
29813632Ssam #define MAXRECALLS 20
29913632Ssam 
30013632Ssam 	/*  stuff for command execution  */
30113632Ssam #define X_RQDFILE	'F'
30213632Ssam #define X_STDIN		'I'
30313632Ssam #define X_STDOUT	'O'
30413632Ssam #define X_CMD		'C'
30513632Ssam #define X_USER		'U'
30613632Ssam #define X_SENDFILE	'S'
30713632Ssam #define	X_NONOTI	'N'
30817842Sralph #define X_RETURNTO	'R'
30913632Ssam #define	X_NONZERO	'Z'
31013632Ssam #define X_LOCK		"LCK.XQT"
31113632Ssam #define X_LOCKTIME	3600
31213632Ssam 
31313632Ssam #define WKDSIZE 100	/*  size of work dir name  */
31413632Ssam 
315*18624Sralph #include <sys/types.h>
316*18624Sralph #ifndef USG
317*18624Sralph #include <sys/timeb.h>
318*18624Sralph #else USG
319*18624Sralph struct timeb
320*18624Sralph {
321*18624Sralph 	time_t	time;
322*18624Sralph 	unsigned short millitm;
323*18624Sralph 	short	timezone;
324*18624Sralph 	short	dstflag;
325*18624Sralph };
326*18624Sralph #endif USG
327*18624Sralph 
328*18624Sralph extern struct timeb Now;
329*18624Sralph 
33013632Ssam extern int Ifn, Ofn;
331*18624Sralph extern char *Rmtname;
33213632Ssam extern char User[];
33313632Ssam extern char Loginuser[];
33413632Ssam extern char *Spool;
33513632Ssam extern char Myname[];
33617842Sralph extern char Myfullname[];
33713632Ssam extern int Debug;
33813632Ssam extern int Bspeed;
33913632Ssam extern char Wrkdir[];
34013632Ssam extern long Retrytime;
34117842Sralph extern short Usrf;
34217842Sralph extern int IsTcpIp;
34313632Ssam extern char Progname[];
34413632Ssam extern int (*CU_end)();
34513632Ssam extern struct condev condevs[];
34617842Sralph extern int nologinflag;
34717842Sralph extern char NOLOGIN[];
34813632Ssam 
34917842Sralph extern	char DLocal[], DLocalX[], *subfile(), *subdir();
35013632Ssam 
35113632Ssam /* Commonly called routines which return non-int value */
35213632Ssam extern	char *ttyname(), *strcpy(), *strcat(), *index(), *rindex(),
35317842Sralph 		*fgets(), *calloc(), *malloc(), *fdig(), *ttyname(),
35413632Ssam 		*cfgets();
35513632Ssam extern	long lseek();
35613992Sgray extern	FILE *rpopen();
35717842Sralph 
35817842Sralph extern char _FAILED[], CANTOPEN[], DEVNULL[];
359