xref: /original-bsd/usr.bin/uucp/includes/uucp.h (revision 53787e02)
1 /*	uucp.h	5.7	85/06/23	*/
2 
3 #include <stdio.h>
4 
5 /*
6  * Determine local uucp name of this machine.
7  * Define one of the following:
8  *
9  * For UCB 4.1A and later systems, you will have the gethostname(2) call.
10  * If this call exists, define GETHOSTNAME.
11  *
12  * For USG 3.0 and later systems, you will have the uname(2) call.
13  * If this call exists, define UNAME.
14  *
15  * Some systems have a line of the form '#define sysname "myuucpname",'
16  * in the file /usr/include/whoami.h, to identify their machine.
17  * If your site does that, define WHOAMI.
18  *
19  * If your site has <whoami.h>, but you do not want to read
20  * that file every time uucp runs, you can compile sysname into uucp.
21  * This is faster and more reliable, but binaries do not port.
22  * If you want to do that, define CCWHOAMI.
23  *
24  * Some systems put the local uucp name in a single-line file
25  * named /etc/uucpname or /local/uucpname.
26  * If your site does that, define UUNAME.
27  *
28  * Systems running 3Com's UNET will have the getmyhname() call.
29  * If you want to, define GETMYHNAME.
30  *
31  * You should also define MYNAME to be your uucp name.
32  *
33  * For each of the above that are defined, uucp checks them in order.
34  * It stops on the first method that returns a non null name.
35  * If everything fails, it uses "unknown" for the system name.
36  */
37 #define	GETHOSTNAME	/**/
38 /* #define UNAME	/**/
39 /* #define WHOAMI	/**/
40 /* #define CCWHOAMI	/**/
41 /* #define UUNAME	/**/
42 /* #define GETMYHNAME	/**/
43 /* If the above fails ... */
44 #define	MYNAME	"erehwon"
45 
46 /*
47  * If you have it, include <sysexits.h> to use exit
48  * codes that will be understood by sendmail.
49  * Otherwise, define EX_NOHOST, EX_CANTCREAT, and EX_NOINPUT.
50  */
51 #include <sysexits.h>
52 /*#define EX_NOINPUT	66	/**/
53 /*#define EX_NOHOST	68	/**/
54 /*#define EX_CANTCREAT	73	/**/
55 
56 /*
57  * Define the various kinds of connections to include.
58  * The complete list is in the condevs array in condevs.c
59  */
60 #define DN11		/* standard dialer */
61 /*#define DATAKIT	/* ATT's datakit */
62 /*#define PNET		/* Purdue network */
63 #define DF02		/* Dec's DF02/DF03 */
64 #define DF112		/* Dec's DF112 */
65 #define HAYES		/* Hayes' Smartmodem */
66 #define VENTEL		/* Ventel Dialer */
67 #define PENRIL		/* PENRIL Dialer */
68 #define VADIC		/* Racal-Vadic 345x */
69 #define VA212		/* Racal-Vadic 212 */
70 #define VA811S		/* Racal-Vadic 811S dialer, 831 adaptor */
71 #define VA820		/* Racal-Vadic 820 dialer, 831 adaptor */
72 #define RVMACS		/* Racal-Vadic MACS  820 dialer, 831 adaptor */
73 #define VMACS		/* Racal-Vadic MACS  811 dialer, 831 adaptor */
74 /*#define UNETTCP	/* 3Com's UNET */
75 #define BSDTCP		/* 4.2bsd or 2.9bsd TCP/IP */
76 #define PAD		/* X.25 PAD */
77 /*#define MICOM		/* micom mux port */
78 #define NOVATION	/* Novation modem */
79 
80 #if defined(UNETTCP) || defined(BSDTCP)
81 #define TCPIP
82 #endif
83 
84 #if defined(VENTEL) || defined(NOVATION) || defined(DF112) || defined(PENRIL)
85 /*
86  * We need a timer to write slowly to ventels.
87  * define INTERVALTIMER to use 4.2 bsd interval timer.
88  * define FASTTIMER if you have the nap() system call.
89  * define FTIME if you have the ftime() system call.
90  * define BUSYLOOP if you must do a busy loop.
91  * Look at uucpdelay() in condevs.c for details.
92  */
93 #define	INTERVALTIMER
94 #endif VENTEL || NOVATION || DF112 || PENRIL
95 
96 /*
97  * If your site is using "ndir.h" to retrofit the Berkeley
98  * directory reading routines, define NDIR.
99  * You will probably also have to set LIBNDIR in Makefile.
100  * Otherwise, <dir.h> is assumed to have the Berkeley directory definitions.
101  */
102 /*#define	NDIR	/**/
103 
104 /*
105  * If yours is a BTL system III, IV, V or so-on site, define USG.
106  */
107 /*#define	USG	/**/
108 
109 /*
110  * If you are running 4.2bsd, define BSD4_2
111  */
112 #define BSD4_2 	/**/
113 
114 /*
115  * If you are running 2.9bsd, define BSD2_9
116  */
117 /*#define BSD2_9 	/**/
118 
119 /*
120  * If you are using /etc/inetd with 4.2bsd, define BSDINETD
121  */
122 #define BSDINETD	/**/
123 
124 /*#define VMSDTR	/* Turn on modem control on vms(works DTR) for
125 			   develcon and gandalf ports to gain access */
126 /*
127  *	If you want to use the same modem for dialing in and out define
128  *	DIALINOUT to be the localtion of the acucntrl program
129  */
130 /* #define DIALINOUT	"/usr/lib/uucp/acucntrl" /**/
131 
132 /*
133  *	If you want all ACU lines to be DIALINOUT, define ALLACUINOUT
134  */
135 /* #define ALLACUINOUT	/**/
136 
137 /* define the value of WFMASK - for umask call - used for all uucp work files */
138 #define WFMASK 0137
139 
140 /* define UUSTAT if you need "uustat" command */
141 /* #define UUSTAT	/**/
142 
143 /* define UUSUB if you need "uusub" command */
144 /* #define UUSUB /**/
145 
146 /* define the value of LOGMASK - for LOGFILE, SYSLOG, ERRLOG */
147 #define	LOGMASK		0133
148 
149 /* All files are given at least the following at the final destination */
150 /* It is also the default mode, so '666' is recommended */
151 /* and 444 is minimal (minimally useful, maximally annoying) */
152 #define	BASEMODE	0666
153 
154 /*
155  * Define NOSTRANGERS if you don't want to accept transactions from
156  * sites that are not in your L.sys file (see cico.c)
157  */
158 #define NOSTRANGERS	/**/
159 /*
160  * Traditionally LCK (lock) files have been kept in /usr/spool/uucp.
161  * If you want that define LOCKDIR to be ".".
162  * If you want the locks kept in a subdirectory, define LOCKDIR as "LCK.".
163  * Good news about LCK. subdirectory: the directory can be mode 777 so
164  * unprivileged programs can share the uucp locking system,
165  * and the subdirectory keeps down clutter in the main directory.
166  * The BAD news: you have to change 'tip' and another programs that
167  * know where the LCK files are kept, and you have to change your /etc/rc
168  * if your rc cleans out the lock files (as it should).
169  */
170 /*#define	LOCKDIR	"LCK."	/**/
171 #define LOCKDIR	"." /**/
172 
173 /*
174  * If you want uucp and uux to copy the data files by default,
175  * don't define DONTCOPY (This is the way older 4bsd uucps worked)
176  * If you want uucp and uux to use the original files instead of
177  * copies, define DONTCOPY (This is the way System III and V work)
178  */
179 #define DONTCOPY	/**/
180 
181 /*
182  * Very few (that I know of) systems use the sequence checking feature.
183  * If you are not going to use it (hint: you are not),
184  * do not define GNXSEQ.  This saves precious room on PDP11s.
185  */
186 /*#define	GNXSEQ	/* comment this out to save space */
187 
188 /*
189  * If you want the logfile stored in a file for each site instead
190  * of one file
191  * define LOGBYSITE as the directory to put the files in
192  */
193 /*#define LOGBYSITE	"/usr/spool/uucp/LOG" /**/
194 
195 #define XQTDIR		"/usr/spool/uucp/XTMP"
196 #define SQFILE		"/usr/lib/uucp/SQFILE"
197 #define SQTMP		"/usr/lib/uucp/SQTMP"
198 #define SLCKTIME	5400	/* system/device timeout (LCK.. files) */
199 #define SEQFILE		"/usr/lib/uucp/SEQF"
200 #define SYSFILE		"/usr/lib/uucp/L.sys"
201 #define DEVFILE		"/usr/lib/uucp/L-devices"
202 #define DIALFILE	"/usr/lib/uucp/L-dialcodes"
203 #define USERFILE	"/usr/lib/uucp/USERFILE"
204 #define	CMDFILE		"/usr/lib/uucp/L.cmds"
205 #define	ALIASFILE	"/usr/lib/uucp/L.aliases"
206 
207 #define SPOOL		"/usr/spool/uucp"
208 #define SQLOCK		"LCK.SQ"
209 #define SYSLOG		"/usr/spool/uucp/SYSLOG"
210 #define PUBDIR		"/usr/spool/uucppublic"
211 
212 #define SEQLOCK		"LCK.SEQL"
213 #define CMDPRE		'C'
214 #define DATAPRE		'D'
215 #define XQTPRE		'X'
216 
217 #define LOGFILE		"/usr/spool/uucp/LOGFILE"
218 #define ERRLOG		"/usr/spool/uucp/ERRLOG"
219 #define CMDSDIR		"/usr/spool/uucp/C."
220 #define DATADIR		"/usr/spool/uucp/D."
221 #define XEQTDIR		"/usr/spool/uucp/X."
222 
223 #define RMTDEBUG	"AUDIT"
224 #define CORRUPT		"CORRUPT"
225 #define SQTIME		60
226 #define TRYCALLS	2	/* number of tries to dial call */
227 
228 #define LLEN	50
229 #define MAXRQST	250
230 
231 #define DEBUG(l, f, s) if (Debug >= l) fprintf(stderr, f, s); else
232 
233 #define ASSERT(e, s1, s2, i1) if (!(e)) {assert(s1, s2, i1);cleanup(FAIL);}else
234 
235 #define SAME		0
236 #define ANYREAD		0004
237 #define ANYWRITE	02
238 #define FAIL		-1
239 #define SUCCESS		0
240 #define CNULL		(char *) 0
241 #define STBNULL		(struct sgttyb *) 0
242 #define MASTER		1
243 #define SLAVE		0
244 #define MAXFULLNAME	255
245 #define MAXMSGTIME	45
246 #define NAMESIZE	255
247 #define MAXBASENAME	14
248 #define SYSNSIZE	(MAXBASENAME-1-1-1-4)
249 #define EOTMSG		"\04\n\04\n"
250 #define CALLBACK	1
251 #define ONEDAY		86400L
252 
253 	/*  commands  */
254 #define SHELL		"/bin/sh"
255 #define MAIL		"/usr/lib/sendmail"
256 #define UUCICO		"/usr/lib/uucp/uucico"
257 #define UUXQT		"/usr/lib/uucp/uuxqt"
258 #define UUCP		"uucp"
259 
260 	/*  call connect fail stuff  */
261 #define CF_SYSTEM	-1
262 #define CF_TIME		-2
263 #define CF_LOCK		-3
264 #define	CF_NODEV	-4
265 #define CF_DIAL		-5
266 #define CF_LOGIN	-6
267 
268 #define F_NAME		0
269 #define F_TIME		1
270 #define F_LINE		2
271 #define F_CLASS		3	/* an optional prefix and the speed */
272 #define F_PHONE		4
273 #define F_LOGIN		5
274 
275 #define MAXPH		60	/* maximum length of a phone number */
276 
277 	/* This structure tells how to get to a device */
278 struct condev {
279 	char *CU_meth;		/* method, such as 'ACU' or 'DIR' */
280 	char *CU_brand;		/* brand, such as 'Hayes' or 'Vadic' */
281 	int (*CU_gen)();	/* what to call to search for brands */
282 	int (*CU_open)();	/* what to call to open brand */
283 	int (*CU_clos)();	/* what to call to close brand */
284 };
285 
286 	/* This structure tells about a device */
287 struct Devices {
288 #define	D_type		D_arg[0]
289 #define	D_line		D_arg[1]
290 #define	D_calldev	D_arg[2]
291 #define	D_class		D_arg[3]
292 #define	D_brand		D_arg[4]
293 #define	D_CHAT		5
294 	int  D_numargs;
295 	int  D_speed;
296 	char *D_arg[20];
297 	char D_argbfr[100];
298 };
299 
300 	/*  system status stuff  */
301 #define SS_OK		0
302 #define SS_NODEVICE	1
303 #define SS_CALLBACK	2
304 #define SS_INPROGRESS	3
305 #define SS_FAIL		4
306 #define SS_BADSEQ	5
307 #define SS_WRONGTIME	6
308 
309 	/*  fail/retry parameters  */
310 #define RETRYTIME	600
311 #define MAXRECALLS	25
312 
313 	/*  stuff for command execution  */
314 #define X_RQDFILE	'F'
315 #define X_STDIN		'I'
316 #define X_STDOUT	'O'
317 #define X_CMD		'C'
318 #define X_USER		'U'
319 #define X_SENDFILE	'S'
320 #define	X_NONOTI	'N'
321 #define X_RETURNTO	'R'
322 #define	X_NONZERO	'Z'
323 #define X_LOCK		"LCK.XQT"
324 #define X_LOCKTIME	3600L
325 
326 #define WKDSIZE		100	/*  size of work dir name  */
327 
328 #include <sys/types.h>
329 #ifndef USG
330 #include <sys/timeb.h>
331 #else USG
332 struct timeb
333 {
334 	time_t	time;
335 	unsigned short millitm;
336 	short	timezone;
337 	short	dstflag;
338 };
339 #define rindex strrchr
340 #define index strchr
341 #endif USG
342 
343 extern struct timeb Now;
344 
345 extern int Ifn, Ofn;
346 extern char *Rmtname;
347 extern char User[];
348 extern char Loginuser[];
349 extern char *Spool;
350 extern char Myname[];
351 extern char Myfullname[];
352 extern int Debug;
353 extern int Bspeed;
354 extern char Wrkdir[];
355 extern time_t Retrytime;
356 extern short Usrf;
357 extern int IsTcpIp;
358 extern char Progname[];
359 extern int (*CU_end)();
360 extern struct condev condevs[];
361 extern int nologinflag;
362 extern char NOLOGIN[];
363 
364 extern	char DLocal[], DLocalX[], *subfile(), *subdir();
365 
366 /* Commonly called routines which return non-int value */
367 extern	char *ttyname(), *strcpy(), *strcat(), *index(), *rindex(),
368 		*fgets(), *calloc(), *malloc(), *fdig(), *ttyname(),
369 		*cfgets(), *getwd(), *strpbrk(), *strncpy();
370 extern	long lseek();
371 extern	FILE *rpopen();
372 extern time_t time();
373 
374 extern char _FAILED[], CANTOPEN[], DEVNULL[];
375 
376 #ifdef lint
377 /* This horrible gross kludge is the only way I know to
378  * convince lint that signal(SIGINT,SIG_IGN) is legal. It hates SIG_IGN.
379  */
380 #ifdef SIG_IGN
381 #undef SIG_IGN
382 #endif /* SIG_IGN */
383 #define SIG_IGN	main
384 extern int main();
385 #ifdef DEBUG
386 #undef DEBUG
387 #endif DEBUG
388 #define DEBUG(a,b,c)
389 #endif /* lint */
390