xref: /csrg-svn/usr.bin/uucp/includes/uucp.h (revision 17842)
1*17842Sralph /*	uucp.h	5.4	85/01/22	*/
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  *
31*17842Sralph  * 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
38*17842Sralph /*#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>
48*17842Sralph /*#define EX_NOINPUT	66*/
49*17842Sralph /*#define EX_NOHOST	68*/
50*17842Sralph /*#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*17842Sralph /*#define DN11		/* standard dialer */
57*17842Sralph /*#define DATAKIT	/* ATT's datakit */
5813632Ssam /*#define PNET		/* Purdue network */
5913632Ssam /*#define DF02		/* Dec's DF02/DF03 */
60*17842Sralph /*#define HAYES		/* Hayes' Smartmodem */
61*17842Sralph /*#define VENTEL	/* ventel dialer */
62*17842Sralph /*#define VADIC		/* Racal-Vadic 345x */
63*17842Sralph /*#define VA212		/* Racal-Vadic 212 */
64*17842Sralph /*#define VA811S	/* Racal-Vadic 811S dialer, 831 adaptor */
65*17842Sralph #define VA820		/* Racal-Vadic 820 dialer, 831 adaptor */
66*17842Sralph /*#define RVMACS	/* Racal-Vadic MACS  820 dialer, 831 adaptor */
67*17842Sralph /*#define VMACS		/* Racal-Vadic MACS  811 dialer, 831 adaptor */
68*17842Sralph /*#define UNETTCP	/* 3Com's UNET */
69*17842Sralph #define BSDTCP		/* 4.2bsd TCP/IP */
70*17842Sralph #define PAD		/* X.25 PAD */
7113632Ssam /*#define MICOM		/* micom mux port */
72*17842Sralph /*#define NOVATION	/* Novation modem */
7313632Ssam 
74*17842Sralph #if defined(UNETTCP) || defined(BSDTCP)
75*17842Sralph #define TCPIP
76*17842Sralph #endif
77*17842Sralph 
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  */
96*17842Sralph /*#define	NDIR	*/
9713632Ssam 
9813632Ssam /*
99*17842Sralph  * If yours is a BTL system III, IV, or so-on site, define USG.
10013632Ssam  */
101*17842Sralph /*#define	USG	*/
10213632Ssam 
103*17842Sralph /*
104*17842Sralph  * If you are running 4.2bsd, define BSD4_2
105*17842Sralph  */
106*17842Sralph #define BSD4_2
107*17842Sralph 
108*17842Sralph /*
109*17842Sralph  * If you are using /etc/inetd with 4.2bsd, define BSDINETD
110*17842Sralph  */
111*17842Sralph #define BSDINETD
112*17842Sralph 
113*17842Sralph /*#define VMSDTR	/* Turn on modem control on vms(works DTR) for
114*17842Sralph 			   develcon and gandalf ports to gain access */
115*17842Sralph 
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 
122*17842Sralph /* define UUSTAT if you need "uustat" command */
123*17842Sralph /* #define UUSTAT	*/
124*17842Sralph 
125*17842Sralph /*	define UUSUB if you need "uusub" command */
126*17842Sralph /* #define UUSUB /**/
127*17842Sralph 
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 
136*17842Sralph /*
137*17842Sralph  * Define NOSTRANGERS if you don't want to accept transactions from
138*17842Sralph  * sites that are not in your L.sys file (see cico.c)
139*17842Sralph  */
140*17842Sralph #define NOSTRANGERS
141*17842Sralph /*
142*17842Sralph  * Traditionally LCK (lock) files have been kept in /usr/spool/uucp.
143*17842Sralph  * If you want that define LOCKDIR to be ".".
144*17842Sralph  * If you want the locks kept in a subdirectory, define LOCKDIR as "LCK.".
145*17842Sralph  * Good news about LCK. subdirectory: the directory can be mode 777 so
146*17842Sralph  * unprivileged programs can share the uucp locking system,
147*17842Sralph  * and the subdirectory keeps down clutter in the main directory.
148*17842Sralph  * The BAD news: you have to change 'tip' and another programs that
149*17842Sralph  * know where the LCK files are kept, and you have to change your /etc/rc
150*17842Sralph  * if your rc cleans out the lock files (as it should).
151*17842Sralph  */
152*17842Sralph /*#define	LOCKDIR	"LCK." */
153*17842Sralph #define	LOCKDIR	"."
15413632Ssam 
155*17842Sralph /*
156*17842Sralph  * If you want uucp and uux to copy the data files by default,
157*17842Sralph  * don't define DONTCOPY (This is the way older 4bsd uucps worked)
158*17842Sralph  * If you want uucp and uux to use the original files instead of
159*17842Sralph  * copies, define DONTCOPY (This is the way System III and V work)
160*17842Sralph  */
161*17842Sralph #define DONTCOPY
162*17842Sralph 
163*17842Sralph /*
164*17842Sralph  * Very few (none I know of) systems use the sequence checking feature.
165*17842Sralph  * If you are not going to use it (hint: you are not),
166*17842Sralph  * do not define GNXSEQ.  This saves precious room on PDP11s.
167*17842Sralph  */
168*17842Sralph /*#define	GNXSEQ/* comment this out to save space */
169*17842Sralph 
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"
182*17842Sralph #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"
193*17842Sralph #define CMDSDIR	"/usr/spool/uucp/C."
194*17842Sralph #define DATADIR	"/usr/spool/uucp/D."
195*17842Sralph #define XEQTDIR	"/usr/spool/uucp/X."
19613632Ssam 
19713632Ssam #define RMTDEBUG	"AUDIT"
198*17842Sralph #define CORRUPT		"CORRUPT"
19913632Ssam #define SQTIME		60
20013632Ssam #define TRYCALLS	2	/* number of tries to dial call */
20113632Ssam 
202*17842Sralph #define LLEN	50
203*17842Sralph #define MAXRQST	250
204*17842Sralph 
20513632Ssam #define DEBUG(l, f, s) if (Debug >= l) fprintf(stderr, f, s); else
20613632Ssam 
207*17842Sralph #define ASSERT(e, s1, s2, i1) if (!(e)) {assert(s1, s2, i1);cleanup(FAIL);}else
20813632Ssam 
20913632Ssam #define SAME 0
210*17842Sralph #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
218*17842Sralph #define MAXFULLNAME 255
21913632Ssam #define MAXMSGTIME 45
220*17842Sralph #define NAMESIZE 255
22113632Ssam #define EOTMSG "\04\n\04\n"
22213632Ssam #define CALLBACK 1
223*17842Sralph #define ONEDAY	86400L
22413632Ssam 
22513632Ssam 	/*  commands  */
22613632Ssam #define SHELL		"/bin/sh"
227*17842Sralph #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 {
260*17842Sralph #define	D_type		D_arg[0]
261*17842Sralph #define	D_line		D_arg[1]
262*17842Sralph #define	D_calldev	D_arg[2]
263*17842Sralph #define	D_class		D_arg[3]
264*17842Sralph #define	D_brand		D_arg[4]
265*17842Sralph #define	D_CHAT		5
266*17842Sralph 	int  D_numargs;
267*17842Sralph 	int  D_speed;
268*17842Sralph 	char *D_arg[20];
269*17842Sralph 	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
279*17842Sralph #define SS_WRONGTIME	6
28013632Ssam 
28113632Ssam 	/*  fail/retry parameters  */
282*17842Sralph #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'
293*17842Sralph #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[];
306*17842Sralph extern char Myfullname[];
30713632Ssam extern int Debug;
30813632Ssam extern int Bspeed;
30913632Ssam extern char Wrkdir[];
31013632Ssam extern long Retrytime;
311*17842Sralph extern short Usrf;
312*17842Sralph extern int IsTcpIp;
31313632Ssam extern char Progname[];
31413632Ssam extern int (*CU_end)();
31513632Ssam extern struct condev condevs[];
316*17842Sralph extern int nologinflag;
317*17842Sralph extern char NOLOGIN[];
31813632Ssam 
319*17842Sralph extern	char DLocal[], DLocalX[], *subfile(), *subdir();
32013632Ssam 
32113632Ssam /* Commonly called routines which return non-int value */
32213632Ssam extern	char *ttyname(), *strcpy(), *strcat(), *index(), *rindex(),
323*17842Sralph 		*fgets(), *calloc(), *malloc(), *fdig(), *ttyname(),
32413632Ssam 		*cfgets();
32513632Ssam extern	long lseek();
32613992Sgray extern	FILE *rpopen();
327*17842Sralph 
328*17842Sralph extern char _FAILED[], CANTOPEN[], DEVNULL[];
329