xref: /illumos-gate/usr/src/cmd/ttymon/uucp.h (revision 3bb2c156)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate  * with the License.
87c478bd9Sstevel@tonic-gate  *
97c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate  * and limitations under the License.
137c478bd9Sstevel@tonic-gate  *
147c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate  *
207c478bd9Sstevel@tonic-gate  * CDDL HEADER END
217c478bd9Sstevel@tonic-gate  */
227c478bd9Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
23*3bb2c156SToomas Soome /*	  All Rights Reserved	*/
24ace1a5f1Sdp /*
25ace1a5f1Sdp  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
26ace1a5f1Sdp  * Use is subject to license terms.
27ace1a5f1Sdp  */
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate #ifndef _UUCP_H
31*3bb2c156SToomas Soome #define	_UUCP_H
32ace1a5f1Sdp 
33ace1a5f1Sdp #ifdef __cplusplus
34ace1a5f1Sdp extern "C" {
35ace1a5f1Sdp #endif
36ace1a5f1Sdp 
377c478bd9Sstevel@tonic-gate #include <unistd.h>
387c478bd9Sstevel@tonic-gate #include <stdlib.h>
397c478bd9Sstevel@tonic-gate #include <string.h>
407c478bd9Sstevel@tonic-gate #include "parms.h"
417c478bd9Sstevel@tonic-gate 
427c478bd9Sstevel@tonic-gate #ifdef DIAL
43*3bb2c156SToomas Soome #define	EXTERN static
44*3bb2c156SToomas Soome #define	GLOBAL static
457c478bd9Sstevel@tonic-gate #else
46*3bb2c156SToomas Soome #define	EXTERN extern
47*3bb2c156SToomas Soome #define	GLOBAL
487c478bd9Sstevel@tonic-gate #endif
497c478bd9Sstevel@tonic-gate 
507c478bd9Sstevel@tonic-gate #ifdef BSD4_2
51*3bb2c156SToomas Soome #define	V7
527c478bd9Sstevel@tonic-gate #undef NONAP
537c478bd9Sstevel@tonic-gate #undef FASTTIMER
547c478bd9Sstevel@tonic-gate #endif /* BSD4_2 */
557c478bd9Sstevel@tonic-gate 
567c478bd9Sstevel@tonic-gate #ifdef FASTTIMER
577c478bd9Sstevel@tonic-gate #undef NONAP
587c478bd9Sstevel@tonic-gate #endif
597c478bd9Sstevel@tonic-gate 
607c478bd9Sstevel@tonic-gate #ifdef V8
61*3bb2c156SToomas Soome #define	V7
627c478bd9Sstevel@tonic-gate #endif /* V8 */
637c478bd9Sstevel@tonic-gate 
647c478bd9Sstevel@tonic-gate #include <stdio.h>
657c478bd9Sstevel@tonic-gate #include <ctype.h>
667c478bd9Sstevel@tonic-gate #include <setjmp.h>
677c478bd9Sstevel@tonic-gate #include <sys/param.h>
687c478bd9Sstevel@tonic-gate 
697c478bd9Sstevel@tonic-gate /*
707c478bd9Sstevel@tonic-gate  * param.h includes types.h and signal.h in 4bsd
717c478bd9Sstevel@tonic-gate  */
727c478bd9Sstevel@tonic-gate #ifdef V7
737c478bd9Sstevel@tonic-gate #include <sgtty.h>
747c478bd9Sstevel@tonic-gate #include <sys/timeb.h>
757c478bd9Sstevel@tonic-gate #else /* !V7 */
767c478bd9Sstevel@tonic-gate #include <termio.h>
777c478bd9Sstevel@tonic-gate #include <sys/types.h>
787c478bd9Sstevel@tonic-gate #include <signal.h>
797c478bd9Sstevel@tonic-gate #include <fcntl.h>
807c478bd9Sstevel@tonic-gate #endif
817c478bd9Sstevel@tonic-gate 
827c478bd9Sstevel@tonic-gate #include <sys/stat.h>
837c478bd9Sstevel@tonic-gate #include <utime.h>
847c478bd9Sstevel@tonic-gate #include <dirent.h>
857c478bd9Sstevel@tonic-gate 
867c478bd9Sstevel@tonic-gate #ifdef BSD4_2
877c478bd9Sstevel@tonic-gate #include <sys/time.h>
887c478bd9Sstevel@tonic-gate #else /* !BSD4_2 */
897c478bd9Sstevel@tonic-gate #include <time.h>
907c478bd9Sstevel@tonic-gate #endif
917c478bd9Sstevel@tonic-gate 
927c478bd9Sstevel@tonic-gate #include <sys/times.h>
937c478bd9Sstevel@tonic-gate #include <errno.h>
947c478bd9Sstevel@tonic-gate 
957c478bd9Sstevel@tonic-gate #ifdef ATTSV
967c478bd9Sstevel@tonic-gate #include <sys/mkdev.h>
977c478bd9Sstevel@tonic-gate #endif /* ATTSV */
987c478bd9Sstevel@tonic-gate 
997c478bd9Sstevel@tonic-gate #ifdef	RT
1007c478bd9Sstevel@tonic-gate #include "rt/types.h"
1017c478bd9Sstevel@tonic-gate #include "rt/unix/param.h"
1027c478bd9Sstevel@tonic-gate #include "rt/stat.h"
1037c478bd9Sstevel@tonic-gate #include <sys/ustat.h>
1047c478bd9Sstevel@tonic-gate #endif /* RT */
1057c478bd9Sstevel@tonic-gate 
1067c478bd9Sstevel@tonic-gate /* what mode should user files be allowed to have upon creation? */
1077c478bd9Sstevel@tonic-gate /* NOTE: This does not allow setuid or execute bits on transfer. */
108*3bb2c156SToomas Soome #define	LEGALMODE (mode_t)0666
1097c478bd9Sstevel@tonic-gate 
1107c478bd9Sstevel@tonic-gate /* what mode should public files have upon creation? */
111*3bb2c156SToomas Soome #define	PUB_FILEMODE (mode_t)0666
1127c478bd9Sstevel@tonic-gate 
1137c478bd9Sstevel@tonic-gate /* what mode should log files have upon creation? */
114*3bb2c156SToomas Soome #define	LOGFILEMODE (mode_t)0644
1157c478bd9Sstevel@tonic-gate 
1167c478bd9Sstevel@tonic-gate /* what mode should C. files have upon creation? */
117*3bb2c156SToomas Soome #define	CFILEMODE (mode_t)0644
1187c478bd9Sstevel@tonic-gate 
1197c478bd9Sstevel@tonic-gate /* what mode should D. files have upon creation? */
120*3bb2c156SToomas Soome #define	DFILEMODE (mode_t)0600
1217c478bd9Sstevel@tonic-gate 
1227c478bd9Sstevel@tonic-gate /* define the value of PUBMASK, used for creating "public" directories */
123*3bb2c156SToomas Soome #define	PUBMASK (mode_t)0000
1247c478bd9Sstevel@tonic-gate 
1257c478bd9Sstevel@tonic-gate /* what mode should public directories have upon creation? */
126*3bb2c156SToomas Soome #define	PUB_DIRMODE (mode_t)0777
1277c478bd9Sstevel@tonic-gate 
1287c478bd9Sstevel@tonic-gate /* define the value of DIRMASK, used for creating "system" subdirectories */
129*3bb2c156SToomas Soome #define	DIRMASK (mode_t)0022
1307c478bd9Sstevel@tonic-gate 
131*3bb2c156SToomas Soome #define	MAXSTART	300	/* how long to wait on startup */
1327c478bd9Sstevel@tonic-gate 
1337c478bd9Sstevel@tonic-gate /* define the last characters for ACU  (used for 801/212 dialers) */
134*3bb2c156SToomas Soome #define	ACULAST "<"
1357c478bd9Sstevel@tonic-gate 
136*3bb2c156SToomas Soome /*
137*3bb2c156SToomas Soome  *  caution - the following names are also in Makefile
1387c478bd9Sstevel@tonic-gate  *    any changes here have to also be made there
1397c478bd9Sstevel@tonic-gate  *
1407c478bd9Sstevel@tonic-gate  * it's a good idea to make directories .foo, since this ensures
1417c478bd9Sstevel@tonic-gate  * that they'll be ignored by processes that search subdirectories in SPOOL
1427c478bd9Sstevel@tonic-gate  *
1437c478bd9Sstevel@tonic-gate  *  XQTDIR=/var/uucp/.Xqtdir
1447c478bd9Sstevel@tonic-gate  *  CORRUPT=/var/uucp/.Corrupt
1457c478bd9Sstevel@tonic-gate  *  LOGDIR=/var/uucp/.Log
1467c478bd9Sstevel@tonic-gate  *  SEQDIR=/var/uucp/.Sequence
1477c478bd9Sstevel@tonic-gate  *  STATDIR=/var/uucp/.Status
148*3bb2c156SToomas Soome  *
1497c478bd9Sstevel@tonic-gate  */
1507c478bd9Sstevel@tonic-gate 
1517c478bd9Sstevel@tonic-gate /* where to put the STST. files? */
152*3bb2c156SToomas Soome #define	STATDIR		"/var/uucp/.Status"
1537c478bd9Sstevel@tonic-gate 
1547c478bd9Sstevel@tonic-gate /* where should logfiles be kept? */
155*3bb2c156SToomas Soome #define	LOGUUX		"/var/uucp/.Log/uux"
156*3bb2c156SToomas Soome #define	LOGUUXQT	"/var/uucp/.Log/uuxqt"
157*3bb2c156SToomas Soome #define	LOGUUCP		"/var/uucp/.Log/uucp"
158*3bb2c156SToomas Soome #define	LOGCICO		"/var/uucp/.Log/uucico"
159*3bb2c156SToomas Soome #define	CORRUPTDIR	"/var/uucp/.Corrupt"
1607c478bd9Sstevel@tonic-gate 
1617c478bd9Sstevel@tonic-gate /* some sites use /var/uucp/.XQTDIR here */
1627c478bd9Sstevel@tonic-gate /* use caution since things are linked into there */
163*3bb2c156SToomas Soome #define	XQTDIR		"/var/uucp/.Xqtdir"
1647c478bd9Sstevel@tonic-gate 
1657c478bd9Sstevel@tonic-gate /* how much of a system name can we print in a [CX]. file? */
1667c478bd9Sstevel@tonic-gate /* MAXBASENAME - 1 (pre) - 1 ('.') - 1 (grade) - 4 (sequence number) */
167*3bb2c156SToomas Soome #define	SYSNSIZE (MAXBASENAME - 7)
1687c478bd9Sstevel@tonic-gate 
1697c478bd9Sstevel@tonic-gate #ifdef USRSPOOLLOCKS
170*3bb2c156SToomas Soome #define	LOCKPRE		"/var/spool/locks/LCK."
1717c478bd9Sstevel@tonic-gate #else
172*3bb2c156SToomas Soome #define	LOCKPRE		"/var/spool/uucp/LCK."
1737c478bd9Sstevel@tonic-gate #endif /* USRSPOOLLOCKS */
1747c478bd9Sstevel@tonic-gate 
175*3bb2c156SToomas Soome #define	SQFILE		"/etc/uucp/SQFILE"
176*3bb2c156SToomas Soome #define	SQTMP		"/etc/uucp/SQTMP"
177*3bb2c156SToomas Soome #define	SLCKTIME	5400	/* system/device timeout (LCK.. files) */
178*3bb2c156SToomas Soome #define	DIALCODES	"/etc/uucp/Dialcodes"
179*3bb2c156SToomas Soome #define	PERMISSIONS	"/etc/uucp/Permissions"
1807c478bd9Sstevel@tonic-gate 
181*3bb2c156SToomas Soome #define	SPOOL		"/var/spool/uucp"
182*3bb2c156SToomas Soome #define	SEQDIR		"/var/uucp/.Sequence"
1837c478bd9Sstevel@tonic-gate 
184*3bb2c156SToomas Soome #define	X_LOCKTIME	3600
1857c478bd9Sstevel@tonic-gate #ifdef USRSPOOLLOCKS
186*3bb2c156SToomas Soome #define	SEQLOCK		"/var/spool/locks/LCK.SQ."
187*3bb2c156SToomas Soome #define	SQLOCK		"/var/spool/locks/LCK.SQ"
188*3bb2c156SToomas Soome #define	X_LOCK		"/var/spool/locks/LCK.X"
189*3bb2c156SToomas Soome #define	S_LOCK		"/var/spool/locks/LCK.S"
190*3bb2c156SToomas Soome #define	L_LOCK		"/var/spool/locks/LK"
191*3bb2c156SToomas Soome #define	X_LOCKDIR	"/var/spool/locks"	/* must be dir part of above */
1927c478bd9Sstevel@tonic-gate #else
193*3bb2c156SToomas Soome #define	SEQLOCK		"/var/spool/uucp/LCK.SQ."
194*3bb2c156SToomas Soome #define	SQLOCK		"/var/spool/uucp/LCK.SQ"
195*3bb2c156SToomas Soome #define	X_LOCK		"/var/spool/uucp/LCK.X"
196*3bb2c156SToomas Soome #define	S_LOCK		"/var/spool/uucp/LCK.S"
197*3bb2c156SToomas Soome #define	L_LOCK		"/var/spool/uucp/LK"
198*3bb2c156SToomas Soome #define	X_LOCKDIR	"/var/spool/uucp"	/* must be dir part of above */
1997c478bd9Sstevel@tonic-gate #endif /* USRSPOOLLOCKS */
200*3bb2c156SToomas Soome #define	X_LOCKPRE	"LCK.X"		/* must be last part of above */
201*3bb2c156SToomas Soome 
202*3bb2c156SToomas Soome #define	PUBDIR		"/var/spool/uucppublic"
203*3bb2c156SToomas Soome #define	ADMIN		"/var/uucp/.Admin"
204*3bb2c156SToomas Soome #define	ERRLOG		"/var/uucp/.Admin/errors"
205*3bb2c156SToomas Soome #define	SYSLOG		"/var/uucp/.Admin/xferstats"
206*3bb2c156SToomas Soome #define	RMTDEBUG	"/var/uucp/.Admin/audit"
207*3bb2c156SToomas Soome #define	CLEANUPLOGFILE	"/var/uucp/.Admin/uucleanup"
208*3bb2c156SToomas Soome #define	CMDLOG		"/var/uucp/.Admin/command"
209*3bb2c156SToomas Soome #define	PERFLOG		"/var/uucp/.Admin/perflog"
210*3bb2c156SToomas Soome #define	ACCOUNT		"/var/uucp/.Admin/account"
211*3bb2c156SToomas Soome #define	SECURITY	"/var/uucp/.Admin/security"
2127c478bd9Sstevel@tonic-gate 
2137c478bd9Sstevel@tonic-gate #define	WORKSPACE	"/var/uucp/.Workspace"
2147c478bd9Sstevel@tonic-gate 
215*3bb2c156SToomas Soome #define	SQTIME		60
216*3bb2c156SToomas Soome #define	TRYCALLS	2	/* number of tries to dial call */
217*3bb2c156SToomas Soome #define	MINULIMIT	(1L<<11)	/* minimum reasonable ulimit */
2187c478bd9Sstevel@tonic-gate #define	MAX_LOCKTRY	5	/* number of attempts to lock device */
2197c478bd9Sstevel@tonic-gate 
2207c478bd9Sstevel@tonic-gate /*
221*3bb2c156SToomas Soome  * CDEBUG is for communication line debugging
222*3bb2c156SToomas Soome  * DEBUG is for program debugging
2237c478bd9Sstevel@tonic-gate  * #define SMALL to compile without the DEBUG code
2247c478bd9Sstevel@tonic-gate  */
2257c478bd9Sstevel@tonic-gate 
2267c478bd9Sstevel@tonic-gate #ifndef DIAL
227*3bb2c156SToomas Soome #define	CDEBUG(l, f, s) if (Debug >= l) (void)fprintf(stderr, f, s)
2287c478bd9Sstevel@tonic-gate #else
229*3bb2c156SToomas Soome #define	CDEBUG(l, f, s)
230*3bb2c156SToomas Soome #define	SMALL
2317c478bd9Sstevel@tonic-gate #endif
2327c478bd9Sstevel@tonic-gate 
2337c478bd9Sstevel@tonic-gate #ifndef SMALL
234*3bb2c156SToomas Soome #define	DEBUG(l, f, s) if (Debug >= l) (void)fprintf(stderr, f, s)
2357c478bd9Sstevel@tonic-gate #else
236*3bb2c156SToomas Soome #define	DEBUG(l, f, s)
2377c478bd9Sstevel@tonic-gate #endif /* SMALL */
2387c478bd9Sstevel@tonic-gate 
2397c478bd9Sstevel@tonic-gate /*
2407c478bd9Sstevel@tonic-gate  * VERBOSE is used by cu and ct to inform the user of progress
2417c478bd9Sstevel@tonic-gate  * In other programs, the Value of Verbose is always 0.
2427c478bd9Sstevel@tonic-gate  */
243*3bb2c156SToomas Soome #define	VERBOSE(f, s) { if (Verbose > 0) (void)fprintf(stderr, f, s); }
244*3bb2c156SToomas Soome 
245*3bb2c156SToomas Soome #define	PREFIX(pre, str)	(strncmp((pre), (str), strlen(pre)) == SAME)
246*3bb2c156SToomas Soome #define	BASENAME(str, c) ((Bnptr = strrchr((str), c)) ? (Bnptr + 1) : (str))
247*3bb2c156SToomas Soome #define	EQUALS(a, b)	\
248*3bb2c156SToomas Soome 	((a != CNULL) && (b != CNULL) && (strcmp((a), (b)) == SAME))
249*3bb2c156SToomas Soome #define	EQUALSN(a, b, n)	\
250*3bb2c156SToomas Soome 	((a != CNULL) && (b != CNULL) && (strncmp((a), (b), (n)) == SAME))
251*3bb2c156SToomas Soome #define	LASTCHAR(s)	(s + strlen(s) - 1)
252*3bb2c156SToomas Soome 
253*3bb2c156SToomas Soome #define	SAME 0
254*3bb2c156SToomas Soome #define	ANYREAD 04
255*3bb2c156SToomas Soome #define	ANYWRITE 02
256*3bb2c156SToomas Soome #define	FAIL -1
257*3bb2c156SToomas Soome #define	SUCCESS 0
258*3bb2c156SToomas Soome #define	NULLCHAR	'\0'
259*3bb2c156SToomas Soome #define	CNULL NULL
260*3bb2c156SToomas Soome #define	STBNULL NULL
261*3bb2c156SToomas Soome #define	MASTER 1
262*3bb2c156SToomas Soome #define	SLAVE 0
263*3bb2c156SToomas Soome #define	MAXBASENAME 14 /* should be DIRSIZ but that is now fs dependent */
264*3bb2c156SToomas Soome #define	MAXFULLNAME BUFSIZ
265*3bb2c156SToomas Soome #define	MAXNAMESIZE	64	/* /var/spool/uucp/<14 chars>/<14 chars>+slop */
266*3bb2c156SToomas Soome #define	CONNECTTIME 30
267*3bb2c156SToomas Soome #define	EXPECTTIME 45
268*3bb2c156SToomas Soome #define	MSGTIME 60
269*3bb2c156SToomas Soome #define	NAMESIZE MAXBASENAME+1
2707c478bd9Sstevel@tonic-gate #define	SIZEOFPID	10		/* maximum number of digits in a pid */
271*3bb2c156SToomas Soome #define	EOTMSG "\004\n\004\n"
272*3bb2c156SToomas Soome #define	CALLBACK 1
2737c478bd9Sstevel@tonic-gate 
2747c478bd9Sstevel@tonic-gate /* manifests for sysfiles.c's sysaccess()	*/
2757c478bd9Sstevel@tonic-gate /* check file access for REAL user id */
2767c478bd9Sstevel@tonic-gate #define	ACCESS_SYSTEMS	1
2777c478bd9Sstevel@tonic-gate #define	ACCESS_DEVICES	2
2787c478bd9Sstevel@tonic-gate #define	ACCESS_DIALERS	3
2797c478bd9Sstevel@tonic-gate /* check file access for EFFECTIVE user id */
2807c478bd9Sstevel@tonic-gate #define	EACCESS_SYSTEMS	4
2817c478bd9Sstevel@tonic-gate #define	EACCESS_DEVICES	5
2827c478bd9Sstevel@tonic-gate #define	EACCESS_DIALERS	6
2837c478bd9Sstevel@tonic-gate 
2847c478bd9Sstevel@tonic-gate /* manifest for chkpth flag */
285*3bb2c156SToomas Soome #define	CK_READ		0
286*3bb2c156SToomas Soome #define	CK_WRITE	1
2877c478bd9Sstevel@tonic-gate 
2887c478bd9Sstevel@tonic-gate /*
2897c478bd9Sstevel@tonic-gate  * commands
2907c478bd9Sstevel@tonic-gate  */
291*3bb2c156SToomas Soome #define	SHELL		"/usr/bin/sh"
292*3bb2c156SToomas Soome #define	MAIL		"mail"
293*3bb2c156SToomas Soome #define	UUCICO		"/usr/lib/uucp/uucico"
294*3bb2c156SToomas Soome #define	UUXQT		"/usr/lib/uucp/uuxqt"
295*3bb2c156SToomas Soome #define	UUX		"/usr/bin/uux"
296*3bb2c156SToomas Soome #define	UUCP		"/usr/bin/uucp"
2977c478bd9Sstevel@tonic-gate 
2987c478bd9Sstevel@tonic-gate 
2997c478bd9Sstevel@tonic-gate /* system status stuff */
300*3bb2c156SToomas Soome #define	SS_OK			0
301*3bb2c156SToomas Soome #define	SS_NO_DEVICE		1
302*3bb2c156SToomas Soome #define	SS_TIME_WRONG		2
303*3bb2c156SToomas Soome #define	SS_INPROGRESS		3
304*3bb2c156SToomas Soome #define	SS_CONVERSATION		4
305*3bb2c156SToomas Soome #define	SS_SEQBAD		5
306*3bb2c156SToomas Soome #define	SS_LOGIN_FAILED		6
307*3bb2c156SToomas Soome #define	SS_DIAL_FAILED		7
308*3bb2c156SToomas Soome #define	SS_BAD_LOG_MCH		8
309*3bb2c156SToomas Soome #define	SS_LOCKED_DEVICE	9
310*3bb2c156SToomas Soome #define	SS_ASSERT_ERROR		10
311*3bb2c156SToomas Soome #define	SS_BADSYSTEM		11
312*3bb2c156SToomas Soome #define	SS_CANT_ACCESS_DEVICE	12
313*3bb2c156SToomas Soome #define	SS_DEVICE_FAILED	13	/* used for interface failure */
314*3bb2c156SToomas Soome #define	SS_WRONG_MCH		14
315*3bb2c156SToomas Soome #define	SS_CALLBACK		15
316*3bb2c156SToomas Soome #define	SS_RLOCKED		16
317*3bb2c156SToomas Soome #define	SS_RUNKNOWN		17
318*3bb2c156SToomas Soome #define	SS_RLOGIN		18
319*3bb2c156SToomas Soome #define	SS_UNKNOWN_RESPONSE	19
320*3bb2c156SToomas Soome #define	SS_STARTUP		20
321*3bb2c156SToomas Soome #define	SS_CHAT_FAILED		21
322*3bb2c156SToomas Soome #define	SS_CALLBACK_LOOP	22
323*3bb2c156SToomas Soome 
324*3bb2c156SToomas Soome #define	MAXPH	60	/* maximum phone string size */
3257c478bd9Sstevel@tonic-gate #define	MAXC	BUFSIZ
3267c478bd9Sstevel@tonic-gate 
3277c478bd9Sstevel@tonic-gate #define	TRUE	1
3287c478bd9Sstevel@tonic-gate #define	FALSE	0
329*3bb2c156SToomas Soome #define	NAMEBUF	32
3307c478bd9Sstevel@tonic-gate 
3317c478bd9Sstevel@tonic-gate /* The call structure is used by ct.c, cu.c, and dial.c.	*/
3327c478bd9Sstevel@tonic-gate 
3337c478bd9Sstevel@tonic-gate struct call {
3347c478bd9Sstevel@tonic-gate 	char *speed;		/* transmission baud rate */
3357c478bd9Sstevel@tonic-gate 	char *line;		/* device name for outgoing line */
3367c478bd9Sstevel@tonic-gate 	char *telno;		/* ptr to tel-no digit string */
3377c478bd9Sstevel@tonic-gate 	char *type;		/* type of device to use for call. */
3387c478bd9Sstevel@tonic-gate };
3397c478bd9Sstevel@tonic-gate 
3407c478bd9Sstevel@tonic-gate /* structure of an Systems file line */
341*3bb2c156SToomas Soome #define	F_MAX	50	/* max number of fields in Systems file line */
342*3bb2c156SToomas Soome #define	F_NAME 0
343*3bb2c156SToomas Soome #define	F_TIME 1
344*3bb2c156SToomas Soome #define	F_TYPE 2
345*3bb2c156SToomas Soome #define	F_CLASS 3	/* an optional prefix and the speed */
346*3bb2c156SToomas Soome #define	F_PHONE 4
347*3bb2c156SToomas Soome #define	F_LOGIN 5
3487c478bd9Sstevel@tonic-gate 
3497c478bd9Sstevel@tonic-gate /* structure of an Devices file line */
350*3bb2c156SToomas Soome #define	D_TYPE 0
351*3bb2c156SToomas Soome #define	D_LINE 1
352*3bb2c156SToomas Soome #define	D_CALLDEV 2
353*3bb2c156SToomas Soome #define	D_CLASS 3
354*3bb2c156SToomas Soome #define	D_CALLER 4
355*3bb2c156SToomas Soome #define	D_ARG 5
356*3bb2c156SToomas Soome #define	D_MAX	50	/* max number of fields in Devices file line */
3577c478bd9Sstevel@tonic-gate 
358*3bb2c156SToomas Soome #define	D_ACU 1
359*3bb2c156SToomas Soome #define	D_DIRECT 2
360*3bb2c156SToomas Soome #define	D_PROT 4
3617c478bd9Sstevel@tonic-gate 
362*3bb2c156SToomas Soome #define	GRADES "/etc/uucp/Grades"
3637c478bd9Sstevel@tonic-gate 
3647c478bd9Sstevel@tonic-gate #define	D_QUEUE	'Z'	/* default queue */
3657c478bd9Sstevel@tonic-gate 
3667c478bd9Sstevel@tonic-gate /* past here, local changes are not recommended */
367*3bb2c156SToomas Soome #define	CMDPRE		'C'
368*3bb2c156SToomas Soome #define	DATAPRE		'D'
369*3bb2c156SToomas Soome #define	XQTPRE		'X'
3707c478bd9Sstevel@tonic-gate 
3717c478bd9Sstevel@tonic-gate /*
3727c478bd9Sstevel@tonic-gate  * stuff for command execution
3737c478bd9Sstevel@tonic-gate  */
374*3bb2c156SToomas Soome #define	X_RQDFILE	'F'
375*3bb2c156SToomas Soome #define	X_STDIN		'I'
376*3bb2c156SToomas Soome #define	X_STDOUT	'O'
377*3bb2c156SToomas Soome #define	X_STDERR	'E'
378*3bb2c156SToomas Soome #define	X_CMD		'C'
379*3bb2c156SToomas Soome #define	X_USER		'U'
380*3bb2c156SToomas Soome #define	X_BRINGBACK	'B'
381*3bb2c156SToomas Soome #define	X_MAILF		'M'
382*3bb2c156SToomas Soome #define	X_RETADDR	'R'
383*3bb2c156SToomas Soome #define	X_COMMENT	'#'
384*3bb2c156SToomas Soome #define	X_NONZERO	'Z'
385*3bb2c156SToomas Soome #define	X_SENDNOTHING	'N'
386*3bb2c156SToomas Soome #define	X_SENDZERO	'n'
3877c478bd9Sstevel@tonic-gate 
3887c478bd9Sstevel@tonic-gate 
3897c478bd9Sstevel@tonic-gate /* This structure describes call routines */
3907c478bd9Sstevel@tonic-gate struct caller {
3917c478bd9Sstevel@tonic-gate 	char	*CA_type;
3927c478bd9Sstevel@tonic-gate 	int	(*CA_caller)();
3937c478bd9Sstevel@tonic-gate };
3947c478bd9Sstevel@tonic-gate 
3957c478bd9Sstevel@tonic-gate /* structure for a saved C file */
3967c478bd9Sstevel@tonic-gate 
3977c478bd9Sstevel@tonic-gate struct cs_struct {
3987c478bd9Sstevel@tonic-gate 	char	file[NAMESIZE];
3997c478bd9Sstevel@tonic-gate 	char	sys[NAMESIZE+5];
4007c478bd9Sstevel@tonic-gate 	char	sgrade[NAMESIZE];
4017c478bd9Sstevel@tonic-gate 	char	grade;
4027c478bd9Sstevel@tonic-gate 	long	jsize;
4037c478bd9Sstevel@tonic-gate };
4047c478bd9Sstevel@tonic-gate 
4057c478bd9Sstevel@tonic-gate /* This structure describes dialing routines */
4067c478bd9Sstevel@tonic-gate struct dialer {
4077c478bd9Sstevel@tonic-gate 	char	*DI_type;
4087c478bd9Sstevel@tonic-gate 	int	(*DI_dialer)();
4097c478bd9Sstevel@tonic-gate };
4107c478bd9Sstevel@tonic-gate 
4117c478bd9Sstevel@tonic-gate struct nstat {
4127c478bd9Sstevel@tonic-gate 	pid_t	t_pid;		/* process id				*/
4137c478bd9Sstevel@tonic-gate 	time_t	t_start;	/* start time				*/
4147c478bd9Sstevel@tonic-gate 	time_t	t_scall;	/* start call to system			*/
4157c478bd9Sstevel@tonic-gate 	time_t	t_ecall;	/* end call to system			*/
4167c478bd9Sstevel@tonic-gate 	time_t	t_tacu;		/* acu time				*/
4177c478bd9Sstevel@tonic-gate 	time_t	t_tlog;		/* login time				*/
4187c478bd9Sstevel@tonic-gate 	time_t	t_sftp;		/* start file transfer protocol		*/
419*3bb2c156SToomas Soome 	time_t	t_sxf;		/* start xfer				*/
420*3bb2c156SToomas Soome 	time_t	t_exf;		/* end xfer				*/
4217c478bd9Sstevel@tonic-gate 	time_t	t_eftp;		/* end file transfer protocol		*/
4227c478bd9Sstevel@tonic-gate 	time_t	t_qtime;	/* time file queued			*/
4237c478bd9Sstevel@tonic-gate 	int	t_ndial;	/* # of dials				*/
4247c478bd9Sstevel@tonic-gate 	int	t_nlogs;	/* # of login trys			*/
4257c478bd9Sstevel@tonic-gate 	struct tms t_tbb;	/* start execution times		*/
4267c478bd9Sstevel@tonic-gate 	struct tms t_txfs;	/* xfer start times			*/
427*3bb2c156SToomas Soome 	struct tms t_txfe;	/* xfer end times			*/
4287c478bd9Sstevel@tonic-gate 	struct tms t_tga;	/* garbage execution times		*/
4297c478bd9Sstevel@tonic-gate };
4307c478bd9Sstevel@tonic-gate 
4317c478bd9Sstevel@tonic-gate /* This structure describes the values from Limits file */
4327c478bd9Sstevel@tonic-gate struct limits {
4337c478bd9Sstevel@tonic-gate 	int	totalmax;	/* overall limit */
4347c478bd9Sstevel@tonic-gate 	int	sitemax;	/* limit per site */
4357c478bd9Sstevel@tonic-gate 	char	mode[64];	/* uucico mode */
4367c478bd9Sstevel@tonic-gate };
4377c478bd9Sstevel@tonic-gate 
4387c478bd9Sstevel@tonic-gate /* external declarations */
4397c478bd9Sstevel@tonic-gate 
4407c478bd9Sstevel@tonic-gate EXTERN int (*Read)(), (*Write)();
441*3bb2c156SToomas Soome EXTERN int (*Ioctl)(int, int, ...);
4427c478bd9Sstevel@tonic-gate EXTERN int Ifn, Ofn;
4437c478bd9Sstevel@tonic-gate EXTERN int Debug, Verbose;
4447c478bd9Sstevel@tonic-gate EXTERN uid_t Uid, Euid;		/* user-id and effective-uid */
4457c478bd9Sstevel@tonic-gate EXTERN long Ulimit;
4467c478bd9Sstevel@tonic-gate EXTERN mode_t Dev_mode;		/* save device mode here */
4477c478bd9Sstevel@tonic-gate EXTERN char Wrkdir[];
4487c478bd9Sstevel@tonic-gate EXTERN long Retrytime;
4497c478bd9Sstevel@tonic-gate EXTERN char **Env;
4507c478bd9Sstevel@tonic-gate EXTERN char Uucp[];
4517c478bd9Sstevel@tonic-gate EXTERN char Pchar;
4527c478bd9Sstevel@tonic-gate EXTERN struct nstat Nstat;
4537c478bd9Sstevel@tonic-gate EXTERN char Dc[];			/* line name			*/
4547c478bd9Sstevel@tonic-gate EXTERN int Seqn;			/* sequence #			*/
4557c478bd9Sstevel@tonic-gate EXTERN int Role;
456*3bb2c156SToomas Soome EXTERN int Sgrades;	/* flag for administrator defined service grades */
4577c478bd9Sstevel@tonic-gate EXTERN char Grade;
4587c478bd9Sstevel@tonic-gate EXTERN char Logfile[];
4597c478bd9Sstevel@tonic-gate EXTERN char Rmtname[];
4607c478bd9Sstevel@tonic-gate EXTERN char JobGrade[];
4617c478bd9Sstevel@tonic-gate EXTERN char User[];
4627c478bd9Sstevel@tonic-gate EXTERN char Loginuser[];
4637c478bd9Sstevel@tonic-gate EXTERN char *Spool;
4647c478bd9Sstevel@tonic-gate EXTERN char *Pubdir;
4657c478bd9Sstevel@tonic-gate EXTERN char Myname[];
4667c478bd9Sstevel@tonic-gate EXTERN char Progname[];
4677c478bd9Sstevel@tonic-gate EXTERN char RemSpool[];
4687c478bd9Sstevel@tonic-gate EXTERN char *Bnptr;		/* used when BASENAME macro is expanded */
4697c478bd9Sstevel@tonic-gate EXTERN int SizeCheck;		/* ulimit check supported flag */
4707c478bd9Sstevel@tonic-gate EXTERN long RemUlimit;		/* remote ulimit if supported */
4717c478bd9Sstevel@tonic-gate EXTERN int Restart;		/* checkpoint restart supported flag */
4727c478bd9Sstevel@tonic-gate 
4737c478bd9Sstevel@tonic-gate EXTERN char Jobid[];		/* Jobid of current C. file */
4747c478bd9Sstevel@tonic-gate EXTERN int Uerror;		/* global error code */
4757c478bd9Sstevel@tonic-gate EXTERN char *UerrorText[];	/* text for error code */
4767c478bd9Sstevel@tonic-gate 
477*3bb2c156SToomas Soome #define	UERRORTEXT		UerrorText[Uerror]
478*3bb2c156SToomas Soome #define	UTEXT(x)		UerrorText[x]
4797c478bd9Sstevel@tonic-gate 
4807c478bd9Sstevel@tonic-gate /* things get kind of tricky beyond this point -- please stay out */
4817c478bd9Sstevel@tonic-gate 
4827c478bd9Sstevel@tonic-gate #ifdef ATTSV
483*3bb2c156SToomas Soome #define	index strchr
484*3bb2c156SToomas Soome #define	rindex strrchr
485*3bb2c156SToomas Soome #define	vfork fork
486*3bb2c156SToomas Soome #define	ATTSVKILL
487*3bb2c156SToomas Soome #define	UNAME
4887c478bd9Sstevel@tonic-gate #else
489*3bb2c156SToomas Soome #define	strchr index
490*3bb2c156SToomas Soome #define	strrchr rindex
4917c478bd9Sstevel@tonic-gate #endif
4927c478bd9Sstevel@tonic-gate 
4937c478bd9Sstevel@tonic-gate EXTERN struct stat __s_;
494*3bb2c156SToomas Soome #define	READANY(f)	\
495*3bb2c156SToomas Soome 	((stat((f), &__s_) == 0) && ((__s_.st_mode & (0004)) != 0))
496*3bb2c156SToomas Soome #define	READSOME(f)	\
497*3bb2c156SToomas Soome 	((stat((f), &__s_) == 0) && ((__s_.st_mode & (0444)) != 0))
498*3bb2c156SToomas Soome #define	WRITEANY(f)	\
499*3bb2c156SToomas Soome 	((stat((f), &__s_) == 0) && ((__s_.st_mode & (0002)) != 0))
500*3bb2c156SToomas Soome #define	DIRECTORY(f)	\
501*3bb2c156SToomas Soome 	((stat((f), &__s_) == 0) && ((__s_.st_mode & (S_IFMT)) == S_IFDIR))
502*3bb2c156SToomas Soome #define	NOTEMPTY(f)	((stat((f), &__s_) == 0) && (__s_.st_size != 0))
5037c478bd9Sstevel@tonic-gate 
5047c478bd9Sstevel@tonic-gate /* uucp functions and subroutine */
5057c478bd9Sstevel@tonic-gate EXTERN void	(*genbrk)();
5067c478bd9Sstevel@tonic-gate extern int	iswrk(), gtwvec();			/* anlwrk.c */
5077c478bd9Sstevel@tonic-gate extern void	findgrade();				/* grades.c */
5087c478bd9Sstevel@tonic-gate extern void	chremdir(), mkremdir();			/* chremdir.c */
5097c478bd9Sstevel@tonic-gate extern void	toCorrupt();				/* cpmv.c  */
5107c478bd9Sstevel@tonic-gate extern int	xmv();					/* cpmv.c  */
5117c478bd9Sstevel@tonic-gate 
5127c478bd9Sstevel@tonic-gate EXTERN int	getargs();				/* getargs.c */
5137c478bd9Sstevel@tonic-gate EXTERN void	bsfix();				/* getargs.c */
5147c478bd9Sstevel@tonic-gate extern char	*getprm();				/* getprm.c */
5157c478bd9Sstevel@tonic-gate 
5167c478bd9Sstevel@tonic-gate extern char	*next_token();				/* permission.c */
5177c478bd9Sstevel@tonic-gate extern char	*nextarg();				/* permission.c */
5187c478bd9Sstevel@tonic-gate extern int	getuline();				/* permission.c */
5197c478bd9Sstevel@tonic-gate 
5207c478bd9Sstevel@tonic-gate EXTERN void	logent(), syslog(), closelog();		/* logent.c */
5217c478bd9Sstevel@tonic-gate extern void	commandlog();				/* logent.c */
5227c478bd9Sstevel@tonic-gate extern time_t	millitick();				/* logent.c */
5237c478bd9Sstevel@tonic-gate 
5247c478bd9Sstevel@tonic-gate extern unsigned long	getfilesize();			/* statlog.c */
525*3bb2c156SToomas Soome extern void		putfilesize();			/* statlog.c */
5267c478bd9Sstevel@tonic-gate 
5277c478bd9Sstevel@tonic-gate EXTERN char	*protoString();				/* permission.c */
5287c478bd9Sstevel@tonic-gate extern int	logFind(), mchFind();			/* permission.c */
5297c478bd9Sstevel@tonic-gate extern int	chkperm(), chkpth();			/* permission.c */
5307c478bd9Sstevel@tonic-gate extern int	cmdOK(), switchRole();			/* permission.c */
5317c478bd9Sstevel@tonic-gate extern int	callBack(), requestOK();		/* permission.c */
5327c478bd9Sstevel@tonic-gate extern int	noSpool();				/* permission.c */
5337c478bd9Sstevel@tonic-gate extern void	myName();				/* permission.c */
5347c478bd9Sstevel@tonic-gate 
5357c478bd9Sstevel@tonic-gate extern int	mkdirs();				/* expfile.c */
5367c478bd9Sstevel@tonic-gate extern int	scanlimit();				/* limits.c */
5377c478bd9Sstevel@tonic-gate extern void	systat();				/* systat.c */
5387c478bd9Sstevel@tonic-gate EXTERN int	fd_mklock(), fd_cklock();		/* ulockf.c */
5397c478bd9Sstevel@tonic-gate EXTERN int	fn_cklock();				/* ulockf.c */
5407c478bd9Sstevel@tonic-gate EXTERN int	mklock(), cklock(), mlock();		/* ulockf.c */
5417c478bd9Sstevel@tonic-gate EXTERN void	fd_rmlock(), delock(), rmlock();	/* ulockf.c */
5427c478bd9Sstevel@tonic-gate extern char	*timeStamp();				/* utility.c */
5437c478bd9Sstevel@tonic-gate EXTERN void	assert(), errent();			/* utility.c */
5447c478bd9Sstevel@tonic-gate extern void	uucpname();				/* uucpname.c */
5457c478bd9Sstevel@tonic-gate extern int	versys();				/* versys.c */
5467c478bd9Sstevel@tonic-gate extern void	xuuxqt(), xuucico();			/* xqt.c */
5477c478bd9Sstevel@tonic-gate EXTERN void	cleanup();				/* misc main.c */
5487c478bd9Sstevel@tonic-gate 
549*3bb2c156SToomas Soome #define	ASSERT(e, s1, s2, i1) if (!(e)) {\
5507c478bd9Sstevel@tonic-gate 	assert(s1, s2, i1, __FILE__, __LINE__);\
551*3bb2c156SToomas Soome 	cleanup(FAIL); };
5527c478bd9Sstevel@tonic-gate 
5537c478bd9Sstevel@tonic-gate #ifdef ATTSV
5547c478bd9Sstevel@tonic-gate unsigned	sleep();
5557c478bd9Sstevel@tonic-gate void	exit(), setbuf();
5567c478bd9Sstevel@tonic-gate long	ulimit();
5577c478bd9Sstevel@tonic-gate #else /* !ATTSV */
5587c478bd9Sstevel@tonic-gate int	sleep(), exit(), setbuf(), ftime();
5597c478bd9Sstevel@tonic-gate #endif
5607c478bd9Sstevel@tonic-gate 
5617c478bd9Sstevel@tonic-gate #ifdef UNAME
5627c478bd9Sstevel@tonic-gate #include <sys/utsname.h>
5637c478bd9Sstevel@tonic-gate #endif /* UNAME */
5647c478bd9Sstevel@tonic-gate 
5657c478bd9Sstevel@tonic-gate #ifndef NOUSTAT
5667c478bd9Sstevel@tonic-gate #ifdef V7USTAT
5677c478bd9Sstevel@tonic-gate struct  ustat {
5687c478bd9Sstevel@tonic-gate 	daddr_t	f_tfree;	/* total free */
5697c478bd9Sstevel@tonic-gate 	ino_t	f_tinode;	/* total inodes free */
5707c478bd9Sstevel@tonic-gate };
5717c478bd9Sstevel@tonic-gate #else /* !NOUSTAT && !V7USTAT */
5727c478bd9Sstevel@tonic-gate #include <ustat.h>
5737c478bd9Sstevel@tonic-gate #endif /* V7USTAT */
5747c478bd9Sstevel@tonic-gate #endif /* NOUSTAT */
5757c478bd9Sstevel@tonic-gate 
5767c478bd9Sstevel@tonic-gate #ifdef BSD4_2
5777c478bd9Sstevel@tonic-gate char *gethostname();
5787c478bd9Sstevel@tonic-gate #endif /* BSD4_2 */
5797c478bd9Sstevel@tonic-gate 
5807c478bd9Sstevel@tonic-gate /* messages */
5817c478bd9Sstevel@tonic-gate EXTERN char *Ct_OPEN;
5827c478bd9Sstevel@tonic-gate EXTERN char *Ct_WRITE;
5837c478bd9Sstevel@tonic-gate EXTERN char *Ct_READ;
5847c478bd9Sstevel@tonic-gate EXTERN char *Ct_CREATE;
5857c478bd9Sstevel@tonic-gate EXTERN char *Ct_ALLOCATE;
5867c478bd9Sstevel@tonic-gate EXTERN char *Ct_LOCK;
5877c478bd9Sstevel@tonic-gate EXTERN char *Ct_STAT;
5887c478bd9Sstevel@tonic-gate EXTERN char *Ct_CHOWN;
5897c478bd9Sstevel@tonic-gate EXTERN char *Ct_CHMOD;
5907c478bd9Sstevel@tonic-gate EXTERN char *Ct_LINK;
5917c478bd9Sstevel@tonic-gate EXTERN char *Ct_CHDIR;
5927c478bd9Sstevel@tonic-gate EXTERN char *Ct_UNLINK;
5937c478bd9Sstevel@tonic-gate EXTERN char *Wr_ROLE;
5947c478bd9Sstevel@tonic-gate EXTERN char *Ct_CORRUPT;
5957c478bd9Sstevel@tonic-gate EXTERN char *Ct_FORK;
5967c478bd9Sstevel@tonic-gate EXTERN char *Ct_CLOSE;
5977c478bd9Sstevel@tonic-gate EXTERN char *Ct_BADOWN;
5987c478bd9Sstevel@tonic-gate EXTERN char *Fl_EXISTS;
5997c478bd9Sstevel@tonic-gate 
600ace1a5f1Sdp #ifdef __cplusplus
601ace1a5f1Sdp }
6027c478bd9Sstevel@tonic-gate #endif
603ace1a5f1Sdp 
604ace1a5f1Sdp #endif /* _UUCP_H */
605