xref: /csrg-svn/usr.bin/uucp/includes/uucp.h (revision 17872)
1*17872Sralph /*	uucp.h	5.5	85/01/28	*/
213632Ssam 
313632Ssam #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  */
56*17872Sralph #define DN11		/* standard dialer */
5717842Sralph /*#define DATAKIT	/* ATT's datakit */
5813632Ssam /*#define PNET		/* Purdue network */
59*17872Sralph #define DF02		/* Dec's DF02/DF03 */
60*17872Sralph #define HAYES		/* Hayes' Smartmodem */
61*17872Sralph #define VENTEL		/* ventel dialer */
62*17872Sralph #define VADIC		/* Racal-Vadic 345x */
63*17872Sralph #define VA212		/* Racal-Vadic 212 */
64*17872Sralph #define VA811S		/* Racal-Vadic 811S dialer, 831 adaptor */
6517842Sralph #define VA820		/* Racal-Vadic 820 dialer, 831 adaptor */
66*17872Sralph #define RVMACS		/* Racal-Vadic MACS  820 dialer, 831 adaptor */
67*17872Sralph #define VMACS		/* Racal-Vadic MACS  811 dialer, 831 adaptor */
6817842Sralph /*#define UNETTCP	/* 3Com's UNET */
6917842Sralph #define BSDTCP		/* 4.2bsd TCP/IP */
7017842Sralph #define PAD		/* X.25 PAD */
7113632Ssam /*#define MICOM		/* micom mux port */
72*17872Sralph #define NOVATION	/* Novation modem */
7313632Ssam 
7417842Sralph #if defined(UNETTCP) || defined(BSDTCP)
7517842Sralph #define TCPIP
7617842Sralph #endif
7717842Sralph 
7813632Ssam #ifdef	VENTEL
7913632Ssam /*
8013632Ssam  * We need a timer to write slowly to ventels.
8113632Ssam  * define INTERVALTIMER to use 4.2 bsd interval timer.
8213632Ssam  * define FASTTIMER if you have the nap() system call.
8313632Ssam  * define FTIME if you have the ftime() system call.
8413632Ssam  * define BUSYLOOP if you must do a busy loop.
8513632Ssam  * Look at uucpdelay() in condevs.c for details.
8613632Ssam  */
8713632Ssam #define	FTIME
8813632Ssam #endif
8913632Ssam 
9013632Ssam /*
9113632Ssam  * If your site is using "ndir.h" to retrofit the Berkeley
9213632Ssam  * directory reading routines, define NDIR.
9313632Ssam  * You will probably also have to set LIBNDIR in Makefile.
9413632Ssam  * Otherwise, <dir.h> is assumed to have the Berkeley directory definitions.
9513632Ssam  */
9617842Sralph /*#define	NDIR	*/
9713632Ssam 
9813632Ssam /*
9917842Sralph  * If yours is a BTL system III, IV, or so-on site, define USG.
10013632Ssam  */
10117842Sralph /*#define	USG	*/
10213632Ssam 
10317842Sralph /*
10417842Sralph  * If you are running 4.2bsd, define BSD4_2
10517842Sralph  */
10617842Sralph #define BSD4_2
10717842Sralph 
10817842Sralph /*
10917842Sralph  * If you are using /etc/inetd with 4.2bsd, define BSDINETD
11017842Sralph  */
11117842Sralph #define BSDINETD
11217842Sralph 
11317842Sralph /*#define VMSDTR	/* Turn on modem control on vms(works DTR) for
11417842Sralph 			   develcon and gandalf ports to gain access */
11517842Sralph 
11613632Ssam /* define the last characters for ACU */
11713632Ssam #define ACULAST "-<"
11813632Ssam 
11913632Ssam /* define the value of WFMASK - for umask call - used for all uucp work files */
12013632Ssam #define WFMASK 0137
12113632Ssam 
12217842Sralph /* define UUSTAT if you need "uustat" command */
12317842Sralph /* #define UUSTAT	*/
12417842Sralph 
12517842Sralph /*	define UUSUB if you need "uusub" command */
12617842Sralph /* #define UUSUB /**/
12717842Sralph 
12813632Ssam /* define the value of LOGMASK - for LOGFILE, SYSLOG, ERRLOG */
12913632Ssam #define	LOGMASK	0133
13013632Ssam 
13113632Ssam /* All files are given at least the following at the final destination */
13213632Ssam /* It is also the default mode, so '666' is recommended */
13313632Ssam /* and 444 is minimal (minimally useful, maximally annoying) */
13413632Ssam #define	BASEMODE	0666
13513632Ssam 
13617842Sralph /*
13717842Sralph  * Define NOSTRANGERS if you don't want to accept transactions from
13817842Sralph  * sites that are not in your L.sys file (see cico.c)
13917842Sralph  */
14017842Sralph #define NOSTRANGERS
14117842Sralph /*
14217842Sralph  * Traditionally LCK (lock) files have been kept in /usr/spool/uucp.
14317842Sralph  * If you want that define LOCKDIR to be ".".
14417842Sralph  * If you want the locks kept in a subdirectory, define LOCKDIR as "LCK.".
14517842Sralph  * Good news about LCK. subdirectory: the directory can be mode 777 so
14617842Sralph  * unprivileged programs can share the uucp locking system,
14717842Sralph  * and the subdirectory keeps down clutter in the main directory.
14817842Sralph  * The BAD news: you have to change 'tip' and another programs that
14917842Sralph  * know where the LCK files are kept, and you have to change your /etc/rc
15017842Sralph  * if your rc cleans out the lock files (as it should).
15117842Sralph  */
15217842Sralph /*#define	LOCKDIR	"LCK." */
15317842Sralph #define	LOCKDIR	"."
15413632Ssam 
15517842Sralph /*
15617842Sralph  * If you want uucp and uux to copy the data files by default,
15717842Sralph  * don't define DONTCOPY (This is the way older 4bsd uucps worked)
15817842Sralph  * If you want uucp and uux to use the original files instead of
15917842Sralph  * copies, define DONTCOPY (This is the way System III and V work)
16017842Sralph  */
16117842Sralph #define DONTCOPY
16217842Sralph 
16317842Sralph /*
16417842Sralph  * Very few (none I know of) systems use the sequence checking feature.
16517842Sralph  * If you are not going to use it (hint: you are not),
16617842Sralph  * do not define GNXSEQ.  This saves precious room on PDP11s.
16717842Sralph  */
16817842Sralph /*#define	GNXSEQ/* comment this out to save space */
16917842Sralph 
17013632Ssam #define XQTDIR		"/usr/spool/uucp/XTMP"
17113632Ssam #define SQFILE		"/usr/lib/uucp/SQFILE"
17213632Ssam #define SQTMP		"/usr/lib/uucp/SQTMP"
17313632Ssam #define SLCKTIME	5400	/* system/device timeout (LCK.. files) */
17413632Ssam #define SEQFILE		"/usr/lib/uucp/SEQF"
17513632Ssam #define SYSFILE		"/usr/lib/uucp/L.sys"
17613632Ssam #define DEVFILE		"/usr/lib/uucp/L-devices"
17713632Ssam #define DIALFILE	"/usr/lib/uucp/L-dialcodes"
17813632Ssam #define USERFILE	"/usr/lib/uucp/USERFILE"
17913632Ssam #define	CMDFILE		"/usr/lib/uucp/L.cmds"
18013632Ssam 
18113632Ssam #define SPOOL		"/usr/spool/uucp"
18217842Sralph #define SQLOCK		"LCK.SQ"
18313632Ssam #define SYSLOG		"/usr/spool/uucp/SYSLOG"
18413632Ssam #define PUBDIR		"/usr/spool/uucppublic"
18513632Ssam 
18613632Ssam #define SEQLOCK		"LCK.SEQL"
18713632Ssam #define CMDPRE		'C'
18813632Ssam #define DATAPRE		'D'
18913632Ssam #define XQTPRE		'X'
19013632Ssam 
19113632Ssam #define LOGFILE	"/usr/spool/uucp/LOGFILE"
19213632Ssam #define ERRLOG	"/usr/spool/uucp/ERRLOG"
19317842Sralph #define CMDSDIR	"/usr/spool/uucp/C."
19417842Sralph #define DATADIR	"/usr/spool/uucp/D."
19517842Sralph #define XEQTDIR	"/usr/spool/uucp/X."
19613632Ssam 
19713632Ssam #define RMTDEBUG	"AUDIT"
19817842Sralph #define CORRUPT		"CORRUPT"
19913632Ssam #define SQTIME		60
20013632Ssam #define TRYCALLS	2	/* number of tries to dial call */
20113632Ssam 
20217842Sralph #define LLEN	50
20317842Sralph #define MAXRQST	250
20417842Sralph 
20513632Ssam #define DEBUG(l, f, s) if (Debug >= l) fprintf(stderr, f, s); else
20613632Ssam 
20717842Sralph #define ASSERT(e, s1, s2, i1) if (!(e)) {assert(s1, s2, i1);cleanup(FAIL);}else
20813632Ssam 
20913632Ssam #define SAME 0
21017842Sralph #define ANYREAD 0004
21113632Ssam #define ANYWRITE 02
21213632Ssam #define FAIL -1
21313632Ssam #define SUCCESS 0
21413632Ssam #define CNULL (char *) 0
21513632Ssam #define STBNULL (struct sgttyb *) 0
21613632Ssam #define MASTER 1
21713632Ssam #define SLAVE 0
21817842Sralph #define MAXFULLNAME 255
21913632Ssam #define MAXMSGTIME 45
22017842Sralph #define NAMESIZE 255
22113632Ssam #define EOTMSG "\04\n\04\n"
22213632Ssam #define CALLBACK 1
22317842Sralph #define ONEDAY	86400L
22413632Ssam 
22513632Ssam 	/*  commands  */
22613632Ssam #define SHELL		"/bin/sh"
22717842Sralph #define MAIL		"/usr/lib/sendmail"
22813632Ssam #define UUCICO		"/usr/lib/uucp/uucico"
22913632Ssam #define UUXQT		"/usr/lib/uucp/uuxqt"
23013632Ssam #define UUCP		"uucp"
23113632Ssam 
23213632Ssam 	/*  call connect fail stuff  */
23313632Ssam #define CF_SYSTEM	-1
23413632Ssam #define CF_TIME		-2
23513632Ssam #define CF_LOCK		-3
23613632Ssam #define	CF_NODEV	-4
23713632Ssam #define CF_DIAL		-5
23813632Ssam #define CF_LOGIN	-6
23913632Ssam 
24013632Ssam #define F_NAME 0
24113632Ssam #define F_TIME 1
24213632Ssam #define F_LINE 2
24313632Ssam #define F_CLASS 3	/* an optional prefix and the speed */
24413632Ssam #define F_PHONE 4
24513632Ssam #define F_LOGIN 5
24613632Ssam 
24713632Ssam #define MAXPH	60	/* maximum length of a phone number */
24813632Ssam 
24913632Ssam 	/* This structure tells how to get to a device */
25013632Ssam struct condev {
25113632Ssam 	char *CU_meth;		/* method, such as 'ACU' or 'DIR' */
25213632Ssam 	char *CU_brand;		/* brand, such as 'Hayes' or 'Vadic' */
25313632Ssam 	int (*CU_gen)();	/* what to call to search for brands */
25413632Ssam 	int (*CU_open)();	/* what to call to open brand */
25513632Ssam 	int (*CU_clos)();	/* what to call to close brand */
25613632Ssam };
25713632Ssam 
25813632Ssam 	/* This structure tells about a device */
25913632Ssam struct Devices {
26017842Sralph #define	D_type		D_arg[0]
26117842Sralph #define	D_line		D_arg[1]
26217842Sralph #define	D_calldev	D_arg[2]
26317842Sralph #define	D_class		D_arg[3]
26417842Sralph #define	D_brand		D_arg[4]
26517842Sralph #define	D_CHAT		5
26617842Sralph 	int  D_numargs;
26717842Sralph 	int  D_speed;
26817842Sralph 	char *D_arg[20];
26917842Sralph 	char D_argbfr[100];
27013632Ssam };
27113632Ssam 
27213632Ssam 	/*  system status stuff  */
27313632Ssam #define SS_OK		0
27413632Ssam #define SS_FAIL		4
27513632Ssam #define SS_NODEVICE	1
27613632Ssam #define SS_CALLBACK	2
27713632Ssam #define SS_INPROGRESS	3
27813632Ssam #define SS_BADSEQ	5
27917842Sralph #define SS_WRONGTIME	6
28013632Ssam 
28113632Ssam 	/*  fail/retry parameters  */
28217842Sralph #define RETRYTIME 600
28313632Ssam #define MAXRECALLS 20
28413632Ssam 
28513632Ssam 	/*  stuff for command execution  */
28613632Ssam #define X_RQDFILE	'F'
28713632Ssam #define X_STDIN		'I'
28813632Ssam #define X_STDOUT	'O'
28913632Ssam #define X_CMD		'C'
29013632Ssam #define X_USER		'U'
29113632Ssam #define X_SENDFILE	'S'
29213632Ssam #define	X_NONOTI	'N'
29317842Sralph #define X_RETURNTO	'R'
29413632Ssam #define	X_NONZERO	'Z'
29513632Ssam #define X_LOCK		"LCK.XQT"
29613632Ssam #define X_LOCKTIME	3600
29713632Ssam 
29813632Ssam #define WKDSIZE 100	/*  size of work dir name  */
29913632Ssam 
30013632Ssam extern int Ifn, Ofn;
30113632Ssam extern char Rmtname[];
30213632Ssam extern char User[];
30313632Ssam extern char Loginuser[];
30413632Ssam extern char *Spool;
30513632Ssam extern char Myname[];
30617842Sralph extern char Myfullname[];
30713632Ssam extern int Debug;
30813632Ssam extern int Bspeed;
30913632Ssam extern char Wrkdir[];
31013632Ssam extern long Retrytime;
31117842Sralph extern short Usrf;
31217842Sralph extern int IsTcpIp;
31313632Ssam extern char Progname[];
31413632Ssam extern int (*CU_end)();
31513632Ssam extern struct condev condevs[];
31617842Sralph extern int nologinflag;
31717842Sralph extern char NOLOGIN[];
31813632Ssam 
31917842Sralph extern	char DLocal[], DLocalX[], *subfile(), *subdir();
32013632Ssam 
32113632Ssam /* Commonly called routines which return non-int value */
32213632Ssam extern	char *ttyname(), *strcpy(), *strcat(), *index(), *rindex(),
32317842Sralph 		*fgets(), *calloc(), *malloc(), *fdig(), *ttyname(),
32413632Ssam 		*cfgets();
32513632Ssam extern	long lseek();
32613992Sgray extern	FILE *rpopen();
32717842Sralph 
32817842Sralph extern char _FAILED[], CANTOPEN[], DEVNULL[];
329