#ifndef _UUCP_H
#define _UUCP_H
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <parms.h>
#include <stdio.h>
#include <ctype.h>
#include <setjmp.h>
#include <sys/param.h>
#include <termio.h>
#include <signal.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <utime.h>
#include <dirent.h>
#include <time.h>
#include <sys/times.h>
#include <errno.h>
#include <sys/mkdev.h>
#include <strings.h>
#include <ulimit.h>
#include <sys/utsname.h>
#include <ustat.h>
#ifdef __cplusplus
extern "C" {
#endif
#define LEGALMODE (mode_t)0666
#define PUB_FILEMODE (mode_t)0666
#define LOGFILEMODE (mode_t)0644
#define CFILEMODE (mode_t)0644
#define DFILEMODE (mode_t)0600
#define PUBMASK (mode_t)0000
#define PUB_DIRMODE (mode_t)0777
#define DIRMASK (mode_t)0022
#define MAXSTART 300
#define ACULAST "<"
#define STATDIR (const char *)"/var/uucp/.Status"
#define LOGUUX (const char *)"/var/uucp/.Log/uux"
#define LOGUUXQT (const char *)"/var/uucp/.Log/uuxqt"
#define LOGUUCP (const char *)"/var/uucp/.Log/uucp"
#define LOGCICO (const char *)"/var/uucp/.Log/uucico"
#define CORRUPTDIR (const char *)"/var/uucp/.Corrupt"
#define XQTDIR (const char *)"/var/uucp/.Xqtdir"
#define SYSNSIZE (MAXBASENAME - 7)
#ifdef USRSPOOLLOCKS
#define LOCKPRE (const char *)"/var/spool/locks/LCK."
#else
#define LOCKPRE (const char *)"/var/spool/uucp/LCK."
#endif
#define SQFILE (const char *)"/etc/uucp/SQFILE"
#define SQTMP (const char *)"/etc/uucp/SQTMP"
#define SLCKTIME 5400
#define DIALCODES (const char *)"/etc/uucp/Dialcodes"
#define PERMISSIONS (const char *)"/etc/uucp/Permissions"
#define SPOOL (const char *)"/var/spool/uucp"
#define SEQDIR (const char *)"/var/uucp/.Sequence"
#define X_LOCKTIME 3600
#ifdef USRSPOOLLOCKS
#define SEQLOCK (const char *)"/var/spool/locks/LCK.SQ."
#define SQLOCK (const char *)"/var/spool/locks/LCK.SQ"
#define X_LOCK (const char *)"/var/spool/locks/LCK.X"
#define S_LOCK (const char *)"/var/spool/locks/LCK.S"
#define L_LOCK (const char *)"/var/spool/locks/LK"
#define X_LOCKDIR (const char *)"/var/spool/locks"
#else
#define SEQLOCK (const char *)"/var/spool/uucp/LCK.SQ."
#define SQLOCK (const char *)"/var/spool/uucp/LCK.SQ"
#define X_LOCK (const char *)"/var/spool/uucp/LCK.X"
#define S_LOCK (const char *)"/var/spool/uucp/LCK.S"
#define L_LOCK (const char *)"/var/spool/uucp/LK"
#define X_LOCKDIR (const char *)"/var/spool/uucp"
#endif
#define X_LOCKPRE (const char *)"LCK.X"
#define PUBDIR (const char *)"/var/spool/uucppublic"
#define ADMIN (const char *)"/var/uucp/.Admin"
#define ERRLOG (const char *)"/var/uucp/.Admin/errors"
#define SYSLOG (const char *)"/var/uucp/.Admin/xferstats"
#define RMTDEBUG (const char *)"/var/uucp/.Admin/audit"
#define CLEANUPLOGFILE (const char *)"/var/uucp/.Admin/uucleanup"
#define CMDLOG (const char *)"/var/uucp/.Admin/command"
#define PERFLOG (const char *)"/var/uucp/.Admin/perflog"
#define ACCOUNT (const char *)"/var/uucp/.Admin/account"
#define SECURITY (const char *)"/var/uucp/.Admin/security"
#define WORKSPACE (const char *)"/var/uucp/.Workspace"
#define SQTIME 60
#define TRYCALLS 2
#define MINULIMIT (1L<<11)
#define MAX_LOCKTRY 5
#define CDEBUG(l, f, s)
#define SMALL
#ifndef SMALL
#define DEBUG(l, f, s) if (Debug >= l) fprintf(stderr, f, s)
#else
#define DEBUG(l, f, s)
#endif
#define VERBOSE(f, s) { if (Verbose > 0) (void) fprintf(stderr, f, s); }
#define PREFIX(pre, str) (strncmp((pre), (str), strlen(pre)) == SAME)
#define BASENAME(str, c) ((Bnptr = strrchr((str), c)) ? (Bnptr + 1) : (str))
#define EQUALS(a, b) ((a != CNULL) && (b != CNULL) && \
(strcmp((a), (b)) == SAME))
#define EQUALSN(a, b, n) ((a != CNULL) && (b != CNULL) && \
(strncmp((a), (b), (n)) == SAME))
#define LASTCHAR(s) (s+strlen(s)-1)
#define SAME 0
#define ANYREAD 04
#define ANYWRITE 02
#define FAIL -1
#define SUCCESS 0
#define NULLCHAR '\0'
#define CNULL (char *)0
#define STBNULL (struct sgttyb *)0
#define MASTER 1
#define SLAVE 0
#define MAXBASENAME 14
#define MAXFULLNAME BUFSIZ
#define MAXNAMESIZE 64
#define CONNECTTIME 30
#define EXPECTTIME 45
#define MSGTIME 60
#define NAMESIZE MAXBASENAME+1
#define SIZEOFPID 10
#define EOTMSG "\004\n\004\n"
#define CALLBACK 1
#define ACCESS_SYSTEMS 1
#define ACCESS_DEVICES 2
#define ACCESS_DIALERS 3
#define EACCESS_SYSTEMS 4
#define EACCESS_DEVICES 5
#define EACCESS_DIALERS 6
#define CK_READ 0
#define CK_WRITE 1
#define SHELL (const char *)"/usr/bin/sh"
#define MAIL (const char *)"mail"
#define UUCICO (const char *)"/usr/lib/uucp/uucico"
#define UUXQT (const char *)"/usr/lib/uucp/uuxqt"
#define UUX (const char *)"/usr/bin/uux"
#define UUCP (const char *)"/usr/bin/uucp"
#define SS_OK 0
#define SS_NO_DEVICE 1
#define SS_TIME_WRONG 2
#define SS_INPROGRESS 3
#define SS_CONVERSATION 4
#define SS_SEQBAD 5
#define SS_LOGIN_FAILED 6
#define SS_DIAL_FAILED 7
#define SS_BAD_LOG_MCH 8
#define SS_LOCKED_DEVICE 9
#define SS_ASSERT_ERROR 10
#define SS_BADSYSTEM 11
#define SS_CANT_ACCESS_DEVICE 12
#define SS_DEVICE_FAILED 13
#define SS_WRONG_MCH 14
#define SS_CALLBACK 15
#define SS_RLOCKED 16
#define SS_RUNKNOWN 17
#define SS_RLOGIN 18
#define SS_UNKNOWN_RESPONSE 19
#define SS_STARTUP 20
#define SS_CHAT_FAILED 21
#define SS_CALLBACK_LOOP 22
#define MAXPH 60
#define MAXC BUFSIZ
#define TRUE 1
#define FALSE 0
#define NAMEBUF 32
struct call {
char *speed;
char *line;
char *telno;
char *type;
};
#define F_MAX 50
#define F_NAME 0
#define F_TIME 1
#define F_TYPE 2
#define F_CLASS 3
#define F_PHONE 4
#define F_LOGIN 5
#define D_TYPE 0
#define D_LINE 1
#define D_CALLDEV 2
#define D_CLASS 3
#define D_CALLER 4
#define D_ARG 5
#define D_MAX 50
#define D_ACU 1
#define D_DIRECT 2
#define D_PROT 4
#define GRADES "/etc/uucp/Grades"
#define D_QUEUE 'Z'
#define CMDPRE 'C'
#define DATAPRE 'D'
#define XQTPRE 'X'
#define X_RQDFILE 'F'
#define X_STDIN 'I'
#define X_STDOUT 'O'
#define X_STDERR 'E'
#define X_CMD 'C'
#define X_USER 'U'
#define X_BRINGBACK 'B'
#define X_MAILF 'M'
#define X_RETADDR 'R'
#define X_COMMENT '#'
#define X_NONZERO 'Z'
#define X_SENDNOTHING 'N'
#define X_SENDZERO 'n'
struct caller {
const char *CA_type;
int (*CA_caller)();
};
struct cs_struct {
char file[NAMESIZE];
char sys[NAMESIZE+5];
char sgrade[NAMESIZE];
char grade;
long jsize;
};
struct dialer {
char *DI_type;
int (*DI_dialer)();
};
struct nstat {
pid_t t_pid;
time_t t_start;
time_t t_scall;
time_t t_ecall;
time_t t_tacu;
time_t t_tlog;
time_t t_sftp;
time_t t_sxf;
time_t t_exf;
time_t t_eftp;
time_t t_qtime;
int t_ndial;
int t_nlogs;
struct tms t_tbb;
struct tms t_txfs;
struct tms t_txfe;
struct tms t_tga;
};
struct limits {
int totalmax;
int sitemax;
char mode[64];
};
static ssize_t (*Read)(), (*Write)();
static int (*Ioctl)(int, int, ...);
static int Debug, Verbose;
static uid_t Uid, Euid;
static mode_t Dev_mode;
static long Retrytime;
static char Dc[];
static const char *Spool;
static const char *Pubdir;
static char Progname[];
static char *Bnptr;
static int Uerror;
static char *UerrorText[];
#define UERRORTEXT UerrorText[Uerror]
#define UTEXT(x) UerrorText[x]
static void (*genbrk)();
extern int iswrk(), gtwvec();
extern void findgrade();
extern void chremdir(), mkremdir();
extern void toCorrupt();
extern int xmv();
static int getargs();
static void bsfix();
extern char *getprm();
extern char *next_token();
extern char *nextarg();
extern int getuline();
static void logent(const char *, const char *);
extern void commandlog();
extern time_t millitick();
extern unsigned long getfilesize();
extern void putfilesize();
extern int logFind(), mchFind();
extern int chkperm(), chkpth();
extern int cmdOK(), switchRole();
extern int callBack(), requestOK();
extern int noSpool();
extern void myName();
extern int mkdirs();
extern int scanlimit();
extern void systat();
static int fd_mklock();
static int mklock(), cklock();
static void fd_rmlock(), rmlock();
extern char *timeStamp();
static void assert(const char *s1, const char *s2,
int i1, const char *s3, int i2);
extern void uucpname();
extern int versys();
extern void xuuxqt(), xuucico();
static void cleanup();
#define ASSERT(e, s1, s2, i1) if (!(e)) { \
assert(s1, s2, i1, __FILE__, __LINE__); \
cleanup(FAIL); \
};
static const char Ct_OPEN[];
static const char Ct_WRITE[];
static const char Ct_READ[];
static const char Ct_CREATE[];
static const char Ct_ALLOCATE[];
static const char Ct_LOCK[];
static const char Ct_STAT[];
static const char Ct_CHOWN[];
static const char Ct_CHMOD[];
static const char Ct_LINK[];
static const char Ct_CHDIR[];
static const char Ct_UNLINK[];
static const char Wr_ROLE[];
static const char Ct_CORRUPT[];
static const char Ct_FORK[];
static const char Ct_CLOSE[];
static const char Ct_BADOWN[];
static const char Fl_EXISTS[];
#ifdef __cplusplus
}
#endif
#endif