xref: /csrg-svn/usr.bin/uucp/includes/uucp.h (revision 13632)
1*13632Ssam /*	uucp.h	5.1	83/07/02	*/
2*13632Ssam 
3*13632Ssam #include "stdio.h"
4*13632Ssam 
5*13632Ssam /*
6*13632Ssam  * Determine local uucp name of this machine.
7*13632Ssam  * Define one of the following:
8*13632Ssam  *
9*13632Ssam  * For UCB 4.1A and later systems, you will have the gethostname(2) call.
10*13632Ssam  * If this call exists, define GETHOSTNAME.
11*13632Ssam  *
12*13632Ssam  * For USG 3.0 and later systems, you will have the uname(2) call.
13*13632Ssam  * If this call exists, define UNAME.
14*13632Ssam  *
15*13632Ssam  * Some systems have a line of the form '#define sysname "myuucpname",'
16*13632Ssam  * in the file /usr/include/whoami.h, to identify their machine.
17*13632Ssam  * If your site does that, define WHOAMI.
18*13632Ssam  *
19*13632Ssam  * If your site has <whoami.h>, but you do not want to read
20*13632Ssam  * that file every time uucp runs, you can compile sysname into uucp.
21*13632Ssam  * This is faster and more reliable, but binaries do not port.
22*13632Ssam  * If you want to do that, define CCWHOAMI.
23*13632Ssam  *
24*13632Ssam  * Some systems put the local uucp name in a single-line file
25*13632Ssam  * named /etc/uucpname or /local/uucpname.
26*13632Ssam  * If your site does that, define UUNAME.
27*13632Ssam  *
28*13632Ssam  * Systems running 3Com's UNET will have the getmyhname() call.
29*13632Ssam  * If you want to, define GETMYHNAME.
30*13632Ssam  *
31*13632Ssam  * You should also define MYNANE to be your uucp name.
32*13632Ssam  *
33*13632Ssam  * For each of the above that are defined, uucp checks them in order.
34*13632Ssam  * It stops on the first method that returns a non null name.
35*13632Ssam  * If everything fails, it uses "unknown" for the system name.
36*13632Ssam  */
37*13632Ssam #define	GETHOSTNAME
38*13632Ssam /* If the above fails ... */
39*13632Ssam #define	MYNAME	"erewhon"
40*13632Ssam 
41*13632Ssam /*
42*13632Ssam  * If you have it, include <sysexits.h> to use exit
43*13632Ssam  * codes that will be understood by sendmail.
44*13632Ssam  * Otherwise, define EX_NOHOST, EX_CANTCREAT, and EX_NOINPUT.
45*13632Ssam  */
46*13632Ssam #include <sysexits.h>
47*13632Ssam /*#define EX_NOHOST	101*/
48*13632Ssam /*#define EX_CANTCREAT	1*/
49*13632Ssam /*#define EX_NOINPUT	2*/
50*13632Ssam 
51*13632Ssam /* define UUDIR for uucp subdirectory kludge (recommended) */
52*13632Ssam #define	UUDIR
53*13632Ssam 
54*13632Ssam /*
55*13632Ssam  * Define the various kinds of connections to include.
56*13632Ssam  * The complete list is in the condevs array in condevs.c
57*13632Ssam  */
58*13632Ssam #define DN11		/* standard dialer */
59*13632Ssam /*#define DATAKIT		/* ATT's datakit */
60*13632Ssam /*#define PNET		/* Purdue network */
61*13632Ssam /*#define DF02		/* Dec's DF02/DF03 */
62*13632Ssam #define HAYES		/* Hayes' Smartmodem */
63*13632Ssam #define VENTEL		/* ventel dialer */
64*13632Ssam #define VADIC		/* Racal-Vadic 3450 */
65*13632Ssam /*#define RVMACS		/* Racal-Vadic MACS 831 */
66*13632Ssam /*#define UNET		/* 3Com's UNET */
67*13632Ssam /*#define MICOM		/* micom mux port */
68*13632Ssam 
69*13632Ssam #ifdef	VENTEL
70*13632Ssam /*
71*13632Ssam  * We need a timer to write slowly to ventels.
72*13632Ssam  * define INTERVALTIMER to use 4.2 bsd interval timer.
73*13632Ssam  * define FASTTIMER if you have the nap() system call.
74*13632Ssam  * define FTIME if you have the ftime() system call.
75*13632Ssam  * define BUSYLOOP if you must do a busy loop.
76*13632Ssam  * Look at uucpdelay() in condevs.c for details.
77*13632Ssam  */
78*13632Ssam #define	FTIME
79*13632Ssam #endif
80*13632Ssam 
81*13632Ssam /*
82*13632Ssam  * If your site is using "ndir.h" to retrofit the Berkeley
83*13632Ssam  * directory reading routines, define NDIR.
84*13632Ssam  * You will probably also have to set LIBNDIR in Makefile.
85*13632Ssam  * Otherwise, <dir.h> is assumed to have the Berkeley directory definitions.
86*13632Ssam  */
87*13632Ssam /*#define	NDIR*/
88*13632Ssam 
89*13632Ssam /*
90*13632Ssam  * If yours is a BTL system III, IV, or so-on site, define SYSIII.
91*13632Ssam  * Conditional compilations should produce the right code,
92*13632Ssam  * but if it doesn't (the compiler will probably complain loudly),
93*13632Ssam  * make the needed adjustments and guard the code with
94*13632Ssam  * #ifdef SYSIII, (code for system III), #else, (code for V7), #endif
95*13632Ssam  */
96*13632Ssam /*#define	SYSIII*/
97*13632Ssam 
98*13632Ssam /* define the last characters for ACU */
99*13632Ssam /* burl!lda, rti!trt, isn't "<" more widely used than "-"? */
100*13632Ssam /* rti!trt: use -< as is done in 4.1c uucp */
101*13632Ssam #define ACULAST "-<"
102*13632Ssam 
103*13632Ssam /* define the value of WFMASK - for umask call - used for all uucp work files */
104*13632Ssam #define WFMASK 0137
105*13632Ssam 
106*13632Ssam /* define the value of LOGMASK - for LOGFILE, SYSLOG, ERRLOG */
107*13632Ssam #define	LOGMASK	0133
108*13632Ssam 
109*13632Ssam /* All files are given at least the following at the final destination */
110*13632Ssam /* It is also the default mode, so '666' is recommended */
111*13632Ssam /* and 444 is minimal (minimally useful, maximally annoying) */
112*13632Ssam #define	BASEMODE	0666
113*13632Ssam 
114*13632Ssam /* All users with getuid() <= PRIV_UIDS are 'privileged'. */
115*13632Ssam /* Was 10, reduced to 3 as suggested by duke!dbl (David Leonard) */
116*13632Ssam #define	PRIV_UIDS	3
117*13632Ssam 
118*13632Ssam #define XQTDIR		"/usr/spool/uucp/XTMP"
119*13632Ssam #define SQFILE		"/usr/lib/uucp/SQFILE"
120*13632Ssam #define SQTMP		"/usr/lib/uucp/SQTMP"
121*13632Ssam #define SLCKTIME	5400	/* system/device timeout (LCK.. files) */
122*13632Ssam #define SEQFILE		"/usr/lib/uucp/SEQF"
123*13632Ssam #define SYSFILE		"/usr/lib/uucp/L.sys"
124*13632Ssam #define DEVFILE		"/usr/lib/uucp/L-devices"
125*13632Ssam #define DIALFILE	"/usr/lib/uucp/L-dialcodes"
126*13632Ssam #define USERFILE	"/usr/lib/uucp/USERFILE"
127*13632Ssam #define	CMDFILE		"/usr/lib/uucp/L.cmds"
128*13632Ssam 
129*13632Ssam #define SPOOL		"/usr/spool/uucp"
130*13632Ssam #define SQLOCK		"/usr/spool/uucp/LCK.SQ"
131*13632Ssam #define SYSLOG		"/usr/spool/uucp/SYSLOG"
132*13632Ssam #define PUBDIR		"/usr/spool/uucppublic"
133*13632Ssam 
134*13632Ssam #define SEQLOCK		"LCK.SEQL"
135*13632Ssam #define CMDPRE		'C'
136*13632Ssam #define DATAPRE		'D'
137*13632Ssam #define XQTPRE		'X'
138*13632Ssam 
139*13632Ssam #define LOGFILE	"/usr/spool/uucp/LOGFILE"
140*13632Ssam #define ERRLOG	"/usr/spool/uucp/ERRLOG"
141*13632Ssam 
142*13632Ssam #define RMTDEBUG	"AUDIT"
143*13632Ssam #define SQTIME		60
144*13632Ssam #define TRYCALLS	2	/* number of tries to dial call */
145*13632Ssam 
146*13632Ssam /*define PROTODEBUG = 1 if testing protocol - introduce errors */
147*13632Ssam #define DEBUG(l, f, s) if (Debug >= l) fprintf(stderr, f, s); else
148*13632Ssam 
149*13632Ssam #define ASSERT(e, s1, s2, i1) if (!(e)) {\
150*13632Ssam assert(s1, s2, i1);\
151*13632Ssam cleanup(FAIL);} else
152*13632Ssam 
153*13632Ssam 
154*13632Ssam #define SAME 0
155*13632Ssam #define ANYREAD 04
156*13632Ssam #define ANYWRITE 02
157*13632Ssam #define FAIL -1
158*13632Ssam #define SUCCESS 0
159*13632Ssam #define CNULL (char *) 0
160*13632Ssam #define STBNULL (struct sgttyb *) 0
161*13632Ssam #define MASTER 1
162*13632Ssam #define SLAVE 0
163*13632Ssam #define MAXFULLNAME 250
164*13632Ssam #define MAXMSGTIME 45
165*13632Ssam #define NAMESIZE 15
166*13632Ssam #define EOTMSG "\04\n\04\n"
167*13632Ssam #define CALLBACK 1
168*13632Ssam 
169*13632Ssam 	/*  commands  */
170*13632Ssam #define SHELL		"/bin/sh"
171*13632Ssam #define MAIL		"mail"
172*13632Ssam #define UUCICO		"/usr/lib/uucp/uucico"
173*13632Ssam #define UUXQT		"/usr/lib/uucp/uuxqt"
174*13632Ssam #define UUCP		"uucp"
175*13632Ssam 
176*13632Ssam 	/*  call connect fail stuff  */
177*13632Ssam #define CF_SYSTEM	-1
178*13632Ssam #define CF_TIME		-2
179*13632Ssam #define CF_LOCK		-3
180*13632Ssam #define	CF_NODEV	-4
181*13632Ssam #define CF_DIAL		-5
182*13632Ssam #define CF_LOGIN	-6
183*13632Ssam 
184*13632Ssam #define F_NAME 0
185*13632Ssam #define F_TIME 1
186*13632Ssam #define F_LINE 2
187*13632Ssam #define F_CLASS 3	/* an optional prefix and the speed */
188*13632Ssam #define F_PHONE 4
189*13632Ssam #define F_LOGIN 5
190*13632Ssam 
191*13632Ssam #define MAXPH	60	/* maximum length of a phone number */
192*13632Ssam 
193*13632Ssam 	/* This structure tells how to get to a device */
194*13632Ssam struct condev {
195*13632Ssam 	char *CU_meth;		/* method, such as 'ACU' or 'DIR' */
196*13632Ssam 	char *CU_brand;		/* brand, such as 'Hayes' or 'Vadic' */
197*13632Ssam 	int (*CU_gen)();	/* what to call to search for brands */
198*13632Ssam 	int (*CU_open)();	/* what to call to open brand */
199*13632Ssam 	int (*CU_clos)();	/* what to call to close brand */
200*13632Ssam };
201*13632Ssam 
202*13632Ssam 	/* This structure tells about a device */
203*13632Ssam struct Devices {
204*13632Ssam 	char D_type[20];
205*13632Ssam 	char D_line[20];
206*13632Ssam 	char D_calldev[20];
207*13632Ssam 	char D_class[20];
208*13632Ssam 	int D_speed;
209*13632Ssam 	char D_brand[20];	/* brand name, as 'Hayes' or 'Vadic' */
210*13632Ssam };
211*13632Ssam 
212*13632Ssam 	/*  system status stuff  */
213*13632Ssam #define SS_OK		0
214*13632Ssam #define SS_FAIL		4
215*13632Ssam #define SS_NODEVICE	1
216*13632Ssam #define SS_CALLBACK	2
217*13632Ssam #define SS_INPROGRESS	3
218*13632Ssam #define SS_BADSEQ	5
219*13632Ssam 
220*13632Ssam 	/*  fail/retry parameters  */
221*13632Ssam #define RETRYTIME 3300
222*13632Ssam #define MAXRECALLS 20
223*13632Ssam 
224*13632Ssam 	/*  stuff for command execution  */
225*13632Ssam #define X_RQDFILE	'F'
226*13632Ssam #define X_STDIN		'I'
227*13632Ssam #define X_STDOUT	'O'
228*13632Ssam #define X_CMD		'C'
229*13632Ssam #define X_USER		'U'
230*13632Ssam #define X_SENDFILE	'S'
231*13632Ssam #define	X_NONOTI	'N'
232*13632Ssam #define	X_NONZERO	'Z'
233*13632Ssam #define X_LOCK		"LCK.XQT"
234*13632Ssam #define X_LOCKTIME	3600
235*13632Ssam 
236*13632Ssam #define WKDSIZE 100	/*  size of work dir name  */
237*13632Ssam 
238*13632Ssam extern int Ifn, Ofn;
239*13632Ssam extern char Rmtname[];
240*13632Ssam extern char User[];
241*13632Ssam extern char Loginuser[];
242*13632Ssam extern char *Spool;
243*13632Ssam extern char Myname[];
244*13632Ssam extern int Debug;
245*13632Ssam extern int Pkdebug;
246*13632Ssam extern int Pkdrvon;
247*13632Ssam extern int Bspeed;
248*13632Ssam extern char Wrkdir[];
249*13632Ssam extern long Retrytime;
250*13632Ssam extern int Unet;
251*13632Ssam extern char Progname[];
252*13632Ssam extern int (*CU_end)();
253*13632Ssam extern struct condev condevs[];
254*13632Ssam 
255*13632Ssam #ifdef	UUDIR
256*13632Ssam #define	subfile(s)	SubFile(s)
257*13632Ssam #define	subdir(d, p)	SubDir(d, p)
258*13632Ssam #define	subchdir(d)	SubChDir(d)
259*13632Ssam extern	char DLocal[], DLocalX[], *SubFile(), *SubDir();
260*13632Ssam #else
261*13632Ssam #define	subfile(s)	s
262*13632Ssam #define	subdir(d, p)	d
263*13632Ssam #define	subchdir(d)	chdir(d)
264*13632Ssam #endif
265*13632Ssam 
266*13632Ssam /* Commonly called routines which return non-int value */
267*13632Ssam extern	char *ttyname(), *strcpy(), *strcat(), *index(), *rindex(),
268*13632Ssam 		*fgets(), *calloc(), *malloc(),
269*13632Ssam 		*cfgets();
270*13632Ssam extern	long lseek();
271