Initial revision
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
|
||||
/* Do you want debug code to be compiled? */
|
||||
#undef DEBUG
|
||||
|
||||
/* Do you want use DCD line control? */
|
||||
#undef MODEM_WATCH_CARRIER
|
||||
|
||||
/* Do you want hangup to watch for modem DCD line? */
|
||||
#undef MODEM_HANGUP_WATCH_CARRIER
|
||||
|
||||
/* Version string */
|
||||
#undef RELEASE_VERSION
|
||||
|
||||
/* Disable passwords logging? */
|
||||
#undef BFORCE_LOG_PASSWD
|
||||
|
||||
/* Path to the UUCP lock files directory */
|
||||
#undef BFORCE_LOCK_DIR
|
||||
|
||||
/* Do you want use .csy locks? */
|
||||
#undef BFORCE_USE_CSY
|
||||
|
||||
@@ -0,0 +1,191 @@
|
||||
/*
|
||||
* binkleyforce -- unix FTN mailer project
|
||||
*
|
||||
* Copyright (c) 1998-2000 Alexander Belkin, 2:5020/1398.11
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef _BFORCE_H_
|
||||
#define _BFORCE_H_
|
||||
|
||||
#ifndef DAEMON_LOGFILE
|
||||
#define DAEMON_LOGFILE "/var/log/bforce/bf-daemon"
|
||||
#endif
|
||||
|
||||
#ifndef BFORCE_LOGFILE
|
||||
#define BFORCE_LOGFILE "/var/log/bforce/bf-log"
|
||||
#endif
|
||||
|
||||
#ifndef BFORCE_DEBFILE
|
||||
#define BFORCE_DEBFILE "/var/log/bforce/bf-debug"
|
||||
#endif
|
||||
|
||||
#ifndef BFORCE_CFGFILE
|
||||
#define BFORCE_CFGFILE "/etc/bforce/bforce.conf"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* BinkleyForce limits
|
||||
*/
|
||||
#define BF_MAXCFGLINE 512
|
||||
#define BF_MAXREQLINE 256
|
||||
#define BF_MAXPATH 256
|
||||
#define BF_MAXDOMAIN 40
|
||||
#define BF_MAXADDRSTR 80
|
||||
|
||||
/*
|
||||
* Maximum length of file name (without path)
|
||||
*/
|
||||
#define BFORCE_MAX_NAME 128
|
||||
|
||||
/*
|
||||
* Maximum path length, including file name length
|
||||
*/
|
||||
#define BFORCE_MAX_PATH 256
|
||||
|
||||
/*
|
||||
* Maximum length of address string
|
||||
*/
|
||||
#define BFORCE_MAX_ADDRSTR 80
|
||||
|
||||
/*
|
||||
* Lock files type:
|
||||
* 1 - Ascii lock files
|
||||
* 2 - Binary lock files
|
||||
* 3 - SVR4 lock files (not implemented)
|
||||
*/
|
||||
#define BFORCE_LOCK_TYPE 1
|
||||
|
||||
/*
|
||||
* Maximum length of phone number string
|
||||
*/
|
||||
#define BFORCE_MAX_PHONE 80
|
||||
|
||||
/*
|
||||
* Maximum length of modem command string. Most modems
|
||||
* cannot handle strings longer 40 characters.
|
||||
*/
|
||||
#define MODEM_MAX_COMMAND 120
|
||||
|
||||
/*
|
||||
* Maximum length of modem response string
|
||||
*/
|
||||
#define MODEM_MAX_RESP 120
|
||||
|
||||
/*
|
||||
* Maximum number of characters that modem can response
|
||||
* on something command. Responses larger this will be
|
||||
* considered invalid, and mailer will return "modem not
|
||||
* response" without further waiting for "OK" or "ERROR"
|
||||
*/
|
||||
#define MODEM_MAX_RESP_SIZE 8128
|
||||
|
||||
/*
|
||||
* BinkleyForce return codes
|
||||
*/
|
||||
#define BFERR_NOERROR 0
|
||||
#define BFERR_FATALERROR 1
|
||||
#define BFERR_PHONE_UNKNOWN 2
|
||||
#define BFERR_PORTBUSY 3
|
||||
#define BFERR_SYSTEM_LOCKED 4
|
||||
#define BFERR_TRY_LATER 5
|
||||
#define BFERR_NOMODEM 6
|
||||
#define BFERR_NOTWORKING 7
|
||||
#define BFERR_CANT_CONNECT10 10
|
||||
#define BFERR_CANT_CONNECT11 11
|
||||
#define BFERR_CANT_CONNECT12 12
|
||||
#define BFERR_CANT_CONNECT13 13
|
||||
#define BFERR_CANT_CONNECT14 14
|
||||
#define BFERR_CANT_CONNECT15 15
|
||||
#define BFERR_CANT_CONNECT16 16
|
||||
#define BFERR_CANT_CONNECT17 17
|
||||
#define BFERR_CANT_CONNECT18 18
|
||||
#define BFERR_CANT_CONNECT19 19
|
||||
#define BFERR_CONNECT_TOOLOW 20
|
||||
#define BFERR_HANDSHAKE_ERROR 21
|
||||
#define BFERR_XMITERROR 22
|
||||
#define BFERR_CPSTOOLOW 23
|
||||
#define BFERR_STOPTIME 24
|
||||
|
||||
#define BFERR_MAXERRNO 24 /* Maximal error number */
|
||||
|
||||
#define BFERR_NAME(rc) ((rc >= 0) && (rc <= BFERR_MAXERRNO) ? BFERR[rc] : "Out of range")
|
||||
|
||||
/*
|
||||
* Some most popular defines
|
||||
*/
|
||||
#define gotoexit(a) { rc = a; goto exit; }
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define ASSERT_MSG() log("assertion failed: file: %s, line: %d, function: %s", \
|
||||
__FILE__, __LINE__, __FUNCTION__);
|
||||
#else
|
||||
#define ASSERT_MSG() log("assertion failed: file: %s, line: %d", \
|
||||
__FILE__, __LINE__);
|
||||
#endif
|
||||
|
||||
#define ASSERT(expr) \
|
||||
if( !(expr) ) \
|
||||
{ \
|
||||
ASSERT_MSG(); \
|
||||
abort(); \
|
||||
}
|
||||
|
||||
#define ISHEX(s) (strspn(s, "0123456790abcdefABCDEF") == strlen(s))
|
||||
#define ISDEC(s) (strspn(s, "0123456789" ) == strlen(s))
|
||||
#define ISOCT(s) (strspn(s, "01234567" ) == strlen(s))
|
||||
|
||||
/*
|
||||
* Some usable defines
|
||||
*/
|
||||
#define FALSE 0
|
||||
#define TRUE 1
|
||||
#define UNDEF -1
|
||||
|
||||
/*
|
||||
* Definition of new pretty types
|
||||
*/
|
||||
typedef char bool;
|
||||
typedef unsigned long UINT32;
|
||||
typedef unsigned short UINT16;
|
||||
typedef unsigned char UINT8;
|
||||
typedef signed long SINT32;
|
||||
typedef signed short SINT16;
|
||||
typedef signed char SINT8;
|
||||
|
||||
#include "confread.h"
|
||||
|
||||
/*
|
||||
* Command line options
|
||||
*/
|
||||
typedef struct {
|
||||
bool daemon; /* Run as daemon? */
|
||||
bool quit; /* Quit from daemon */
|
||||
bool dontcall; /* -m key */
|
||||
int inetd; /* Called from inetd? */
|
||||
int force; /* Force call? */
|
||||
int hiddline; /* Hidden line number (0,1..) */
|
||||
char *confname; /* Use this config instead def. */
|
||||
char *incname; /* Include this config */
|
||||
char *phone; /* Forced phone number */
|
||||
char *iaddr; /* Forced IP address */
|
||||
char *connect; /* Connect string */
|
||||
char *device; /* Forced device name */
|
||||
int stype; /* Handshake type in slave mode */
|
||||
s_falist *addrlist;
|
||||
} s_bforce_opts;
|
||||
|
||||
/*
|
||||
* Global variables
|
||||
*/
|
||||
extern const char *BFERR[];
|
||||
|
||||
int daemon_run(const char *confname, const char *incname, bool quit);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,145 @@
|
||||
/* include/config.h. Generated by configure. */
|
||||
/* include/config.h.in. Generated automatically from configure.in by autoheader. */
|
||||
|
||||
/* Define to empty if the keyword does not work. */
|
||||
/* #undef const */
|
||||
|
||||
/* Define if the `getpgrp' function takes no argument. */
|
||||
#define GETPGRP_VOID 1
|
||||
|
||||
/* Define if you don't have vprintf but do have _doprnt. */
|
||||
/* #undef HAVE_DOPRNT */
|
||||
|
||||
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
|
||||
#define HAVE_SYS_WAIT_H 1
|
||||
|
||||
/* Define if you have the vprintf function. */
|
||||
#define HAVE_VPRINTF 1
|
||||
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
/* #undef mode_t */
|
||||
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
/* #undef pid_t */
|
||||
|
||||
/* Define as the return type of signal handlers (int or void). */
|
||||
#define RETSIGTYPE void
|
||||
|
||||
/* Define if the setvbuf function takes the buffering type as its second
|
||||
argument and the buffer pointer as the third, as on System V
|
||||
before release 3. */
|
||||
/* #undef SETVBUF_REVERSED */
|
||||
|
||||
/* Define to `unsigned' if <sys/types.h> doesn't define. */
|
||||
/* #undef size_t */
|
||||
|
||||
/* Define if you have the ANSI C header files. */
|
||||
#define STDC_HEADERS 1
|
||||
|
||||
/* Define if you can safely include both <sys/time.h> and <time.h>. */
|
||||
#define TIME_WITH_SYS_TIME 1
|
||||
|
||||
/* Define if your <sys/time.h> declares struct tm. */
|
||||
/* #undef TM_IN_SYS_TIME */
|
||||
|
||||
/* Do you want debug code to be compiled? */
|
||||
#define DEBUG 1
|
||||
|
||||
/* Do you want use DCD line control? */
|
||||
#define MODEM_WATCH_CARRIER 1
|
||||
|
||||
/* Do you want hangup to watch for modem DCD line? */
|
||||
#define MODEM_HANGUP_WATCH_CARRIER 1
|
||||
|
||||
/* Version string */
|
||||
#define RELEASE_VERSION "0.22.8.ugenk4"
|
||||
|
||||
/* Disable passwords logging? */
|
||||
#define BFORCE_LOG_PASSWD 1
|
||||
|
||||
/* Path to the UUCP lock files directory */
|
||||
#define BFORCE_LOCK_DIR "/var/lock/"
|
||||
|
||||
/* Do you want use .csy locks? */
|
||||
#define BFORCE_USE_CSY 1
|
||||
|
||||
/* Define if you have the mkdir function. */
|
||||
#define HAVE_MKDIR 1
|
||||
|
||||
/* Define if you have the mktime function. */
|
||||
#define HAVE_MKTIME 1
|
||||
|
||||
/* Define if you have the rename function. */
|
||||
#define HAVE_RENAME 1
|
||||
|
||||
/* Define if you have the select function. */
|
||||
#define HAVE_SELECT 1
|
||||
|
||||
/* Define if you have the setproctitle function. */
|
||||
/* #undef HAVE_SETPROCTITLE */
|
||||
|
||||
/* Define if you have the socket function. */
|
||||
#define HAVE_SOCKET 1
|
||||
|
||||
/* Define if you have the statfs function. */
|
||||
#define HAVE_STATFS 1
|
||||
|
||||
/* Define if you have the statvfs function. */
|
||||
#define HAVE_STATVFS 1
|
||||
|
||||
/* Define if you have the strcasecmp function. */
|
||||
#define HAVE_STRCASECMP 1
|
||||
|
||||
/* Define if you have the strspn function. */
|
||||
#define HAVE_STRSPN 1
|
||||
|
||||
/* Define if you have the <dirent.h> header file. */
|
||||
#define HAVE_DIRENT_H 1
|
||||
|
||||
/* Define if you have the <fcntl.h> header file. */
|
||||
#define HAVE_FCNTL_H 1
|
||||
|
||||
/* Define if you have the <ndir.h> header file. */
|
||||
/* #undef HAVE_NDIR_H */
|
||||
|
||||
/* Define if you have the <sys/dir.h> header file. */
|
||||
/* #undef HAVE_SYS_DIR_H */
|
||||
|
||||
/* Define if you have the <sys/file.h> header file. */
|
||||
#define HAVE_SYS_FILE_H 1
|
||||
|
||||
/* Define if you have the <sys/ioctl.h> header file. */
|
||||
#define HAVE_SYS_IOCTL_H 1
|
||||
|
||||
/* Define if you have the <sys/mount.h> header file. */
|
||||
#define HAVE_SYS_MOUNT_H 1
|
||||
|
||||
/* Define if you have the <sys/ndir.h> header file. */
|
||||
/* #undef HAVE_SYS_NDIR_H */
|
||||
|
||||
/* Define if you have the <sys/param.h> header file. */
|
||||
#define HAVE_SYS_PARAM_H 1
|
||||
|
||||
/* Define if you have the <sys/select.h> header file. */
|
||||
#define HAVE_SYS_SELECT_H 1
|
||||
|
||||
/* Define if you have the <sys/statfs.h> header file. */
|
||||
#define HAVE_SYS_STATFS_H 1
|
||||
|
||||
/* Define if you have the <sys/statvfs.h> header file. */
|
||||
#define HAVE_SYS_STATVFS_H 1
|
||||
|
||||
/* Define if you have the <sys/termiox.h> header file. */
|
||||
/* #undef HAVE_SYS_TERMIOX_H */
|
||||
|
||||
/* Define if you have the <sys/time.h> header file. */
|
||||
#define HAVE_SYS_TIME_H 1
|
||||
|
||||
/* Define if you have the <sys/vfs.h> header file. */
|
||||
#define HAVE_SYS_VFS_H 1
|
||||
|
||||
/* Define if you have the <termios.h> header file. */
|
||||
#define HAVE_TERMIOS_H 1
|
||||
|
||||
/* Define if you have the <unistd.h> header file. */
|
||||
#define HAVE_UNISTD_H 1
|
||||
@@ -0,0 +1,144 @@
|
||||
/* include/config.h.in. Generated automatically from configure.in by autoheader. */
|
||||
|
||||
/* Define to empty if the keyword does not work. */
|
||||
#undef const
|
||||
|
||||
/* Define if the `getpgrp' function takes no argument. */
|
||||
#undef GETPGRP_VOID
|
||||
|
||||
/* Define if you don't have vprintf but do have _doprnt. */
|
||||
#undef HAVE_DOPRNT
|
||||
|
||||
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
|
||||
#undef HAVE_SYS_WAIT_H
|
||||
|
||||
/* Define if you have the vprintf function. */
|
||||
#undef HAVE_VPRINTF
|
||||
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
#undef mode_t
|
||||
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
#undef pid_t
|
||||
|
||||
/* Define as the return type of signal handlers (int or void). */
|
||||
#undef RETSIGTYPE
|
||||
|
||||
/* Define if the setvbuf function takes the buffering type as its second
|
||||
argument and the buffer pointer as the third, as on System V
|
||||
before release 3. */
|
||||
#undef SETVBUF_REVERSED
|
||||
|
||||
/* Define to `unsigned' if <sys/types.h> doesn't define. */
|
||||
#undef size_t
|
||||
|
||||
/* Define if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Define if you can safely include both <sys/time.h> and <time.h>. */
|
||||
#undef TIME_WITH_SYS_TIME
|
||||
|
||||
/* Define if your <sys/time.h> declares struct tm. */
|
||||
#undef TM_IN_SYS_TIME
|
||||
|
||||
/* Do you want debug code to be compiled? */
|
||||
#undef DEBUG
|
||||
|
||||
/* Do you want use DCD line control? */
|
||||
#undef MODEM_WATCH_CARRIER
|
||||
|
||||
/* Do you want hangup to watch for modem DCD line? */
|
||||
#undef MODEM_HANGUP_WATCH_CARRIER
|
||||
|
||||
/* Version string */
|
||||
#undef RELEASE_VERSION
|
||||
|
||||
/* Disable passwords logging? */
|
||||
#undef BFORCE_LOG_PASSWD
|
||||
|
||||
/* Path to the UUCP lock files directory */
|
||||
#undef BFORCE_LOCK_DIR
|
||||
|
||||
/* Do you want use .csy locks? */
|
||||
#undef BFORCE_USE_CSY
|
||||
|
||||
/* Define if you have the mkdir function. */
|
||||
#undef HAVE_MKDIR
|
||||
|
||||
/* Define if you have the mktime function. */
|
||||
#undef HAVE_MKTIME
|
||||
|
||||
/* Define if you have the rename function. */
|
||||
#undef HAVE_RENAME
|
||||
|
||||
/* Define if you have the select function. */
|
||||
#undef HAVE_SELECT
|
||||
|
||||
/* Define if you have the setproctitle function. */
|
||||
#undef HAVE_SETPROCTITLE
|
||||
|
||||
/* Define if you have the socket function. */
|
||||
#undef HAVE_SOCKET
|
||||
|
||||
/* Define if you have the statfs function. */
|
||||
#undef HAVE_STATFS
|
||||
|
||||
/* Define if you have the statvfs function. */
|
||||
#undef HAVE_STATVFS
|
||||
|
||||
/* Define if you have the strcasecmp function. */
|
||||
#undef HAVE_STRCASECMP
|
||||
|
||||
/* Define if you have the strspn function. */
|
||||
#undef HAVE_STRSPN
|
||||
|
||||
/* Define if you have the <dirent.h> header file. */
|
||||
#undef HAVE_DIRENT_H
|
||||
|
||||
/* Define if you have the <fcntl.h> header file. */
|
||||
#undef HAVE_FCNTL_H
|
||||
|
||||
/* Define if you have the <ndir.h> header file. */
|
||||
#undef HAVE_NDIR_H
|
||||
|
||||
/* Define if you have the <sys/dir.h> header file. */
|
||||
#undef HAVE_SYS_DIR_H
|
||||
|
||||
/* Define if you have the <sys/file.h> header file. */
|
||||
#undef HAVE_SYS_FILE_H
|
||||
|
||||
/* Define if you have the <sys/ioctl.h> header file. */
|
||||
#undef HAVE_SYS_IOCTL_H
|
||||
|
||||
/* Define if you have the <sys/mount.h> header file. */
|
||||
#undef HAVE_SYS_MOUNT_H
|
||||
|
||||
/* Define if you have the <sys/ndir.h> header file. */
|
||||
#undef HAVE_SYS_NDIR_H
|
||||
|
||||
/* Define if you have the <sys/param.h> header file. */
|
||||
#undef HAVE_SYS_PARAM_H
|
||||
|
||||
/* Define if you have the <sys/select.h> header file. */
|
||||
#undef HAVE_SYS_SELECT_H
|
||||
|
||||
/* Define if you have the <sys/statfs.h> header file. */
|
||||
#undef HAVE_SYS_STATFS_H
|
||||
|
||||
/* Define if you have the <sys/statvfs.h> header file. */
|
||||
#undef HAVE_SYS_STATVFS_H
|
||||
|
||||
/* Define if you have the <sys/termiox.h> header file. */
|
||||
#undef HAVE_SYS_TERMIOX_H
|
||||
|
||||
/* Define if you have the <sys/time.h> header file. */
|
||||
#undef HAVE_SYS_TIME_H
|
||||
|
||||
/* Define if you have the <sys/vfs.h> header file. */
|
||||
#undef HAVE_SYS_VFS_H
|
||||
|
||||
/* Define if you have the <termios.h> header file. */
|
||||
#undef HAVE_TERMIOS_H
|
||||
|
||||
/* Define if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
@@ -0,0 +1,363 @@
|
||||
/*
|
||||
* binkleyforce -- unix FTN mailer project
|
||||
*
|
||||
* Copyright (c) 1998-2000 Alexander Belkin, 2:5020/1398.11
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef _CONFREAD_H_
|
||||
#define _CONFREAD_H_
|
||||
|
||||
#include "util.h"
|
||||
|
||||
/* Constatnts for gotfile switches */
|
||||
#define GOTFILE_SW_SRIF 0x01
|
||||
#define GOTFILE_SW_IMMED 0x01
|
||||
#define GOTFILE_SW_ONLINE 0x01
|
||||
|
||||
#define MAXINCLUDELEVEL 10
|
||||
|
||||
#define PROC_RC_OK 0 /* Successfully processed string */
|
||||
#define PROC_RC_WARN 1 /* Successfully, but not all so good */
|
||||
#define PROC_RC_IGNORE 2 /* Line was ignored, but we can continue */
|
||||
#define PROC_RC_ABORT 3 /* Incorrect line and we can not continue */
|
||||
|
||||
/*
|
||||
* Options (from/for "options" keyword)
|
||||
*/
|
||||
#define OPTIONS_NO_ZMODEM 0x00000001L
|
||||
#define OPTIONS_NO_ZEDZAP 0x00000002L
|
||||
#define OPTIONS_NO_DIRZAP 0x00000004L
|
||||
#define OPTIONS_NO_JANUS 0x00000008L
|
||||
#define OPTIONS_NO_HYDRA 0x00000010L
|
||||
#define OPTIONS_NO_BINKP 0x00000020L
|
||||
#define OPTIONS_NO_TCP 0x00000040L
|
||||
#define OPTIONS_NO_CHAT 0x00000080L
|
||||
#define OPTIONS_NO_FTS1 0x00000100L
|
||||
#define OPTIONS_NO_YOOHOO 0x00000200L
|
||||
#define OPTIONS_NO_EMSI 0x00000400L
|
||||
#define OPTIONS_NO_EMSI_II 0x00000800L
|
||||
#define OPTIONS_NO_FREQS 0x00001000L
|
||||
#define OPTIONS_MAILONLY 0x00002000L
|
||||
#define OPTIONS_HOLDXT 0x00004000L
|
||||
#define OPTIONS_HOLDREQ 0x00008000L
|
||||
#define OPTIONS_HOLDALL 0x00010000L
|
||||
#define OPTIONS_HOLDHOLD 0x00020000L
|
||||
#define OPTIONS_NO_PICKUP 0x00040000L
|
||||
#define OPTIONS_NO_RH1 0x00080000L
|
||||
#define OPTIONS_NO_INTRO 0x00100000L
|
||||
|
||||
#define RESPTYPE_CONNECT 0x0000L
|
||||
#define RESPTYPE_BUSY 0x0001L
|
||||
#define RESPTYPE_NOCARRIER 0x0002L
|
||||
#define RESPTYPE_NODIALTONE 0x0004L
|
||||
#define RESPTYPE_NOANSWER 0x0008L
|
||||
#define RESPTYPE_ERROR 0x0010L
|
||||
|
||||
#define TRIES_ACTION_UNDIALABLE 0x01
|
||||
#define TRIES_ACTION_HOLDSYSTEM 0x02
|
||||
#define TRIES_ACTION_HOLDALL 0x04
|
||||
|
||||
/*
|
||||
* Add new entry to the end of list
|
||||
*/
|
||||
#define LIST_NEWENT(newp,list,type) \
|
||||
for( newp = list; *newp; newp = &((*newp)->next) ); \
|
||||
*newp = (type*)xmalloc(sizeof(type)); \
|
||||
memset(*newp, '\0', sizeof(type));
|
||||
|
||||
typedef struct expr {
|
||||
bool error; /* Incorrect expression. Don't try twice! */
|
||||
char *expr; /* Pointer to the expression string */
|
||||
} s_expr;
|
||||
|
||||
/*
|
||||
* Storage structures for base config components
|
||||
*/
|
||||
typedef struct string {
|
||||
char *str;
|
||||
} s_string;
|
||||
|
||||
typedef struct number {
|
||||
long num;
|
||||
} s_number;
|
||||
|
||||
typedef struct boolean {
|
||||
bool istrue;
|
||||
} s_boolean;
|
||||
|
||||
typedef struct falist {
|
||||
s_faddr addr;
|
||||
char *what;
|
||||
struct falist *next;
|
||||
} s_falist;
|
||||
|
||||
typedef struct domain {
|
||||
char *domain;
|
||||
char *path;
|
||||
int zone;
|
||||
} s_domain;
|
||||
|
||||
typedef struct translate {
|
||||
char *find;
|
||||
char *repl;
|
||||
} s_translate;
|
||||
|
||||
typedef struct connlist {
|
||||
long speed;
|
||||
long value;
|
||||
} s_connlist;
|
||||
|
||||
typedef struct dialresp {
|
||||
char *mstr; /* Modem string/substring */
|
||||
int type; /* Response meaning (for mailer) */
|
||||
int retv; /* Force this return code */
|
||||
} s_dialresp;
|
||||
|
||||
typedef struct filemode {
|
||||
mode_t mode;
|
||||
} s_filemode;
|
||||
|
||||
typedef struct modemport {
|
||||
long speed;
|
||||
char *name;
|
||||
} s_modemport;
|
||||
|
||||
typedef struct tries {
|
||||
int tries;
|
||||
int action;
|
||||
int arg;
|
||||
} s_tries;
|
||||
|
||||
typedef struct override {
|
||||
s_faddr addr; /* Overrides for this address */
|
||||
char *sIpaddr;
|
||||
char *sPhone;
|
||||
char *sFlags;
|
||||
s_timevec worktime;
|
||||
s_timevec freqtime;
|
||||
struct override *hidden; /* Hidden lines list */
|
||||
} s_override;
|
||||
|
||||
typedef struct options {
|
||||
unsigned long value;
|
||||
unsigned long mask; /* bit[k] == 1 if bit[k] defined in value */
|
||||
} s_options;
|
||||
|
||||
typedef struct filebox {
|
||||
s_faddr addr;
|
||||
char *path;
|
||||
int flavor;
|
||||
struct falist *next;
|
||||
} s_filebox;
|
||||
|
||||
typedef enum {
|
||||
cf_address,
|
||||
cf_amiga_outbound_directory,
|
||||
cf_binkp_timeout,
|
||||
cf_daemon_circle,
|
||||
cf_daemon_circle_crash,
|
||||
cf_daemon_circle_direct,
|
||||
cf_daemon_circle_immed,
|
||||
cf_daemon_circle_modem,
|
||||
cf_daemon_circle_normal,
|
||||
cf_daemon_circle_rescan,
|
||||
cf_daemon_maxclients_modem,
|
||||
cf_daemon_maxclients_tcpip,
|
||||
cf_daemon_pid_file,
|
||||
cf_delay_files_recv,
|
||||
cf_delay_files_send,
|
||||
cf_disable_aka_matching,
|
||||
cf_domain,
|
||||
cf_emsi_FR_time,
|
||||
cf_emsi_OH_time,
|
||||
cf_emsi_slave_sends_nak,
|
||||
cf_filebox,
|
||||
cf_filebox_directory,
|
||||
cf_flags,
|
||||
cf_flo_translate,
|
||||
cf_freq_alias_list,
|
||||
cf_freq_dir_list,
|
||||
cf_freq_ignore_masks,
|
||||
cf_freq_limit_number,
|
||||
cf_freq_limit_size,
|
||||
cf_freq_limit_time,
|
||||
cf_freq_min_speed,
|
||||
cf_freq_srif_command,
|
||||
cf_hide_our_aka,
|
||||
cf_history_file,
|
||||
cf_hydra_options,
|
||||
cf_hydra_mincps_recv,
|
||||
cf_hydra_mincps_send,
|
||||
cf_hydra_tx_window,
|
||||
cf_hydra_rx_window,
|
||||
cf_inbound_directory,
|
||||
cf_location,
|
||||
cf_log_file,
|
||||
cf_log_file_daemon,
|
||||
cf_max_speed,
|
||||
cf_maxtries,
|
||||
cf_maxtries_nodial,
|
||||
cf_maxtries_noansw,
|
||||
cf_maxtries_noconn,
|
||||
cf_maxtries_hshake,
|
||||
cf_maxtries_sessions,
|
||||
cf_min_cps_recv,
|
||||
cf_min_cps_send,
|
||||
cf_min_cps_time,
|
||||
cf_min_free_space,
|
||||
cf_min_speed_in,
|
||||
cf_min_speed_out,
|
||||
cf_mode_netmail,
|
||||
cf_mode_arcmail,
|
||||
cf_mode_request,
|
||||
cf_mode_ticfile,
|
||||
cf_mode_default,
|
||||
cf_modem_can_send_break,
|
||||
cf_modem_dial_prefix,
|
||||
cf_modem_dial_suffix,
|
||||
cf_modem_dial_response,
|
||||
cf_modem_hangup_command,
|
||||
cf_modem_port,
|
||||
cf_modem_reset_command,
|
||||
cf_modem_stat_command,
|
||||
cf_nodelist,
|
||||
cf_nodelist_directory,
|
||||
cf_nodial_flag,
|
||||
cf_override,
|
||||
cf_options,
|
||||
cf_outbound_directory,
|
||||
cf_password,
|
||||
cf_phone,
|
||||
cf_phone_translate,
|
||||
cf_recode_file_in,
|
||||
cf_recode_file_out,
|
||||
cf_recode_intro_in,
|
||||
cf_recv_buffer_size,
|
||||
cf_rescan_delay,
|
||||
cf_run_after_handshake,
|
||||
cf_run_after_session,
|
||||
cf_session_limit_in,
|
||||
cf_session_limit_out,
|
||||
cf_skip_files_recv,
|
||||
cf_status_directory,
|
||||
cf_system_name,
|
||||
cf_sysop_name,
|
||||
cf_uucp_lock_directory,
|
||||
cf_wait_carrier_in,
|
||||
cf_wait_carrier_out,
|
||||
cf_zmodem_mincps_recv,
|
||||
cf_zmodem_mincps_send,
|
||||
cf_zmodem_send_dummy_pkt,
|
||||
cf_zmodem_skip_by_pos,
|
||||
cf_zmodem_start_block_size,
|
||||
cf_zmodem_tx_window,
|
||||
cf_nomail_flag,
|
||||
cf_bind_ip,
|
||||
/* #ifdef USE_SYSLOG */
|
||||
cf_syslog_facility,
|
||||
/* #endif */
|
||||
#ifdef DEBUG
|
||||
cf_debug_file,
|
||||
cf_debug_level,
|
||||
#endif
|
||||
BFORCE_NUMBER_OF_KEYWORDS
|
||||
} bforce_config_keyword;
|
||||
|
||||
typedef struct cval_entry {
|
||||
s_expr expr;
|
||||
union {
|
||||
s_falist falist;
|
||||
s_domain domain;
|
||||
s_override override;
|
||||
s_options options;
|
||||
s_translate translate;
|
||||
s_connlist connlist;
|
||||
s_number number;
|
||||
s_boolean boolean;
|
||||
s_string string;
|
||||
s_modemport modemport;
|
||||
s_dialresp dialresp;
|
||||
s_tries tries;
|
||||
s_filemode filemode;
|
||||
s_filebox filebox;
|
||||
} d;
|
||||
struct cval_entry *next;
|
||||
} s_cval_entry;
|
||||
|
||||
typedef struct conf_entry {
|
||||
char *name;
|
||||
enum {
|
||||
CT_ADDRESS,
|
||||
CT_BOOLEAN,
|
||||
CT_CONNLIST,
|
||||
CT_DIALRESP,
|
||||
CT_DOMAIN,
|
||||
CT_FILEMODE,
|
||||
CT_MODEMPORT,
|
||||
CT_NODELIST,
|
||||
CT_NUMBER,
|
||||
CT_OPTIONS,
|
||||
CT_OVERRIDE,
|
||||
CT_PATH,
|
||||
CT_PASSWORD,
|
||||
CT_STRING,
|
||||
CT_TRANSLATE,
|
||||
CT_TRIES,
|
||||
CT_DEBLEVEL,
|
||||
CT_FILEBOX
|
||||
} type;
|
||||
s_cval_entry *data;
|
||||
bforce_config_keyword real_key;
|
||||
} s_conf_entry;
|
||||
|
||||
extern s_conf_entry bforce_config[];
|
||||
|
||||
/* conf_proc.c */
|
||||
int proc_configline(const char *k, const char *e, const char *v);
|
||||
|
||||
/* conf_deinit.c */
|
||||
void deinit_conf(void);
|
||||
void deinit_cval_entry(s_cval_entry *dest, bforce_config_keyword type);
|
||||
void deinit_dialresp(s_dialresp *dest);
|
||||
void deinit_domain(s_domain *dest);
|
||||
void deinit_expr(s_expr *dest);
|
||||
void deinit_falist(s_falist *dest);
|
||||
void deinit_modemport(s_modemport *dest);
|
||||
void deinit_override(s_override *dest);
|
||||
void deinit_string(s_string *dest);
|
||||
void deinit_translate(s_translate *dest);
|
||||
|
||||
/* conf_read.c */
|
||||
const char *conf_getconfname(void);
|
||||
int conf_postreadcheck(void);
|
||||
int conf_readpasswdlist(s_falist **pwdlist, char *fname);
|
||||
int conf_readconf(const char *confname, int inclevel);
|
||||
#ifdef DEBUG
|
||||
void log_overridelist(s_override *subst);
|
||||
void log_options(s_options *opt);
|
||||
#endif
|
||||
|
||||
/* conf_get.c */
|
||||
s_cval_entry *conf_first(bforce_config_keyword keyword);
|
||||
s_cval_entry *conf_next(s_cval_entry *ptrl);
|
||||
bool conf_boolean(bforce_config_keyword keyword);
|
||||
mode_t conf_filemode(bforce_config_keyword keyword);
|
||||
long conf_options(bforce_config_keyword keyword);
|
||||
long conf_connlist(bforce_config_keyword keyword, long speed);
|
||||
char *conf_string(bforce_config_keyword keyword);
|
||||
long conf_number(bforce_config_keyword keyword);
|
||||
s_override *conf_override(bforce_config_keyword keyword, s_faddr addr);
|
||||
s_tries *conf_tries(bforce_config_keyword keyword);
|
||||
|
||||
/* expression.y */
|
||||
bool eventexpr(s_expr *expr);
|
||||
|
||||
#endif /* _CONFREAD_H_ */
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* binkleyforce -- unix FTN mailer project
|
||||
*
|
||||
* Copyright (c) 1998-2000 Alexander Belkin, 2:5020/1398.11
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef _DAEMON_H_
|
||||
#define _DAEMON_H_
|
||||
|
||||
#include "outbound.h"
|
||||
|
||||
/*
|
||||
* Branch information
|
||||
*/
|
||||
typedef struct {
|
||||
s_faddr addr;
|
||||
bool tcpip;
|
||||
char *portname;
|
||||
bool wait; /* It is like a zombie! */
|
||||
pid_t pid; /* Branch PID, returned by fork() call */
|
||||
time_t start;
|
||||
time_t stop; /* We should stop (kill) branch at this time */
|
||||
int rc; /* Process return code (one of BFERR values) */
|
||||
} s_daemon_branch;
|
||||
|
||||
/*
|
||||
* Daemon queue sates
|
||||
*/
|
||||
typedef enum {
|
||||
DQ_CallSystem,
|
||||
DQ_GetNextSystem,
|
||||
DQ_Idle
|
||||
} DQ_State;
|
||||
|
||||
/*
|
||||
* Daemon states
|
||||
*/
|
||||
typedef enum {
|
||||
DM_Start,
|
||||
DM_Restart,
|
||||
DM_ProcessQueues,
|
||||
DM_Usr1,
|
||||
DM_Usr2,
|
||||
DM_Shutdown
|
||||
} DM_State;
|
||||
|
||||
/*
|
||||
* Daemon queue
|
||||
*/
|
||||
typedef struct {
|
||||
s_sysqueue *q; /* Pointer to the systems queue (shared) */
|
||||
int current;
|
||||
int circle;
|
||||
bool tcpip; /* Queue for TCP/IP systems? */
|
||||
DQ_State state;
|
||||
} s_daemon_queue;
|
||||
|
||||
extern int max_tcpip;
|
||||
extern int max_modem;
|
||||
extern int tcpip_clients;
|
||||
extern int modem_clients;
|
||||
|
||||
/* daemon.c */
|
||||
int daemon_run(const char *confname, const char *incname, bool quit);
|
||||
|
||||
/* daemon_branch.c */
|
||||
bool daemon_branch_exist(s_faddr addr);
|
||||
void daemon_branch_check_stop_timers(void);
|
||||
int daemon_branch_exit(pid_t pid, int rc);
|
||||
int daemon_branch_get_first_waiting(void);
|
||||
s_daemon_branch *daemon_branch_get_pointer(int pos);
|
||||
void daemon_branch_add(s_faddr addr, pid_t pid, bool tcpip, const char *pname);
|
||||
void daemon_branch_remove(int pos);
|
||||
int daemon_branch_number(void);
|
||||
void daemon_branch_deinit(void);
|
||||
|
||||
/* daemon_call.c */
|
||||
int daemon_call(s_sysentry *syst);
|
||||
|
||||
/* daemon_lines.c */
|
||||
int daemon_line_add(const char *name, int type);
|
||||
void daemon_line_hold(const char *name, int holdtime);
|
||||
bool daemon_line_isready(const char *name);
|
||||
void daemon_lines_deinit(void);
|
||||
|
||||
#endif /* _DAEMON_H_ */
|
||||
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* binkleyforce -- unix FTN mailer project
|
||||
*
|
||||
* Copyright (c) 1998-2000 Alexander Belkin, 2:5020/1398.11
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef _FREQ_H_
|
||||
#define _FREQ_H_
|
||||
|
||||
#include "session.h"
|
||||
#include "outbound.h"
|
||||
|
||||
/*
|
||||
* List of our available for FREQing resources
|
||||
*/
|
||||
typedef struct frlist {
|
||||
struct frlist *next;
|
||||
char *magic;
|
||||
char *path;
|
||||
char *passwd;
|
||||
char *expr; /* process only if expression is true */
|
||||
} s_frlist;
|
||||
|
||||
/*
|
||||
* List of requested files (from requester)
|
||||
*/
|
||||
typedef struct reqlist {
|
||||
struct reqlist *next;
|
||||
char *fmask;
|
||||
char *passwd;
|
||||
time_t newer;
|
||||
time_t older;
|
||||
int skip;
|
||||
} s_reqlist;
|
||||
|
||||
/*
|
||||
* Keep all FREQ processor-important information here
|
||||
*/
|
||||
typedef struct freq {
|
||||
char *srifproc; /* Name of external (SRIF) FREQ processor */
|
||||
s_frlist *frlist; /* File areas list for int. FREQ processor */
|
||||
s_reqlist *reqlist; /* List of requested file masks, etc.. */
|
||||
s_filelist **filelist; /* Put here files we found and want to send */
|
||||
s_filelist **flast; /* Pointer to the last entry in filelist */
|
||||
int fnumber; /* Total number of files, we found */
|
||||
int fileslimit; /* Maxmum number of files to send as answer */
|
||||
size_t fsize; /* Total size of files, we found */
|
||||
size_t sizelimit; /* Maxmum size of files to send as answer */
|
||||
} s_freq;
|
||||
|
||||
/* req_bark.c */
|
||||
|
||||
/* req_proc.c */
|
||||
void req_proc(char *reqname, s_filelist **filelist);
|
||||
|
||||
/* req_srif.c */
|
||||
int req_createsrif(char *sname, char *req, char *rsp);
|
||||
void req_addfilelist(char *listname, s_freq *freq);
|
||||
|
||||
/* req_wazo.c */
|
||||
int req_readwazooreq(char *reqname, s_reqlist **reqlist);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,143 @@
|
||||
/*
|
||||
* binkleyforce -- unix FTN mailer project
|
||||
*
|
||||
* Copyright (c) 1998-2000 Alexander Belkin, 2:5020/1398.11
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDES_H_
|
||||
#define _INCLUDES_H_
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/socket.h>
|
||||
#include <errno.h>
|
||||
#include <utime.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
#include <ctype.h>
|
||||
#include <locale.h>
|
||||
#include <signal.h>
|
||||
|
||||
/*
|
||||
* Has ANSI C headers?
|
||||
*/
|
||||
#ifdef STDC_HEADERS
|
||||
# include <string.h>
|
||||
# include <stdarg.h>
|
||||
#else
|
||||
# include <varargs.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_WAIT_H
|
||||
# include <sys/wait.h>
|
||||
#endif
|
||||
#ifndef WEXITSTATUS
|
||||
# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
|
||||
#endif
|
||||
#ifndef WIFEXITED
|
||||
# define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DIRENT_H
|
||||
# include <dirent.h>
|
||||
# define NAMLEN(dirent) strlen((dirent)->d_name)
|
||||
#else
|
||||
# define dirent direct
|
||||
# define NAMLEN(dirent) (dirent)->d_namlen
|
||||
# ifdef HAVE_NDIR_H
|
||||
# include <ndir.h>
|
||||
# endif
|
||||
# ifdef HAVE_SYS_NDIR_H
|
||||
# include <sys/ndir.h>
|
||||
# endif
|
||||
# ifdef HAVE_SYS_DIR_H
|
||||
# include <sys/dir.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_FILE_H
|
||||
#include <sys/file.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_IOCTL_H
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_MOUNT_H
|
||||
#include <sys/mount.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_STATFS_H
|
||||
#include <sys/statfs.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_STATVFS_H
|
||||
#include <sys/statvfs.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_VFS_H
|
||||
#include <sys/vfs.h>
|
||||
#endif
|
||||
|
||||
#if TIME_WITH_SYS_TIME
|
||||
# include <sys/time.h>
|
||||
# include <time.h>
|
||||
#elif HAVE_SYS_TIME
|
||||
# include <sys/time.h>
|
||||
#else
|
||||
# include <time.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_TERMIOS_H
|
||||
#include <termios.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_TERMIOX_H
|
||||
#include <sys/termiox.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_SELECT_H
|
||||
#include <sys/select.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Include OS dependent information
|
||||
*/
|
||||
#include "os.h"
|
||||
|
||||
/*
|
||||
* Include version information
|
||||
*/
|
||||
#include "version.h"
|
||||
|
||||
/*
|
||||
* Include main defines, constants
|
||||
*/
|
||||
#include "bforce.h"
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,230 @@
|
||||
/*
|
||||
* binkleyforce -- unix FTN mailer project
|
||||
*
|
||||
* Copyright (c) 1998-2000 Alexander Belkin, 2:5020/1398.11
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef _IO_H_
|
||||
#define _IO_H_
|
||||
|
||||
typedef enum {
|
||||
TCPMODE_RAW,
|
||||
TCPMODE_TELNET,
|
||||
TCPMODE_BINKP
|
||||
} e_tcpmode;
|
||||
|
||||
extern int tty_online;
|
||||
extern int tty_hangup;
|
||||
extern int tty_abort;
|
||||
extern int tty_modem;
|
||||
extern int tty_status;
|
||||
|
||||
#define XON ('Q' & 037)
|
||||
#define XOFF ('S' & 037)
|
||||
#define CPMEOF ('Z' & 037)
|
||||
#define NUL 0x00
|
||||
#define SOH 0x01
|
||||
#define STX 0x02
|
||||
#define ETX 0x03
|
||||
#define EOT 0x04
|
||||
#define ENQ 0x05
|
||||
#define ACK 0x06
|
||||
#define BEL 0x07
|
||||
#define BS 0x08
|
||||
#define HT 0x09
|
||||
#define LF 0x0a
|
||||
#define VT 0x0b
|
||||
#define FF 0x0c
|
||||
#define CR 0x0d
|
||||
#define SO 0x0e
|
||||
#define SI 0x0f
|
||||
#define DLE 0x10
|
||||
#define DC1 0x11
|
||||
#define DC2 0x12
|
||||
#define DC3 0x13
|
||||
#define DC4 0x14
|
||||
#define NAK 0x15
|
||||
#define SYN 0x16
|
||||
#define ETB 0x17
|
||||
#define CAN 0x18
|
||||
#define EM 0x19
|
||||
#define SUB 0x1a
|
||||
#define ESC 0x1b
|
||||
#define FS 0x1c
|
||||
#define GS 0x1d
|
||||
#define RS 0x1e
|
||||
#define US 0x1f
|
||||
#define TSYNC 0xae
|
||||
#define YOOHOO 0xf1
|
||||
|
||||
/* DON'T CHANGE THIS VALUES! */
|
||||
/* SOME DON'T USE MACROS */
|
||||
#define TTY_SUCCESS 0
|
||||
#define TTY_TIMEOUT -1
|
||||
#define TTY_HANGUP -2
|
||||
#define TTY_ERROR -3
|
||||
|
||||
#define XSELECT(a,b,c) tty_xselect(a, b, c)
|
||||
#define WRITE(a,b) tty_write(a, b)
|
||||
#define READ(a,b) tty_read(a, b)
|
||||
#define WRITE_TIMEOUT(a,b) tty_write_timeout(a, b, 30)
|
||||
#define READ_TIMEOUT(a,b,c) tty_read_timeout(a, b, c)
|
||||
#define GETCHAR(a) tty_getc(a)
|
||||
#define CHARWAIT(a) tty_charwait(a)
|
||||
#define PUTCHAR(a) tty_putc(a, 30)
|
||||
#define BUFCHAR(a) tty_bufc(a, 30)
|
||||
#define PUTSTR(a) tty_puts(a, 30)
|
||||
#define CLEARIN() tty_clearin()
|
||||
#define CLEAROUT() tty_clearout()
|
||||
#define FLUSHOUT() tty_flushout()
|
||||
#define FLUSHBUF() tty_flushbuf(30)
|
||||
#define DTRHIGH() tio_setdtr(0, TRUE)
|
||||
#define DTRLOW() tio_setdtr(0, FALSE)
|
||||
#define SENDBREAK() tio_sendbreak()
|
||||
#define TTYRESET() \
|
||||
{ \
|
||||
tty_abort = 0; \
|
||||
tty_status = TTY_SUCCESS; \
|
||||
}
|
||||
#define TTYSTATUS(a) \
|
||||
{ \
|
||||
tty_online = a; \
|
||||
tty_hangup = 0; \
|
||||
tty_abort = 0; \
|
||||
tty_status = TTY_SUCCESS; \
|
||||
}
|
||||
|
||||
/*
|
||||
* io_unix_tty.c
|
||||
*/
|
||||
int tty_select(bool *rd, bool *wr, int timeout);
|
||||
int tty_xselect(bool *rd, bool *wr, int timeout);
|
||||
int tty_charwait(int timeout);
|
||||
int tty_read(unsigned char *buf, size_t size);
|
||||
int tty_read_timeout(unsigned char *buf, size_t size, int timeout);
|
||||
int tty_write(const unsigned char *buf, size_t size);
|
||||
int tty_write_timeout(const unsigned char *buf, size_t size, int timeout);
|
||||
int tty_putc(unsigned char ch, int timeout);
|
||||
int tty_puts(const unsigned char *s, int timeout);
|
||||
int tty_getc(int timeout);
|
||||
int tty_bufc(unsigned char ch, int timeout);
|
||||
int tty_flushout(void);
|
||||
int tty_flushbuf(int timeout);
|
||||
int tty_clearin(void);
|
||||
int tty_clearout(void);
|
||||
const char *tty_errstr(int status);
|
||||
|
||||
/*
|
||||
* io_unix_lock.c
|
||||
*/
|
||||
#define LOCKCHECK_NOLOCK 0
|
||||
#define LOCKCHECK_LOCKED 1
|
||||
#define LOCKCHECK_ERROR 2
|
||||
#define LOCKCHECK_OURLOCK 3
|
||||
|
||||
int port_checklock(const char *lockdir, const s_modemport *modemport);
|
||||
int port_lock(const char *lockdir, const s_modemport *modemport);
|
||||
int port_unlock(const char *lockdir, const s_modemport *modemport);
|
||||
|
||||
/*
|
||||
* io_unix_tio.c
|
||||
*/
|
||||
#ifdef HAVE_TERMIOS_H
|
||||
typedef struct termios TIO;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Flow control flags
|
||||
*/
|
||||
#define FLOW_HARD 0x01
|
||||
#define FLOW_SOFT 0x02
|
||||
|
||||
/*
|
||||
* Define our own RS232 line flags
|
||||
*/
|
||||
#ifdef TIOCM_DTR
|
||||
# define TIO_RS232_DTR TIOCM_DTR
|
||||
# define TIO_RS232_DSR TIOCM_DSR
|
||||
# define TIO_RS232_RTS TIOCM_RTS
|
||||
# define TIO_RS232_CTS TIOCM_CTS
|
||||
# ifdef TIOCM_CAR
|
||||
# define TIO_RS232_DCD TIOCM_CAR
|
||||
# else
|
||||
# define TIO_RS232_DCD TIOCM_CD
|
||||
# endif
|
||||
# ifdef TIOCM_RNG
|
||||
# define TIO_RS232_RNG TIOCM_RNG
|
||||
# else
|
||||
# define TIO_RS232_RNG TIOCM_RI
|
||||
# endif
|
||||
#else /* TIOCM_DTR */
|
||||
# define TIO_RS232_DTR 0x01
|
||||
# define TIO_RS232_DSR 0x02
|
||||
# define TIO_RS232_RTS 0x04
|
||||
# define TIO_RS232_CTS 0x08
|
||||
# define TIO_RS232_DCD 0x10
|
||||
# define TIO_RS232_RNG 0x20
|
||||
#endif /* TIOCM_DTR */
|
||||
|
||||
int tio_get(int fd, TIO *tio);
|
||||
int tio_set(int fd, TIO *tio);
|
||||
int tio_set_speed(TIO *tio, unsigned int speed);
|
||||
int tio_get_speed(TIO *tio);
|
||||
int tio_set_flow_control(int fd, TIO *tio, int flow);
|
||||
void tio_set_raw_mode(TIO *tio);
|
||||
void tio_set_local(TIO *tio, bool local);
|
||||
int tio_set_dtr(int fd, bool on);
|
||||
int tio_ctty(int fd);
|
||||
int tio_send_break(void);
|
||||
int tio_get_dcd(int fd);
|
||||
int tio_get_rs232_state(void);
|
||||
|
||||
/*
|
||||
* io_tcpip.c
|
||||
*/
|
||||
int tcpip_connect(const char *hostname, e_tcpmode tcpmode);
|
||||
int tcpip_init(void);
|
||||
int tcpip_shutdown(void);
|
||||
bool tcpip_isgood_host(const char *str);
|
||||
|
||||
/*
|
||||
* io_unix_modem.c
|
||||
*/
|
||||
char *port_get_name(const char *devname);
|
||||
int port_open(const s_modemport *port, int detach, TIO *oldtio);
|
||||
int port_init(int fd, int portspeed, TIO *oldtio, bool local);
|
||||
int port_carrier(int fd, bool online);
|
||||
int port_deinit(int fd, TIO *oldtio);
|
||||
void port_close(void);
|
||||
|
||||
/*
|
||||
* io_modem.c
|
||||
*/
|
||||
#define MODEM_OK 0
|
||||
#define MODEM_ERROR 1
|
||||
#define MODEM_CANTSEND 2
|
||||
#define MODEM_NORESP 3
|
||||
|
||||
extern const char *modem_errlist[];
|
||||
|
||||
long modem_getconnspeed(const char *connstr);
|
||||
bool modem_isgood_phone(const char *str);
|
||||
char *modem_transphone(char *buffer, const char *phone, size_t buflen);
|
||||
void modem_clearin(int timeout);
|
||||
int modem_putstr(const char *str);
|
||||
int modem_getline(char *buf, int bufsize, time_t timer);
|
||||
int modem_dial(const char *dialstr, int timeout, char **connstr);
|
||||
int modem_command(const char *command, int timeout, bool logit);
|
||||
int modem_hangup(const char *command, int timeout);
|
||||
bool modem_candialout(const char *modemdev);
|
||||
s_modemport *modem_getfree_port(const char *lockdir);
|
||||
s_modemport *modem_getmatch_port(const char *ttysubname);
|
||||
|
||||
#endif /* _IO_H_ */
|
||||
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* binkleyforce -- unix FTN mailer project
|
||||
*
|
||||
* Copyright (c) 1998-2000 Alexander Belkin, 2:5020/1398.11
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef _LOGGER_H_
|
||||
#define _LOGGER_H_
|
||||
|
||||
#include "confread.h"
|
||||
|
||||
/* enable this to use syslog facility */
|
||||
|
||||
#define USE_SYSLOG
|
||||
|
||||
|
||||
|
||||
enum { LOG_MODE_FILE, LOG_MODE_SYSLOG, LOG_MODE_MIXED };
|
||||
|
||||
enum { LOG_FILE_DAEMON, LOG_FILE_SESSION, LOG_FILE_DEBUG, LOG_FILE_HISTORY };
|
||||
|
||||
enum {
|
||||
LOG_EMERG = 0, /* system is unusable */
|
||||
LOG_ALERT = 1, /* action must be taken immediately */
|
||||
LOG_CRIT = 2, /* critical conditions */
|
||||
LOG_ERR = 3, /* error conditions */
|
||||
LOG_WARNING = 4, /* warning conditions */
|
||||
LOG_NOTICE = 5, /* normal but significant condition */
|
||||
LOG_INFO = 6, /* informational */
|
||||
LOG_DEBUG = 7 /* debug-level messages */
|
||||
};
|
||||
|
||||
#ifdef DEBUG
|
||||
# define D_CONFIG 0x0000001L
|
||||
# define D_OVERRIDE 0x0000002L
|
||||
# define D_EVENT 0x0000004L
|
||||
# define D_NODELIST 0x0000008L
|
||||
# define D_OUTBOUND 0x0000010L
|
||||
# define D_INFO 0x0000020L
|
||||
# define D_HSHAKE 0x0000040L
|
||||
# define D_TTYIO 0x0000080L
|
||||
# define D_MODEM 0x0000100L
|
||||
# define D_PROT 0x0000200L
|
||||
# define D_FREQ 0x0000400L
|
||||
# define D_STATEM 0x0000800L
|
||||
# define D_DAEMON 0x0001000L
|
||||
# define D_FULL 0xfffffffL
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
# define DEB(what) debug what
|
||||
#else
|
||||
# define DEB(what)
|
||||
#endif
|
||||
|
||||
const char *log_getfilename(int whatfor);
|
||||
bool log_isopened(void);
|
||||
/* #ifndef USE_SYSLOG
|
||||
void log_setident(const char *ident);
|
||||
#endif */ /* ifndef USE_SYSLOG */
|
||||
int log_open(const char *logname, const char *ext, const char *tty);
|
||||
int log_close(void);
|
||||
int log_reopen(const char *logname, const char *ext, const char *tty);
|
||||
int log(const char *s, ...);
|
||||
int logerr(const char *s, ...);
|
||||
|
||||
#ifdef DEBUG
|
||||
void debug_setlevel(long newlevel, bool logit);
|
||||
bool debug_isopened(void);
|
||||
void debug_setfilename(const char *debugname);
|
||||
int debug_parsestring(char *str, unsigned long *deblevel);
|
||||
int debug_open(const char *debugname);
|
||||
int debug_close(void);
|
||||
int debug(unsigned long what, const char *str, ...);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,168 @@
|
||||
/*
|
||||
* binkleyforce -- unix FTN mailer project
|
||||
*
|
||||
* Copyright (c) 1998-2000 Alexander Belkin, 2:5020/1398.11
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef _NODELIST_H_
|
||||
#define _NODELIST_H_
|
||||
|
||||
/*
|
||||
* Each nodelist has corresponding index file. Index file name is the
|
||||
* same as nodelist, but extension is changed to the ".bni", so index
|
||||
* file to the nodelist "net5020.ndl" will be called "net5020.bni"
|
||||
*
|
||||
* Nodelist index header:
|
||||
*
|
||||
* Offset Size Description
|
||||
* -------------------------------
|
||||
* 0x0000 4 bytes Nodelist file date
|
||||
* 0x0004 4 bytes Nodelist file size
|
||||
* 0x0008 4 bytes Total number of entries in index file
|
||||
* 0x000c 4 bytes Unused
|
||||
*
|
||||
* Nodelist index is an array of next entries:
|
||||
*
|
||||
* Offset Size Description
|
||||
* -------------------------------
|
||||
* 0x0010 2 bytes Zone number
|
||||
* 0x0012 2 bytes Net number
|
||||
* 0x0014 2 bytes Node number
|
||||
* 0x0016 2 bytes Point number
|
||||
* 0x0018 2 bytes HUB number (I hope HUB is in the same zone:net)
|
||||
* 0x001a 4 bytes Offset of string in nodelist file
|
||||
*
|
||||
*/
|
||||
|
||||
enum
|
||||
{
|
||||
NODELIST_HDRSIZE = 16, /* Don't change! */
|
||||
NODELIST_ENTRYSIZE = 14, /* Don't change! */
|
||||
NODELIST_READAHEAD = 50
|
||||
};
|
||||
|
||||
/*
|
||||
* Modes for nodelist_opendindex()
|
||||
*/
|
||||
enum nodelist_iomode
|
||||
{
|
||||
NODELIST_READ,
|
||||
NODELIST_WRITE
|
||||
};
|
||||
|
||||
/*
|
||||
* Positions of <...> in nodelist strings
|
||||
*/
|
||||
enum nodelist_positon
|
||||
{
|
||||
NODELIST_POSKEYWORD = 0,
|
||||
NODELIST_POSNUMBER = 1,
|
||||
NODELIST_POSNAME = 2,
|
||||
NODELIST_POSLOCATION = 3,
|
||||
NODELIST_POSSYSOP = 4,
|
||||
NODELIST_POSPHONE = 5,
|
||||
NODELIST_POSSPEED = 6,
|
||||
NODELIST_POSFLAGS = 7
|
||||
};
|
||||
|
||||
/*
|
||||
* Storage sizes for node structure
|
||||
*/
|
||||
enum nodelist_limit
|
||||
{
|
||||
BNI_MAXNAME = 48,
|
||||
BNI_MAXLOCATION = 48,
|
||||
BNI_MAXSYSOP = 48,
|
||||
BNI_MAXPHONE = 48,
|
||||
BNI_MAXFLAGS = 120
|
||||
};
|
||||
|
||||
/*
|
||||
* node->keyword values
|
||||
*/
|
||||
enum nodelist_keyword
|
||||
{
|
||||
KEYWORD_EMPTY,
|
||||
KEYWORD_ZONE,
|
||||
KEYWORD_REGION,
|
||||
KEYWORD_HOST,
|
||||
KEYWORD_HUB,
|
||||
KEYWORD_PVT,
|
||||
KEYWORD_HOLD,
|
||||
KEYWORD_DOWN,
|
||||
KEYWORD_BOSS,
|
||||
KEYWORD_POINT
|
||||
};
|
||||
|
||||
/*
|
||||
* Nodelist procedures error codes
|
||||
*/
|
||||
enum nodelist_error
|
||||
{
|
||||
BNIERR_NOERROR = 0,
|
||||
BNIERR_NODENOTFOUND = 1,
|
||||
BNIERR_IDXIOERR = 2,
|
||||
BNIERR_NDLIOERR = 3,
|
||||
BNIERR_BADINDEX = 4,
|
||||
BNIERR_NONODELIST = 5
|
||||
};
|
||||
|
||||
typedef struct nodelist
|
||||
{
|
||||
FILE *fp_index;
|
||||
FILE *fp_nodelist;
|
||||
char name_index[BF_MAXPATH+1];
|
||||
char name_nodelist[BF_MAXPATH+1];
|
||||
long entries;
|
||||
}
|
||||
s_nodelist;
|
||||
|
||||
typedef struct bni
|
||||
{
|
||||
int zone;
|
||||
int net;
|
||||
int node;
|
||||
int point;
|
||||
int hub;
|
||||
long offset;
|
||||
}
|
||||
s_bni;
|
||||
|
||||
typedef struct node
|
||||
{
|
||||
s_faddr addr;
|
||||
s_faddr addr_hub;
|
||||
enum nodelist_keyword keyword;
|
||||
bool listed;
|
||||
char name[BNI_MAXNAME+1];
|
||||
char location[BNI_MAXLOCATION+1];
|
||||
char sysop[BNI_MAXSYSOP+1];
|
||||
char phone[BNI_MAXPHONE+1];
|
||||
long speed;
|
||||
char flags[BNI_MAXFLAGS+1];
|
||||
s_timevec worktime;
|
||||
}
|
||||
s_node;
|
||||
|
||||
int nodelist_checkflag(const char *nodeflags, const char *flag);
|
||||
int nodelist_keywordval(const char *keyword);
|
||||
int nodelist_parsestring(s_node *node, char *str);
|
||||
s_nodelist *nodelist_open(const char *dir, const char *name, int mode);
|
||||
int nodelist_checkheader(s_nodelist *nlp);
|
||||
int nodelist_createheader(s_nodelist *nlp);
|
||||
int nodelist_close(s_nodelist *nlp);
|
||||
int nodelist_putindex(s_nodelist *nlp, const s_bni *bni);
|
||||
int nodelist_findindex(s_nodelist *nlp, s_bni *bni, s_faddr addr);
|
||||
int nodelist_getstr(s_nodelist *nlp, size_t offset, char *buffer, size_t buflen);
|
||||
int nodelist_lookup_string(char *buffer, size_t buflen, s_faddr addr);
|
||||
int nodelist_lookup(s_node *node, s_faddr addr);
|
||||
void nodelist_initnode(s_node *node, s_faddr addr);
|
||||
|
||||
#endif /* _NODELIST_H_ */
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* binkleyforce -- unix FTN mailer project
|
||||
*
|
||||
* Copyright (c) 1998-2000 Alexander Belkin, 2:5020/1398.11
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef _OS_H_
|
||||
#define _OS_H_
|
||||
|
||||
#define EXEC_OPT_NOWAIT 0x01
|
||||
#define EXEC_OPT_SETSID 0x02
|
||||
#define EXEC_OPT_LOGOUT 0x04
|
||||
#define EXEC_OPT_USESHELL 0x08
|
||||
|
||||
#define EXEC_MAX_NUM_ENVS 40
|
||||
#define EXEC_MAX_NUM_ARGS 20
|
||||
#define EXEC_DEFAULT_UMASK ~(S_IRUSR|S_IWUSR);
|
||||
|
||||
struct exec_options
|
||||
{
|
||||
/*
|
||||
* This variables must be set before running
|
||||
*/
|
||||
char *command;
|
||||
char *envp[EXEC_MAX_NUM_ENVS+1];
|
||||
int umask;
|
||||
int timeout;
|
||||
int options;
|
||||
|
||||
/*
|
||||
* This variables will store command execution status
|
||||
*/
|
||||
int retc;
|
||||
int runtime;
|
||||
};
|
||||
typedef struct exec_options s_exec_options;
|
||||
|
||||
int exec_file_exist(const char *command);
|
||||
void exec_options_init(s_exec_options *eopt);
|
||||
void exec_options_deinit(s_exec_options *eopt);
|
||||
void exec_env_add(s_exec_options *eopt, const char *name, const char *value);
|
||||
void exec_options_set_command(s_exec_options *eopt, const char *command);
|
||||
int exec_command(s_exec_options *eopt);
|
||||
|
||||
#if defined(OS2) || defined(W32)
|
||||
#define DIRSEPCHR '\\'
|
||||
#define DIRSEPSTR "\\"
|
||||
#else /* Unices */
|
||||
#define DIRSEPCHR '/'
|
||||
#define DIRSEPSTR "/"
|
||||
#endif
|
||||
|
||||
size_t getfreespace(const char *path);
|
||||
int xsystem(const char *command, const char *p_input, const char *p_output);
|
||||
|
||||
#ifndef HAVE_SETPROCTITLE
|
||||
void setargspace(char *argv[], char *envp[]);
|
||||
void setproctitle(const char *fmt, ...);
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_RENAME
|
||||
int rename(const char *old_name, const char *new_name);
|
||||
#endif
|
||||
|
||||
#endif /* _OS_H_ */
|
||||
@@ -0,0 +1,209 @@
|
||||
/*
|
||||
* binkleyforce -- unix FTN mailer project
|
||||
*
|
||||
* Copyright (c) 1998-2000 Alexander Belkin, 2:5020/1398.11
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef _OUTBOUND_H_
|
||||
#define _OUTBOUND_H_
|
||||
|
||||
#include "nodelist.h"
|
||||
|
||||
#define FLAVOR_NONE 0x000
|
||||
#define FLAVOR_HOLD 0x001
|
||||
#define FLAVOR_NORMAL 0x002
|
||||
#define FLAVOR_DIRECT 0x004
|
||||
#define FLAVOR_IMMED 0x008
|
||||
#define FLAVOR_CRASH 0x010
|
||||
|
||||
#define ACTION_NOTHING 0x000 /* Do nothing with file after ses. */
|
||||
#define ACTION_UNLINK 0x001 /* Unlink file if send successful */
|
||||
#define ACTION_TRUNCATE 0x002 /* Truncate file if send successful */
|
||||
#define ACTION_FORCEUNLINK 0x004 /* Unlink file in any case after ses.*/
|
||||
|
||||
#define TYPE_UNKNOWN 0x000
|
||||
#define TYPE_NETMAIL 0x001
|
||||
#define TYPE_ARCMAIL 0x002
|
||||
#define TYPE_TICFILE 0x004
|
||||
#define TYPE_FILEECHO 0x008
|
||||
#define TYPE_FILEBOX 0x010
|
||||
#define TYPE_FROMFLO 0x020
|
||||
#define TYPE_REQUEST 0x040
|
||||
#define TYPE_REQANSW 0x080 /* Our answer on incoming file req. */
|
||||
#define TYPE_FLOFILE 0x100
|
||||
#define TYPE_ASONAME 0x200 /* File with AmigaDOS Style Outbound */
|
||||
/* name (e.g. 2.5020.1398.11.out) */
|
||||
|
||||
#define STATUS_WILLSEND 0
|
||||
#define STATUS_SKIP 1
|
||||
#define STATUS_SENDING 2
|
||||
#define STATUS_SENT 3
|
||||
|
||||
#define QUEUE_SORT_ADDRESS 0x01
|
||||
#define QUEUE_SORT_SIZE 0x02
|
||||
#define QUEUE_SORT_REVERSE 0x04
|
||||
|
||||
typedef struct {
|
||||
FILE *fp;
|
||||
char att_path[BFORCE_MAX_PATH+1];
|
||||
int att_action;
|
||||
int att_offs; /* offset of the curent line */
|
||||
} s_FLO;
|
||||
|
||||
enum { OUTB_TYPE_BSO,
|
||||
OUTB_TYPE_DOMAIN,
|
||||
OUTB_TYPE_ASO,
|
||||
OUTB_TYPE_FBOX };
|
||||
|
||||
typedef struct outbound_callback_data {
|
||||
int (*callback)(struct outbound_callback_data *);
|
||||
void *dest;
|
||||
s_faddr addr;
|
||||
char *path;
|
||||
int flavor; /* Force this flavor for file */
|
||||
unsigned short type;
|
||||
} s_outbound_callback_data;
|
||||
|
||||
typedef struct filelist {
|
||||
struct filelist *next;
|
||||
char *fname;
|
||||
size_t size;
|
||||
unsigned short type;
|
||||
unsigned short status;
|
||||
unsigned short action;
|
||||
unsigned short flavor;
|
||||
short flodsc;
|
||||
} s_filelist;
|
||||
|
||||
typedef struct flofile {
|
||||
char *fname;
|
||||
short flavor;
|
||||
time_t mtime;
|
||||
} s_flofile;
|
||||
|
||||
typedef struct fsqueue {
|
||||
s_flofile *flotab;
|
||||
s_filelist *fslist;
|
||||
int flonum; /* Number of items in .?LO files table */
|
||||
} s_fsqueue;
|
||||
|
||||
#define TRIES_RESET -1 /* Use this macro to reset tries counter */
|
||||
#define HOLD_RESET 1 /* Use this macro to reset hold timer */
|
||||
|
||||
typedef struct sess_stat {
|
||||
bool undialable;
|
||||
int tries;
|
||||
int tries_noconn;
|
||||
int tries_nodial;
|
||||
int tries_noansw;
|
||||
int tries_hshake;
|
||||
int tries_sessns;
|
||||
unsigned long hold_until;
|
||||
unsigned long hold_freqs;
|
||||
unsigned long last_success;
|
||||
unsigned long last_success_in;
|
||||
unsigned long last_success_out;
|
||||
} s_sess_stat;
|
||||
|
||||
typedef struct sysentry {
|
||||
s_node node;
|
||||
bool lookedup;
|
||||
const s_override *overrides; /* List of all overrides */
|
||||
const s_override *lineptr; /* List of all overrides */
|
||||
s_sess_stat stat;
|
||||
int line; /* Current line number */
|
||||
bool tcpip; /* Call to the current line via TCP/IP? */
|
||||
bool busy; /* Address is busy [in an another queue, etc.] */
|
||||
time_t lastcall; /* Last call _finish_ time */
|
||||
time_t mailage; /* The oldest file modification time */
|
||||
size_t netmail_size;
|
||||
size_t arcmail_size;
|
||||
size_t request_size;
|
||||
size_t files_size;
|
||||
int flavors;
|
||||
int types;
|
||||
} s_sysentry;
|
||||
|
||||
typedef struct sysqueue {
|
||||
s_sysentry *systab;
|
||||
int sysnum;
|
||||
time_t holduntil;
|
||||
int current_modem;
|
||||
int current_tcpip;
|
||||
int next_modem;
|
||||
int next_tcpip;
|
||||
} s_sysqueue;
|
||||
|
||||
typedef struct exttab {
|
||||
const char *ext;
|
||||
int type;
|
||||
int flavor;
|
||||
int action;
|
||||
} s_exttab;
|
||||
|
||||
extern s_exttab outtab[];
|
||||
extern s_exttab exttab[];
|
||||
extern int (*sysqueue_add_callback)(s_sysentry *);
|
||||
extern int (*sysqueue_rem_callback)(s_sysentry *);
|
||||
extern bool sysqueue_dont_count_sizes;
|
||||
|
||||
/* outb_bsy.c */
|
||||
int out_bsy_check(s_faddr addr);
|
||||
#ifdef BFORCE_USE_CSY
|
||||
int out_bsy_lock(s_faddr addr, bool csy_locks);
|
||||
#else
|
||||
int out_bsy_lock(s_faddr addr);
|
||||
#endif
|
||||
int out_bsy_unlock(s_faddr addr);
|
||||
int out_bsy_unlockall(void);
|
||||
|
||||
/* outb_flo.h */
|
||||
s_FLO *flo_open(const char *path, const char *mode);
|
||||
int flo_next(s_FLO *FLO);
|
||||
int flo_mark_sent(s_FLO *FLO);
|
||||
int flo_eof(s_FLO *FLO);
|
||||
int flo_close(s_FLO *FLO);
|
||||
bool out_flo_isempty(const char *path);
|
||||
int out_flo_marksent(const char *fname, const char *floname);
|
||||
int out_flo_getsizes(const char *floname, size_t *arcmail, size_t *files);
|
||||
int out_flo_unlinkempty(const s_flofile *flotab, int flonum);
|
||||
|
||||
/* outb_getname.c */
|
||||
char *out_getname_4d(s_faddr addr);
|
||||
char *out_getname_domain(s_faddr addr);
|
||||
char *out_getname_amiga(s_faddr addr);
|
||||
|
||||
/* outb_queue.c */
|
||||
int out_filetype(const char *fname);
|
||||
int out_handle_fsqueue(s_outbound_callback_data *callback);
|
||||
void deinit_filelist(s_filelist *filelist);
|
||||
void deinit_fsqueue(s_fsqueue *q);
|
||||
#ifdef DEBUG
|
||||
void log_filelist(const s_filelist *filelist);
|
||||
void log_fsqueue(const s_fsqueue *q);
|
||||
#endif
|
||||
|
||||
/* outb_main.c */
|
||||
int out_get_root(const char *outbound, char **out_root, char **out_main);
|
||||
int out_parse_name_aso(s_faddr *addr, const char *name);
|
||||
int out_scan(s_outbound_callback_data *callback, const s_falist *fa_list);
|
||||
|
||||
/* outb_sysqueue.c */
|
||||
void out_reset_trycounters(s_sysentry *syst);
|
||||
void out_reset_sysqueue(s_sysqueue *q);
|
||||
void out_sysqueue_sort(s_sysqueue *q, int opts);
|
||||
void out_remove_from_sysqueue(s_sysqueue *q, int pos);
|
||||
int out_handle_sysqueue(s_outbound_callback_data *callback);
|
||||
void deinit_sysqueue(s_sysqueue *q);
|
||||
#ifdef DEBUG
|
||||
void log_sysqueue(const s_sysqueue *q);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,160 @@
|
||||
/*
|
||||
* binkleyforce -- unix FTN mailer project
|
||||
*
|
||||
* Copyright (c) 1998-2000 Alexander Belkin, 2:5020/1398.11
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* binkp's frames:
|
||||
*
|
||||
* +---------------------- 0=data block, 1=message(command)
|
||||
* | +---- data block size / msg's argument size
|
||||
* | |
|
||||
* 7 6543210 76543210
|
||||
* +-+-------+--------+--- ... ---+
|
||||
* | | HI LO | | -- data block / msg's argument
|
||||
* +-+-------+--------+--- ... ---+
|
||||
*/
|
||||
|
||||
#ifndef _P_BINKP_H_
|
||||
#define _P_BINKP_H_
|
||||
|
||||
#define BINKP_NAME "binkp"
|
||||
#define BINKP_MAJOR 1
|
||||
#define BINKP_MINOR 0
|
||||
#define BINKP_PORT 24554
|
||||
#define BINKP_TIMEOUT (5*60)
|
||||
#define BINKP_MIN_BLKSIZE 128
|
||||
#define BINKP_MAX_BLKSIZE 0x7fff
|
||||
#define BINKP_DEF_BLKSIZE (4*1024u)
|
||||
#define BINKP_BLK_HDRSIZE 2
|
||||
|
||||
#define BINKP_MAXPASSWD 64
|
||||
#define BINKP_MAXSYSTNAME 120
|
||||
#define BINKP_MAXLOCATION 120
|
||||
#define BINKP_MAXSYSOP 120
|
||||
#define BINKP_MAXPHONE 120
|
||||
#define BINKP_MAXFLAGS 120
|
||||
#define BINKP_MAXLOCATION 120
|
||||
#define BINKP_MAXPROGNAME 40
|
||||
#define BINKP_MAXPROTNAME 40
|
||||
#define BINKP_MAXTIMESTR 40
|
||||
#define BINKP_MAXCHALLENGE 128
|
||||
#define BINKP_MAXOPT 196
|
||||
|
||||
#define BINKP_OPT_NR 0x01 /* Non-reliable mode */
|
||||
#define BINKP_OPT_MB 0x02 /* Multiple batch mode */
|
||||
#define BINKP_OPT_MPWD 0x04 /* Multiple passwods mode */
|
||||
#define BINKP_OPT_MD5 0x08 /* CRAM-MD5 authentication */
|
||||
#define BINKP_OPT_SHA1 0x10 /* CRAM-SHA1 authentication */
|
||||
#define BINKP_OPT_DES 0x20 /* CRAM-DES authentication */
|
||||
|
||||
typedef struct {
|
||||
s_sysaddr *addrs;
|
||||
int anum;
|
||||
char passwd[BINKP_MAXPASSWD+1];
|
||||
char systname[BINKP_MAXSYSTNAME+1];
|
||||
char location[BINKP_MAXLOCATION+1];
|
||||
char sysop[BINKP_MAXSYSOP+1];
|
||||
char phone[BINKP_MAXPHONE+1];
|
||||
char flags[BINKP_MAXFLAGS+1];
|
||||
char progname[BINKP_MAXPROGNAME+1];
|
||||
char protname[BINKP_MAXPROTNAME+1];
|
||||
char timestr[BINKP_MAXTIMESTR+1];
|
||||
char opt[BINKP_MAXOPT+1];
|
||||
int majorver;
|
||||
int minorver;
|
||||
int options;
|
||||
char challenge[BINKP_MAXCHALLENGE+1];
|
||||
int challenge_length;
|
||||
} s_binkp_sysinfo;
|
||||
|
||||
|
||||
typedef enum {
|
||||
/*
|
||||
* Pseudo message types, returned by binkp_recv()
|
||||
*/
|
||||
BPMSG_EXIT = -3, /* Terminate session */
|
||||
BPMSG_NONE = -2, /* Got nothing intresting */
|
||||
BPMSG_DATA = -1, /* Got data block */
|
||||
/*
|
||||
* Real BinkP message types
|
||||
*/
|
||||
BPMSG_NUL = 0, /* Site information */
|
||||
BPMSG_ADR, /* List of addresses */
|
||||
BPMSG_PWD, /* Session password */
|
||||
BPMSG_FILE, /* File information */
|
||||
BPMSG_OK, /* Password was acknowleged (data ignored) */
|
||||
BPMSG_EOB, /* End Of Batch (data ignored) */
|
||||
BPMSG_GOT, /* File received */
|
||||
BPMSG_ERR, /* Misc errors */
|
||||
BPMSG_BSY, /* All AKAs are busy */
|
||||
BPMSG_GET, /* Get a file from offset */
|
||||
BPMSG_SKIP, /* Skip a file (RECEIVE LATER) */
|
||||
BPMSG_MIN = BPMSG_NUL, /* Minimal message type value */
|
||||
BPMSG_MAX = BPMSG_SKIP /* Maximal message type value */
|
||||
} e_bpmsg;
|
||||
|
||||
|
||||
typedef struct {
|
||||
bool sent; /* Sent message (queued) */
|
||||
e_bpmsg type; /* Message type */
|
||||
int size; /* Message size (length of text) */
|
||||
char *data; /* Message text */
|
||||
} s_bpmsg;
|
||||
|
||||
|
||||
typedef struct {
|
||||
char *obuf; /* Output buffer */
|
||||
int opos; /* Unsent bytes left in buffer */
|
||||
char *optr; /* Send data from this position */
|
||||
|
||||
char *ibuf; /* Our input buffer */
|
||||
int ipos;
|
||||
int isize;
|
||||
bool imsg; /* Is it message? */
|
||||
bool inew;
|
||||
e_bpmsg imsgtype; /* Message type */
|
||||
|
||||
int junkcount;
|
||||
s_bpmsg *msgqueue; /* Outgoing messages queue */
|
||||
int n_msgs; /* Number of messages in queue */
|
||||
|
||||
int timeout;
|
||||
} s_bpinfo;
|
||||
|
||||
/* prot_binkp.c */
|
||||
int binkp_outgoing(s_binkp_sysinfo *local_data, s_binkp_sysinfo *remote_data);
|
||||
int binkp_incoming(s_binkp_sysinfo *local_data, s_binkp_sysinfo *remote_data);
|
||||
int binkp_transfer(s_protinfo *pi);
|
||||
|
||||
/* prot_binkp_misc.c */
|
||||
void binkp_init_bpinfo(s_bpinfo *bpi);
|
||||
void binkp_deinit_bpinfo(s_bpinfo *bpi);
|
||||
int binkp_gethdr(const char *s);
|
||||
int binkp_getmsgtype(char ch);
|
||||
void binkp_puthdr(char *s, unsigned int u);
|
||||
void binkp_putmsgtype(char *s, e_bpmsg msg);
|
||||
void binkp_queuemsg(s_bpinfo *bpi, e_bpmsg msg, const char *s1, const char *s2);
|
||||
void binkp_queuemsgf(s_bpinfo *bpi, e_bpmsg msg, const char *fmt, ...);
|
||||
int binkp_parsfinfo(char *s, char **fn, size_t *sz, time_t *tm, size_t *offs);
|
||||
int binkp_buffer_message(s_bpinfo *bpi, s_bpmsg *msg);
|
||||
int binkp_send_buffer(s_bpinfo *bpi);
|
||||
int binkp_send(s_bpinfo *bpi);
|
||||
int binkp_flush_queue(s_bpinfo *bpi, int timeout);
|
||||
int binkp_recv(s_bpinfo *bpi);
|
||||
void binkp_update_sysinfo(s_binkp_sysinfo *binkp);
|
||||
void binkp_log_sysinfo(s_binkp_sysinfo *binkp);
|
||||
void binkp_queue_sysinfo(s_bpinfo *bpi, s_binkp_sysinfo *binkp);
|
||||
void binkp_set_sysinfo(s_binkp_sysinfo *binkp, s_faddr *remote_addr, bool caller);
|
||||
void binkp_parse_options(s_binkp_sysinfo *binkp, char *options);
|
||||
|
||||
/* prot_binkp_api.c */
|
||||
extern s_handshake_protocol handshake_protocol_binkp;
|
||||
|
||||
#endif /* _P_BINKP_H_ */
|
||||
@@ -0,0 +1,136 @@
|
||||
/*
|
||||
* binkleyforce -- unix FTN mailer project
|
||||
*
|
||||
* Copyright (c) 1998-2000 Alexander Belkin, 2:5020/1398.11
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef _P_COMMON_H_
|
||||
#define _P_COMMON_H_
|
||||
|
||||
#include "outbound.h"
|
||||
|
||||
/* File transfer protocols return codes */
|
||||
#define PRC_NOERROR 0 /* No comments :) */
|
||||
#define PRC_ERROR 1 /* I/O error occured while snd./rcv. */
|
||||
#define PRC_REMOTEABORTED 2 /* "ABORT" initiated by remote */
|
||||
#define PRC_LOCALABORTED 3 /* We got SIGINT/SIGTERM? */
|
||||
#define PRC_CPSTOOLOW 4 /* Cps was so low.. :( */
|
||||
#define PRC_STOPTIME 5 /* Aborted due to the time limits */
|
||||
|
||||
/* Send/Recv file status values */
|
||||
#define FSTAT_PROCESS 1
|
||||
#define FSTAT_WAITACK 2
|
||||
#define FSTAT_SUCCESS 3
|
||||
#define FSTAT_SKIPPED 4
|
||||
#define FSTAT_REFUSED 5
|
||||
|
||||
typedef struct traffic {
|
||||
int netmail_num; /* Number of netmail packets */
|
||||
int netmail_time; /* Netmail packets sending/receiving time */
|
||||
size_t netmail_size; /* Size of netmail packtes */
|
||||
int arcmail_num; /* Dito.. */
|
||||
int arcmail_time;
|
||||
size_t arcmail_size;
|
||||
int files_num;
|
||||
int files_time;
|
||||
size_t files_size;
|
||||
int freqed_num;
|
||||
int freqed_time;
|
||||
size_t freqed_size;
|
||||
} s_traffic;
|
||||
|
||||
/*
|
||||
* Information on currently receiveing/transmitting file
|
||||
*/
|
||||
typedef struct finfo {
|
||||
FILE *fp; /* File descriptor of current file */
|
||||
char *local_name; /* Local file name that is used at our side */
|
||||
char *net_name; /* File name as it known to the remote side */
|
||||
char *fname; /* Local file name with full path */
|
||||
time_t start_time; /* Start of current file rx/tx transactions */
|
||||
time_t mod_time; /* File last modification time */
|
||||
mode_t mode;
|
||||
size_t bytes_total; /* File size */
|
||||
size_t bytes_sent;
|
||||
size_t bytes_received;
|
||||
size_t bytes_skipped; /* crash recovery */
|
||||
int eofseen; /* end of file seen */
|
||||
int status;
|
||||
int action;
|
||||
int type;
|
||||
int flodsc; /* Index number in flo files table */
|
||||
} s_finfo;
|
||||
|
||||
/*
|
||||
* Transfer protocol related structure
|
||||
*/
|
||||
typedef struct protinfo {
|
||||
/* ----------------------------------------------------------------- */
|
||||
/* Variables defined before protocol starting */
|
||||
/* ----------------------------------------------------------------- */
|
||||
bool reqs_only; /* Send only .REQ files (for Hydra RH1 mode) */
|
||||
time_t stop_time; /* Stop transfer at this time */
|
||||
int freq_timelimit; /* Abort transfer if send freqs longer this */
|
||||
int min_tx_cps; /* Minimal transmite speed */
|
||||
int min_rx_cps; /* Minimal receive speed */
|
||||
int min_cps_time; /* Abort transfer if minimal bps stay during
|
||||
this time period */
|
||||
char *buffer; /* Ptr. to buffer for buffered file saving */
|
||||
size_t buflen; /* Buffer size */
|
||||
/* ----------------------------------------------------------------- */
|
||||
/* All variables below used by misc protocol routines */
|
||||
/* ----------------------------------------------------------------- */
|
||||
s_filelist *filelist; /* List of files.. It is our answer on .req! */
|
||||
int tx_cps; /* Current transmite CPS */
|
||||
int rx_cps; /* Current receive CPS */
|
||||
int send_freqtime; /* Time we spend at sending REQed files */
|
||||
time_t tx_low_cps_time; /* If CPS lower min_tx_cps it is time how
|
||||
long it lasts */
|
||||
time_t rx_low_cps_time; /* Same, but for transmite CPS */
|
||||
time_t start_time; /* Time transfer started at */
|
||||
|
||||
s_traffic traffic_sent;
|
||||
s_traffic traffic_rcvd;
|
||||
size_t send_left_size;
|
||||
size_t recv_left_size;
|
||||
int send_left_num;
|
||||
int recv_left_num;
|
||||
|
||||
s_finfo *send;
|
||||
s_finfo *recv;
|
||||
s_finfo *sentfiles;
|
||||
s_finfo *rcvdfiles;
|
||||
int n_sentfiles;
|
||||
int n_rcvdfiles;
|
||||
} s_protinfo;
|
||||
|
||||
extern const char *Protocols[]; /* Protocol names */
|
||||
|
||||
int p_tx_fopen(s_protinfo *pi);
|
||||
int p_tx_fclose(s_protinfo *pi);
|
||||
int p_tx_readfile(char *buf, size_t sz, s_protinfo *pi);
|
||||
int p_rx_writefile(const char *buf, size_t sz, s_protinfo *pi);
|
||||
int p_compfinfo(s_finfo *finf, const char *fn, size_t sz, time_t tm);
|
||||
int p_rx_fopen(s_protinfo *pi, char *f_name, size_t f_size, time_t f_modtime, mode_t f_mode);
|
||||
int p_rx_fclose(s_protinfo *pi);
|
||||
int p_info(s_protinfo *pi, int bidir);
|
||||
void prot_update_traffic(s_protinfo *pi, const s_fsqueue *q);
|
||||
void p_log_txrxstat(const s_protinfo *pi);
|
||||
void p_session_cleanup(s_protinfo *pi, bool success);
|
||||
void p_shortname(char *name);
|
||||
char *prot_unique_name(char *dirname, char *fname, int type);
|
||||
void p_checkname(char *name);
|
||||
void deinit_finfo(s_finfo *fi);
|
||||
void init_protinfo(s_protinfo *pi, bool caller);
|
||||
void deinit_protinfo(s_protinfo *pi);
|
||||
char *p_convfilename(const char *origname, int type);
|
||||
char *p_gettmpname(const char *inbound, char *fname, s_faddr addr, size_t sz, time_t tm);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,221 @@
|
||||
/*
|
||||
* binkleyforce -- unix FTN mailer project
|
||||
*
|
||||
* Copyright (c) 1998-2000 Alexander Belkin, 2:5020/1398.11
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef _S_EMSI_H_
|
||||
#define _S_EMSI_H_
|
||||
|
||||
/*
|
||||
* EMSI limits
|
||||
*/
|
||||
#define EMSI_MAXDAT 16384
|
||||
#define EMSI_MAXNFLAG 20
|
||||
#define EMSI_MAXPASSWD 30
|
||||
#define EMSI_MAXMPID 30
|
||||
#define EMSI_MAXMNAME 120
|
||||
#define EMSI_MAXMVER 120
|
||||
#define EMSI_MAXMREG 120
|
||||
#define EMSI_MAXSYSNAME 120
|
||||
#define EMSI_MAXLOCATION 120
|
||||
#define EMSI_MAXSYSOP 120
|
||||
#define EMSI_MAXPHONE 120
|
||||
#define EMSI_MAXFLAGS 120
|
||||
#define EMSI_MAXOHTIME 120
|
||||
#define EMSI_MAXFRTIME 120
|
||||
#define EMSI_MAXXDATETIME 60
|
||||
#define EMSI_MAXADDONS 120
|
||||
|
||||
/*
|
||||
* EMSI XXn flags that affect only address number n in AKA list
|
||||
*/
|
||||
#define EMSI_FLAG_PU 0x0001 /* Pickup FILES for this address */
|
||||
#define EMSI_FLAG_HA 0x0002 /* Hold all FILES for this address */
|
||||
#define EMSI_FLAG_PM 0x0004 /* PickUp Mail ONLY for this address */
|
||||
#define EMSI_FLAG_NF 0x0008 /* No TIC'S, associated files or file attaches */
|
||||
/* for this address */
|
||||
#define EMSI_FLAG_NX 0x0010 /* No compressed mail pickup desired, */
|
||||
/* for this address */
|
||||
#define EMSI_FLAG_NR 0x0020 /* File requests not accepted by caller */
|
||||
/* for this address */
|
||||
#define EMSI_FLAG_HN 0x0040 /* Hold all traffic EXCEPT Mail (ARCmail and */
|
||||
/* Packets) for this address */
|
||||
#define EMSI_FLAG_HX 0x0080 /* Hold compressed mail for this address */
|
||||
#define EMSI_FLAG_HF 0x0100 /* Hold tic's and associated files and file */
|
||||
/* attaches other than mail for this address */
|
||||
#define EMSI_FLAG_HR 0x0200 /* Hold file requests (not processed at this */
|
||||
/* time)for this address */
|
||||
|
||||
/*
|
||||
* Defines for state machine
|
||||
*/
|
||||
#define SME -1
|
||||
#define SM0 0
|
||||
#define SM1 1
|
||||
#define SM2 2
|
||||
#define SM3 3
|
||||
#define SM4 4
|
||||
#define SM5 5
|
||||
#define SM6 6
|
||||
#define SM7 7
|
||||
#define SM8 8
|
||||
#define SM9 9
|
||||
|
||||
struct states
|
||||
{
|
||||
const char *st_name;
|
||||
int (*proc)();
|
||||
};
|
||||
typedef struct states s_states;
|
||||
|
||||
struct linkcodes
|
||||
{
|
||||
/*
|
||||
* EMSI-I (FSC-0056) and EMSI-II (FSC-0088) flags
|
||||
* for XXn flags see s_emsiaddr structure
|
||||
*/
|
||||
|
||||
UINT32 N81:1, /* Communication parameter emulation :) (EMSI-I) */
|
||||
PUP:1, /* Pickup FILES for primary address only */
|
||||
PUA:1, /* Pickup FILES for all presented addresses */
|
||||
NPU:1, /* No FILE pickup desired. (calling system) */
|
||||
HAT:1, /* Hold all FILES (answering system) */
|
||||
PMO:1, /* PickUp Mail (ARCmail and Packets) ONLY */
|
||||
NFE:1, /* No TIC'S, associated files or files attaches */
|
||||
/* desired */
|
||||
NXP:1, /* No compressed mail pickup desired */
|
||||
NRQ:1, /* File requests not accepted by caller */
|
||||
/* This flag is presented if file request processing */
|
||||
/* is disabled TEMPORARILY for any reason */
|
||||
HNM:1, /* Hold all traffic EXCEPT Mail(ARCmail and Packets) */
|
||||
HXT:1, /* Hold compressed mail traffic. */
|
||||
HFE:1, /* Hold tic's and associated files */
|
||||
/* and file attaches other than mail */
|
||||
HRQ:1, /* Hold file requests (not processed at this time) */
|
||||
/* this flag is presented if file request processing */
|
||||
/* is disabled TEMPORARILY for any reason */
|
||||
FNC:1, /* Convert file names to "msdos" format */
|
||||
RMA:1, /* System is able to process multiple file requests */
|
||||
RH1:1; /* Under Hydra batch 1 contain file requests only, */
|
||||
/* while batch 2 is reserved for all other files */
|
||||
};
|
||||
typedef struct linkcodes s_linkcodes;
|
||||
|
||||
struct compcodes
|
||||
{
|
||||
UINT16 NCP:1, /* No compatible protocols (failure) */
|
||||
ZMO:1, /* Zmodem w/1,024 byte data packets */
|
||||
ZAP:1, /* ZedZap (Zmodem variant) */
|
||||
DZA:1, /* DirectZAP (Zmodem variant) */
|
||||
JAN:1, /* Janus */
|
||||
HYD:1; /* Hydra */
|
||||
|
||||
UINT16 FRQ:1, /* The system will accept and process FREQs */
|
||||
NRQ:1, /* No file requests accepted by this system */
|
||||
ARC:1, /* ARCmail 0.60-capable */
|
||||
XMA:1, /* Supports other forms of compressed mail */
|
||||
FNC:1, /* Filename conversion into 8.3 format */
|
||||
EII:1, /* EMSI-II flags are supported */
|
||||
DFB:1, /* Can fall-back to FTS1/WAZOO negotiation */
|
||||
CHT:1, /* Chat during transmittion available */
|
||||
BBS:1, /* Site has public BBS available */
|
||||
HFR:1; /* Remote will automaticaly hold requested */
|
||||
/* files for us */
|
||||
};
|
||||
typedef struct compcodes s_compcodes;
|
||||
|
||||
struct emsi
|
||||
{
|
||||
/*
|
||||
* Keep here all unknown EMSI_DAT addons
|
||||
*/
|
||||
char addons[EMSI_MAXADDONS+1];
|
||||
|
||||
/*
|
||||
* {EMSI_DAT} (main handshake information)
|
||||
*/
|
||||
bool have_emsi;
|
||||
s_sysaddr *addrs; /* dynamicaly allocated array */
|
||||
int anum; /* number of used entries in it */
|
||||
char passwd[EMSI_MAXPASSWD+1];
|
||||
s_linkcodes linkcodes; /* XXn linkcodes contained in eaddr */
|
||||
s_compcodes compcodes;
|
||||
char m_pid[EMSI_MAXMPID+1];
|
||||
char m_name[EMSI_MAXMNAME+1];
|
||||
char m_ver[EMSI_MAXMVER+1];
|
||||
char m_reg[EMSI_MAXMREG+1];
|
||||
|
||||
/*
|
||||
* {IDENT} (system information)
|
||||
*/
|
||||
bool have_ident;
|
||||
char sname[EMSI_MAXSYSNAME+1];
|
||||
char location[EMSI_MAXLOCATION+1];
|
||||
char sysop[EMSI_MAXSYSOP+1];
|
||||
char phone[EMSI_MAXPHONE+1];
|
||||
int speed;
|
||||
char flags[EMSI_MAXFLAGS+1];
|
||||
|
||||
/*
|
||||
* {TRAF} (size of netmail and arcmail files on hold)
|
||||
*/
|
||||
bool have_traf;
|
||||
size_t netmail_size;
|
||||
size_t arcmail_size;
|
||||
|
||||
/*
|
||||
* {MOH#} (size of files on hold? :))
|
||||
*/
|
||||
bool have_moh;
|
||||
size_t files_size;
|
||||
|
||||
/*
|
||||
* {OHFR} (site's work and freq time intervals)
|
||||
*/
|
||||
bool have_ohfr;
|
||||
char oh_time[EMSI_MAXOHTIME+1];
|
||||
char fr_time[EMSI_MAXFRTIME+1];
|
||||
|
||||
/*
|
||||
* {TZUTC} (site's time zone)
|
||||
*/
|
||||
bool have_tzutc;
|
||||
int tzutc;
|
||||
|
||||
/*
|
||||
* {XDATETIME} (site's date and time in extended format)
|
||||
*/
|
||||
bool have_xdatetime;
|
||||
char xdatetime[EMSI_MAXXDATETIME+1];
|
||||
|
||||
/*
|
||||
* {TRX#} (site's current time)
|
||||
*/
|
||||
bool have_trx;
|
||||
time_t time;
|
||||
};
|
||||
typedef struct emsi s_emsi;
|
||||
|
||||
/* prot_emsi.c */
|
||||
int emsi_send_emsidat(s_emsi *local_emsi);
|
||||
int emsi_recv_emsidat(s_emsi *remote_emsi);
|
||||
void emsi_set_sysinfo(s_emsi *emsi, s_emsi *remote_emsi, int hrc,
|
||||
e_protocol protocol);
|
||||
|
||||
/* prot_emsi_api.c */
|
||||
extern s_handshake_protocol handshake_protocol_emsi;
|
||||
|
||||
/* prot_emsi_misc.c */
|
||||
char *emsi_createdat(s_emsi *emsi);
|
||||
int emsi_parsedat(char *emsi_dat, s_emsi *emsi);
|
||||
void emsi_logdat(s_emsi *emsi);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* binkleyforce -- unix FTN mailer project
|
||||
*
|
||||
* Copyright (c) 1998-2000 Alexander Belkin, 2:5020/1398.11
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef _S_YOOHOO_H_
|
||||
#define _S_YOOHOO_H_
|
||||
|
||||
#define YOOHOO_HELLOLEN 128 /* Size of the 'HELLO' frame */
|
||||
#define YOOHOO_MAXFIELD 40
|
||||
|
||||
/*
|
||||
* Information for/from yoohoo handshake (real packet size is 128 bytes)
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
s_sysaddr *addrs; /* FTN address */
|
||||
int anum;
|
||||
int product_code; /* product code */
|
||||
int version_maj; /* major revision of the product */
|
||||
int version_min; /* minor revision of the product */
|
||||
char system[YOOHOO_MAXFIELD+1];
|
||||
char sysop[YOOHOO_MAXFIELD+1];
|
||||
char passwd[YOOHOO_MAXFIELD+1];
|
||||
int capabilities;
|
||||
}
|
||||
s_yoohoo_sysinfo;
|
||||
|
||||
#define YOOHOO_DIETIFNA 0x0001 /* Can do fast "FTS-0001" */
|
||||
#define YOOHOO_FTB_USER 0x0002 /* Reserved by Opus-CBCS */
|
||||
#define YOOHOO_ZMODEM 0x0004 /* Does ZModem, 1K blocks */
|
||||
#define YOOHOO_ZEDZAP 0x0008 /* Can do ZModem variant */
|
||||
#define YOOHOO_JANUS 0x0010 /* Can do Janus */
|
||||
#define YOOHOO_HYDRA 0x0020 /* Can do Hydra */
|
||||
#define YOOHOO_Bit_6 0x0040 /* reserved by FTSC */
|
||||
#define YOOHOO_Bit_7 0x0080 /* reserved by FTSC */
|
||||
#define YOOHOO_Bit_8 0x0100 /* reserved by FTSC */
|
||||
#define YOOHOO_Bit_9 0x0200 /* reserved by FTSC */
|
||||
#define YOOHOO_Bit_a 0x0400 /* reserved by FTSC */
|
||||
#define YOOHOO_Bit_b 0x0800 /* reserved by FTSC */
|
||||
#define YOOHOO_Bit_c 0x1000 /* reserved by FTSC */
|
||||
#define YOOHOO_Bit_d 0x2000 /* reserved by FTSC */
|
||||
#define YOOHOO_DO_DOMAIN 0x4000 /* Packet contains domain */
|
||||
#define YOOHOO_WZ_FREQ 0x8000 /* WZ file req. ok */
|
||||
|
||||
/* prot_yoohoo.c */
|
||||
int yoohoo_send_hello(s_yoohoo_sysinfo *local_data);
|
||||
int yoohoo_recv_hello(s_yoohoo_sysinfo *remote_data);
|
||||
void yoohoo_set_sysinfo(s_yoohoo_sysinfo *local_data, int hrc,
|
||||
e_protocol protocol);
|
||||
void yoohoo_log_sysinfo(s_yoohoo_sysinfo *yoohoo);
|
||||
|
||||
/* prot_yoohoo_api.c */
|
||||
extern s_handshake_protocol handshake_protocol_yoohoo;
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,222 @@
|
||||
/*
|
||||
* binkleyforce -- unix FTN mailer project
|
||||
*
|
||||
* Copyright (c) 1998-2000 Alexander Belkin, 2:5020/1398.11
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* Z M O D E M . H Manifest constants for ZMODEM
|
||||
* application to application file transfer protocol
|
||||
* 05-23-87 Chuck Forsberg Omen Technology Inc
|
||||
*/
|
||||
|
||||
#ifndef _P_ZMODEM_H_
|
||||
#define _P_ZMODEM_H_
|
||||
|
||||
#include "prot_common.h"
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Z-Modem chracteristics definitions */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
#define ZDEADTIMER 180 /* If expired think remote side is dead */
|
||||
#define ZRXTIMEOUT 120 /* Time to wait for receiving whole block */
|
||||
#define ZWAITTIME 30 /* Time to wait for character */
|
||||
#define ZMAXBLOCKLEN 8192 /* Maximal zmodem RX/TX block size */
|
||||
#define ZMAXTRIES 10 /* Maximal number of tries to do somthing */
|
||||
#define ZRXSKIPFIN 2 /* Number of ZFINs to ignore at start up */
|
||||
#define ZMAXFNAME 4096 /* Max. file name, to avoid txbuf overflow */
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Z-Modem constants definition */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
#define ZPAD '*' /* 052 Padding character begins frames */
|
||||
#define ZDLE 030 /* Ctrl-X Zmodem escape - `ala BISYNC DLE */
|
||||
#define ZBIN 'A' /* Binary frame indicator */
|
||||
#define ZHEX 'B' /* HEX frame indicator */
|
||||
#define ZBIN32 'C' /* Binary frame with 32 bit FCS */
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Frame types (see array "Frametypes" in zm.c) */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
#define ZCRCERR -5 /* CRC error */
|
||||
#define ZERROR -4 /* Miscelaneouse errors */
|
||||
#define ZEXIT -3 /* Critical errors */
|
||||
#define ZHANGUP -2 /* No Carrier */
|
||||
#define ZTIMER -1 /* Time out waiting for smth. */
|
||||
#define ZOK 0 /* All right */
|
||||
/*
|
||||
* TTY_TIMEOUT -1 \
|
||||
* TTY_HANGUP -2 > defined in ttyio.h
|
||||
* TTY_ERROR -3 /
|
||||
*/
|
||||
#define ZRQINIT 0 /* Request receive init */
|
||||
#define ZRINIT 1 /* Receive init */
|
||||
#define ZSINIT 2 /* Send init sequence (optional) */
|
||||
#define ZACK 3 /* ACK to above */
|
||||
#define ZFILE 4 /* File name from sender */
|
||||
#define ZSKIP 5 /* To sender: skip this file */
|
||||
#define ZNAK 6 /* Last packet was garbled */
|
||||
#define ZABORT 7 /* Abort batch transfers */
|
||||
#define ZFIN 8 /* Finish session */
|
||||
#define ZRPOS 9 /* Resume data trans at this position */
|
||||
#define ZDATA 10 /* Data packet(s) follow */
|
||||
#define ZEOF 11 /* End of file */
|
||||
#define ZFERR 12 /* Fatal Read or Write error Detected */
|
||||
#define ZCRC 13 /* Request for file CRC and response */
|
||||
#define ZCHALLENGE 14 /* Receiver's Challenge */
|
||||
#define ZCOMPL 15 /* Request is complete */
|
||||
#define ZCAN 16 /* Other end canned session with CAN*5 */
|
||||
#define ZFREECNT 17 /* Request for free bytes on filesystem */
|
||||
#define ZCOMMAND 18 /* Command from sending program */
|
||||
#define ZSTDERR 19 /* Output to standard error, data follows */
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* ZDLE sequences */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
#define ZCRCE 'h' /* CRC next, frame ends, header packet follows */
|
||||
#define ZCRCG 'i' /* CRC next, frame continues nonstop */
|
||||
#define ZCRCQ 'j' /* CRC next, frame continues, ZACK expected */
|
||||
#define ZCRCW 'k' /* CRC next, ZACK expected, end of frame */
|
||||
#define ZRUB0 'l' /* Translate to rubout 0177 */
|
||||
#define ZRUB1 'm' /* Translate to rubout 0377 */
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* $zdlread return values (internal) */
|
||||
/* -1 is general error, -2 is timeout */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
#define GOTOR 0400
|
||||
#define GOTCRCE (ZCRCE|GOTOR) /* ZDLE-ZCRCE received */
|
||||
#define GOTCRCG (ZCRCG|GOTOR) /* ZDLE-ZCRCG received */
|
||||
#define GOTCRCQ (ZCRCQ|GOTOR) /* ZDLE-ZCRCQ received */
|
||||
#define GOTCRCW (ZCRCW|GOTOR) /* ZDLE-ZCRCW received */
|
||||
#define GOTCAN (GOTOR|030) /* CAN*5 seen */
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Byte positions within header array */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
#define ZF0 3 /* First flags byte */
|
||||
#define ZF1 2
|
||||
#define ZF2 1
|
||||
#define ZF3 0
|
||||
#define ZP0 0 /* Low order 8 bits of position */
|
||||
#define ZP1 1
|
||||
#define ZP2 2
|
||||
#define ZP3 3 /* High order 8 bits of file position */
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Bit Masks for ZRINIT flags byte ZF0 */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
#define CANFDX 0x01 /* Rx can send and receive true FDX */
|
||||
#define CANOVIO 0x02 /* Rx can receive data during disk I/O */
|
||||
#define CANBRK 0x04 /* Rx can send a break signal */
|
||||
#define CANCRY 0x08 /* Receiver can decrypt */
|
||||
#define CANLZW 0x10 /* Receiver can uncompress */
|
||||
#define CANFC32 0x20 /* Receiver can use 32 bit Frame Check */
|
||||
#define ESCCTL 0x40 /* Receiver expects ctl chars to be escaped */
|
||||
#define ESC8 0x80 /* Receiver expects 8th bit to be escaped */
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Bit Masks for ZRINIT flags byze ZF1 */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
#define ZF1_CANVHDR 0x01 /* Variable headers OK */
|
||||
#define ZF1_TIMESYNC 0x02 /* nonstandard, Receiver request timesync */
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Parameters for ZSINIT frame */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
#define ZATTNLEN 32 /* Max length of attention string */
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Bit Masks for ZSINIT flags byte ZF0 */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
#define TESCCTL 0100 /* Transmitter expects ctl chars to be escaped */
|
||||
#define TESC8 0200 /* Transmitter expects 8th bit to be escaped */
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Parameters for ZFILE frame */
|
||||
/* Conversion options one of these in ZF0 */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
#define ZCBIN 1 /* Binary transfer - inhibit conversion */
|
||||
#define ZCNL 2 /* Convert NL to local end of line convention */
|
||||
#define ZCRESUM 3 /* Resume interrupted file transfer */
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Management include options, one of these ored in ZF1 */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
#define ZF1_ZMSKNOLOC 0x80 /* Skip file if not present at rx */
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Management options, one of these ored in ZF1 */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
#define ZF1_ZMMASK 0x1f /* Mask for the choices below */
|
||||
#define ZF1_ZMNEWL 1 /* Transfer if source newer or longer */
|
||||
#define ZF1_ZMCRC 2 /* Transfer if different file CRC or length */
|
||||
#define ZF1_ZMAPND 3 /* Append contents to existing file (if any) */
|
||||
#define ZF1_ZMCLOB 4 /* Replace existing file */
|
||||
#define ZF1_ZMNEW 5 /* Transfer if source newer */
|
||||
/* Number 5 is alive ... */
|
||||
#define ZF1_ZMDIFF 6 /* Transfer if dates or lengths different */
|
||||
#define ZF1_ZMPROT 7 /* Protect destination file */
|
||||
#define ZF1_ZMCHNG 8 /* Change filename if destination exists */
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Transport options, one of these in ZF2 */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
#define ZTLZW 1 /* Lempel-Ziv compression */
|
||||
#define ZTCRYPT 2 /* Encryption */
|
||||
#define ZTRLE 3 /* Run Length encoding */
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Extended options for ZF3, bit encoded */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
#define ZXSPARS 64 /* Encoding for sparse file operations */
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Parameters for ZCOMMAND frame ZF0 (otherwise 0) */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
#define ZCACK1 1 /* Acknowledge, then do command */
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Z-Modem globals */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
extern int Z_Rxexp; /* True means timer expired */
|
||||
extern int Z_Rxtout; /* Seconds to wait for receiving whole block */
|
||||
extern int Z_Rxwait; /* Seconds to wait for character available */
|
||||
extern int Z_Rxframeind; /* ZBIN ZBIN32, or ZHEX type of frame r-ed */
|
||||
extern int Z_Rxtype; /* Type of header received */
|
||||
extern int Z_Rxcount; /* Count of data bytes received */
|
||||
extern int Z_Txnulls; /* Number of nulls to send at beg. of ZDATA */
|
||||
extern char Z_Rxhdr[4]; /* Received header */
|
||||
extern char Z_Txhdr[4]; /* Transmitted header */
|
||||
extern long Z_Rxpos; /* Received file position */
|
||||
extern int Z_Txfcs32; /* TRUE means send binary frames with 32 bit FCS */
|
||||
extern int Z_Txcrc32; /* Display flag ind. 32 bit CRC being sent */
|
||||
extern int Z_Rxcrc32; /* Display flag ind. 32 bit CRC being r-ed */
|
||||
extern char Z_Attn[ZATTNLEN+1]; /* Attention string rx sends to tx on err */
|
||||
extern int Z_Ctlesc; /* Encode control characters */
|
||||
extern int Z_Lastsent; /* Character we sent last */
|
||||
//extern int Z_Dirzap; /* Direct ZedZap (don't escape XON/XOFF) */
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Z-Modem primitives (look p_zmmisc.c for them) */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
void setalarm(int sec);
|
||||
int zsendline(char c);
|
||||
int zsbhdr(int type, char *hdr);
|
||||
int zshhdr(int type, char *hdr);
|
||||
int zsdata(const char *buf, int length, int frameend, long pos);
|
||||
int zrdata(char *buf, int length, long pos);
|
||||
int zgethdr(char *hdr);
|
||||
void stohdr(char *hdr, long pos);
|
||||
long rclhdr(char *hdr);
|
||||
|
||||
int tx_zmodem(s_protinfo *pi, bool caller);
|
||||
int rx_zmodem(s_protinfo *pi, bool caller);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,223 @@
|
||||
/*
|
||||
* binkleyforce -- unix FTN mailer project
|
||||
*
|
||||
* Copyright (c) 1998-2000 Alexander Belkin, 2:5020/1398.11
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef _S_MAIN_H_
|
||||
#define _S_MAIN_H_
|
||||
|
||||
#define CALLOPT_FORCE 0x01
|
||||
#define CALLOPT_INET 0x02
|
||||
|
||||
#include "io.h"
|
||||
#include "nodelist.h"
|
||||
#include "outbound.h"
|
||||
#include "prot_common.h"
|
||||
|
||||
typedef enum session {
|
||||
SESSION_UNKNOWN,
|
||||
SESSION_FTSC,
|
||||
SESSION_YOOHOO,
|
||||
SESSION_EMSI,
|
||||
SESSION_BINKP
|
||||
} e_session;
|
||||
|
||||
typedef enum protocol {
|
||||
PROT_NOPROT,
|
||||
PROT_XMODEM,
|
||||
PROT_ZMODEM,
|
||||
PROT_ZEDZAP,
|
||||
PROT_DIRZAP,
|
||||
PROT_JANUS,
|
||||
PROT_HYDRA,
|
||||
PROT_TCP,
|
||||
PROT_BINKP
|
||||
} e_protocol;
|
||||
|
||||
typedef enum reqstat {
|
||||
REQS_DISABLED, /* Freqs not supported by the system */
|
||||
REQS_ALLOW, /* We will process file requests */
|
||||
REQS_NOTALLOW /* Freqs TEMPORARY disabled for any reason */
|
||||
} e_reqstat;
|
||||
|
||||
#define HRC_OK 0 /* No errors */
|
||||
#define HRC_LOW_SPEED 1 /* Connect speed too low (shown it in EMSI) */
|
||||
#define HRC_BAD_PASSWD 2 /* Pasword failure (shown it in EMSI) */
|
||||
#define HRC_NO_ADDRESS 3 /* Expected address was not presented */
|
||||
#define HRC_NO_PROTOS 4 /* No common protocols :( */
|
||||
#define HRC_BUSY 5 /* All remote AKAs are busy */
|
||||
#define HRC_FATAL_ERR 6 /* Any other fatal handshake error */
|
||||
#define HRC_TEMP_ERR 7 /* Any other temporary handshake error */
|
||||
#define HRC_OTHER_ERR 8 /* Any other error (e.g. timeout, NO CARRIER) */
|
||||
|
||||
typedef struct sysaddr {
|
||||
s_faddr addr;
|
||||
bool busy;
|
||||
bool good;
|
||||
int flags;
|
||||
} s_sysaddr;
|
||||
|
||||
typedef struct {
|
||||
char passwd[128];
|
||||
char challenge[128];
|
||||
int challenge_length;
|
||||
bool cram_auth;
|
||||
} s_session_passwd;
|
||||
|
||||
typedef struct sendopts {
|
||||
int fnc:1, /* Convert outgoing file names to 8+3 format */
|
||||
holdreq:1, /* Hold .REQ files? (file requests) */
|
||||
holdhold:1, /* Hold files with HOLD flavor? */
|
||||
holdfiles:1, /* Hold all files except netmail + arcmail */
|
||||
holdxt:1, /* Hold all except netmail? */
|
||||
holdall:1, /* Hold ALL trafic!? */
|
||||
hydraRH1; /* Hydra RH1 mode (EMSI only) */
|
||||
} s_sendopts;
|
||||
|
||||
/*
|
||||
* Handhake protocols API
|
||||
*/
|
||||
typedef struct handshake_protocol
|
||||
{
|
||||
/*
|
||||
* 1. Main pointers
|
||||
*/
|
||||
char *verbal_name;
|
||||
char *author;
|
||||
char *standard;
|
||||
char *remote_data;
|
||||
char *local_data;
|
||||
e_protocol protocol;
|
||||
|
||||
void (*init)(struct handshake_protocol *THIS);
|
||||
void (*deinit)(struct handshake_protocol *THIS);
|
||||
int (*incoming_session)(struct handshake_protocol *THIS);
|
||||
int (*outgoing_session)(struct handshake_protocol *THIS);
|
||||
|
||||
/*
|
||||
* 2. Remote system information extract methods
|
||||
*/
|
||||
s_faddr* (*remote_address)(struct handshake_protocol *THIS);
|
||||
char* (*remote_password)(struct handshake_protocol *THIS);
|
||||
char* (*remote_sysop_name)(struct handshake_protocol *THIS);
|
||||
char* (*remote_system_name)(struct handshake_protocol *THIS);
|
||||
char* (*remote_location)(struct handshake_protocol *THIS);
|
||||
char* (*remote_phone)(struct handshake_protocol *THIS);
|
||||
char* (*remote_flags)(struct handshake_protocol *THIS);
|
||||
char* (*remote_mailer)(struct handshake_protocol *THIS);
|
||||
int (*remote_traffic)(struct handshake_protocol *THIS, s_traffic *dest);
|
||||
|
||||
/*
|
||||
* 3. Local system information extract methods
|
||||
*/
|
||||
s_faddr* (*local_address)(struct handshake_protocol *THIS);
|
||||
char* (*local_password)(struct handshake_protocol *THIS);
|
||||
} s_handshake_protocol;
|
||||
|
||||
struct state
|
||||
{
|
||||
s_node node;
|
||||
const s_modemport *modemport;
|
||||
char *linename; /* Verbal line name (i.e. ttyS1, tcpip, etc.) */
|
||||
time_t start_time; /* Session start time (e.g. connect time) */
|
||||
e_tcpmode tcpmode; /* Current mode to work via TCP/IP */
|
||||
e_session session; /* handshake type (EMSI, YooHoo, etc.) */
|
||||
bool valid; /* This structure contain real information */
|
||||
bool caller; /* Outgoing session */
|
||||
bool protected; /* Password protected session? */
|
||||
bool listed; /* Session with listed system? */
|
||||
bool inet; /* We are working via TCP/IP now */
|
||||
int session_rc; /* Session return code */
|
||||
s_sendopts sopts; /* Our send options (hold arcmail, etc.) */
|
||||
e_reqstat reqstat; /* Our file request processor status */
|
||||
s_override override;
|
||||
s_sess_stat sess_stat; /* Try counters, hold timers, etc. */
|
||||
long connspeed;
|
||||
long minspeed;
|
||||
char *cidstr; /* Caller Phone/ID when we are answering */
|
||||
char *peername; /* Remote peer name than using TCP/IP */
|
||||
long peerport; /* Remote port number, we are connected to */
|
||||
char *connstr;
|
||||
char *inbound; /* Inbound directory for this session */
|
||||
char *tinbound; /* Temporary inbound for this session */
|
||||
s_traffic traff_send; /* Expected outgoing traffic */
|
||||
s_traffic traff_recv; /* Expected incoming traffic */
|
||||
|
||||
s_handshake_protocol *handshake;
|
||||
|
||||
s_falist *mailfor; /* Remote valid addresses */
|
||||
s_fsqueue queue; /* Send files queue */
|
||||
};
|
||||
typedef struct state s_state;
|
||||
|
||||
/* s_common.c */
|
||||
int session_get_local_address(s_faddr *addr);
|
||||
int session_get_remote_address(s_faddr *addr);
|
||||
int session_get_remote_sysop(char **dest);
|
||||
int session_get_remote_systname(char **const dest);
|
||||
int session_get_remote_mailer(char **const dest);
|
||||
int session_get_remote_phone(char **const dest);
|
||||
int session_get_remote_location(char **const dest);
|
||||
int session_is_remote_protected(void);
|
||||
int session_is_remote_listed(void);
|
||||
int session_get_callerid(char **const dest);
|
||||
int session_get_connect(char **const dest);
|
||||
int session_run_command(const char *execstr);
|
||||
int override_get(s_override *dest, s_faddr addr, int line);
|
||||
void init_state(s_state *pstate);
|
||||
void deinit_state(s_state *pstate);
|
||||
|
||||
/* s_init.c */
|
||||
int session_init_outgoing(void);
|
||||
int session_init_incoming(void);
|
||||
|
||||
/* s_main.c */
|
||||
extern s_state state;
|
||||
|
||||
s_faddr *session_get_bestaka(s_faddr addr);
|
||||
int session_addrs_lock(s_sysaddr *addrs, int anum);
|
||||
int session_addrs_add(s_sysaddr **addrs, int *anum, s_faddr addr);
|
||||
int session_addrs_check(s_sysaddr *addrs, int anum, const char *passwd,
|
||||
const char *challenge, int challenge_length);
|
||||
int session_addrs_to_falist(s_sysaddr *addrs, int anum, s_falist **dest);
|
||||
int session_addrs_check_genuine(s_sysaddr *addrs, int anum, s_faddr expected);
|
||||
int session_check_speed(void);
|
||||
int session_check_addr(s_faddr addr);
|
||||
int session_get_password(s_faddr addr, char *buffer, size_t buflen);
|
||||
int session_remote_lookup(s_sysaddr *addrs, int anum);
|
||||
void session_remote_log_status(void);
|
||||
int session_check_password(s_faddr addr, const char *passwd);
|
||||
int session_set_inbound(void);
|
||||
void session_set_freqs_status(void);
|
||||
void session_set_send_options(void);
|
||||
void session_set_send_files(void);
|
||||
int session_create_files_queue(s_sysaddr *addrs, int anum);
|
||||
int session_traffic_set_incoming(s_traffic *dest);
|
||||
int session_traffic_set_outgoing(s_traffic *dest);
|
||||
void session_traffic(void);
|
||||
void session_update_history(s_traffic *send, s_traffic *recv, int rc);
|
||||
int session(void);
|
||||
|
||||
/* sess_call.c */
|
||||
int call_system(s_faddr addr, const s_bforce_opts *opts);
|
||||
int call_system_modem(void);
|
||||
int call_system_tcpip(void);
|
||||
|
||||
/* sess_answ.c */
|
||||
int answ_system(e_session type, char *connstr, int inetd);
|
||||
|
||||
/* sess_stat.c */
|
||||
void session_stat_reset_counters(s_sess_stat *stat);
|
||||
int session_stat_get(s_sess_stat *stat, s_faddr *addr);
|
||||
int session_stat_apply_diff(s_faddr addr, s_sess_stat stat);
|
||||
int session_stat_update(s_faddr *addr, s_sess_stat *stat, bool caller, int rc);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,258 @@
|
||||
/*
|
||||
* binkleyforce -- unix FTN mailer project
|
||||
*
|
||||
* Copyright (c) 1998-2000 Alexander Belkin, 2:5020/1398.11
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef _UTIL_H_
|
||||
#define _UTIL_H_
|
||||
|
||||
#define DEFAULT_ZONE 2
|
||||
#define DEFAULT_NET 5020
|
||||
#define DEFAULT_NODE 0
|
||||
|
||||
#define TIMEVEC_MAX_ELEMENTS 10
|
||||
|
||||
enum { ADDR_EQ, ADDR_GT, ADDR_LT };
|
||||
|
||||
enum {
|
||||
PLOCK_OK,
|
||||
PLOCK_EXIST,
|
||||
PLOCK_ERROR,
|
||||
PLOCK_OURLOCK
|
||||
};
|
||||
|
||||
enum day
|
||||
{
|
||||
DAY_MONDAY,
|
||||
DAY_TUESDAY,
|
||||
DAY_WEDNESDAY,
|
||||
DAY_THURSDAY,
|
||||
DAY_FRIDAY,
|
||||
DAY_SATURDAY,
|
||||
DAY_SUNDAY,
|
||||
DAY_ANY,
|
||||
DAY_WORKDAY,
|
||||
DAY_WEEKEND,
|
||||
DAY_UNDEF
|
||||
};
|
||||
|
||||
typedef struct faddr {
|
||||
bool inetform; /* Is address in domain form? */
|
||||
int zone; /* -1 value means any?! */
|
||||
int net;
|
||||
int node;
|
||||
int point;
|
||||
char domain[BF_MAXDOMAIN+1];
|
||||
} s_faddr;
|
||||
|
||||
typedef struct timeint {
|
||||
enum day day_beg;
|
||||
enum day day_end;
|
||||
long beg;
|
||||
long end;
|
||||
} s_timeint;
|
||||
|
||||
typedef struct timevec {
|
||||
int num;
|
||||
s_timeint tvec[TIMEVEC_MAX_ELEMENTS];
|
||||
} s_timevec;
|
||||
|
||||
typedef struct message {
|
||||
int attr;
|
||||
int cost;
|
||||
time_t time;
|
||||
s_faddr orig;
|
||||
s_faddr dest;
|
||||
char namefrom[36];
|
||||
char nameto[36];
|
||||
char subject[72];
|
||||
char *text;
|
||||
char *tagline;
|
||||
char *tearline;
|
||||
char *origin;
|
||||
} s_message;
|
||||
|
||||
typedef struct packet {
|
||||
s_faddr orig;
|
||||
s_faddr dest;
|
||||
int baud;
|
||||
char password[8+1];
|
||||
s_message *msgs;
|
||||
int n_msgs;
|
||||
} s_packet;
|
||||
|
||||
enum
|
||||
{
|
||||
FILELOCK_CLEAR,
|
||||
FILELOCK_READ,
|
||||
FILELOCK_WRITE
|
||||
};
|
||||
|
||||
#define RECODE_MAX_CHAR 255
|
||||
|
||||
typedef struct recode_table {
|
||||
const char *filename;
|
||||
char table[RECODE_MAX_CHAR+1];
|
||||
} s_recode_table;
|
||||
|
||||
#undef MAX
|
||||
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
|
||||
|
||||
#undef MIN
|
||||
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
|
||||
|
||||
#undef ABS
|
||||
#define ABS(a) (((a) < 0) ? -(a) : (a))
|
||||
|
||||
#define SET_LAT_A_Z "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
#define SET_LAT_a_z "abcdefghijklmnopqrstuvwxyz"
|
||||
#define SET_DEC "0123456789"
|
||||
#define SET_HEX "0123456789ABCDEFabcdef"
|
||||
#define SET_OCT "01234567"
|
||||
|
||||
#define CRC16TEST(crc) ((crc) == 0xf0b8)
|
||||
#define CRC32TEST(crc) ((crc) == 0xdebb20e3L)
|
||||
|
||||
#define updcrc16(cp, crc) (TableCRC16Xmodem[(((int)(crc) >> 8) & 0xff)] ^ ((crc) << 8) ^ (cp))
|
||||
#define updcrc32(cp, crc) (TableCRC32CCITT[((int)(crc) ^ cp) & 0xff] ^ (((crc) >> 8) & 0x00FFFFFF))
|
||||
|
||||
#define localtogmt(t) ((t) - time_gmtoffset()*60)
|
||||
#define gmttolocal(t) ((t) + time_gmtoffset()*60)
|
||||
|
||||
#define timer_set(ptr, v) (time_settimer(ptr, v))
|
||||
#define timer_expired(tm) (time(NULL) > (tm))
|
||||
#define timer_running(tm) ((tm) > 0)
|
||||
#define timer_timeleft(tm) (time_timeleft(tm))
|
||||
|
||||
#define recode_file_out(str) recode(str, &recode_table_out, conf_string(cf_recode_file_out));
|
||||
#define recode_file_in(str) recode(str, &recode_table_in, conf_string(cf_recode_file_in));
|
||||
#define recode_intro_in(str) recode(str, &recode_table_in, conf_string(cf_recode_intro_in));
|
||||
|
||||
extern s_recode_table recode_table_in;
|
||||
extern s_recode_table recode_table_out;
|
||||
extern unsigned long TableCRC32CCITT[];
|
||||
extern unsigned short TableCRC16Xmodem[];
|
||||
extern unsigned short TableCRC16CCITT[];
|
||||
|
||||
/* u_crc.c */
|
||||
unsigned long getcrc32ccitt(const unsigned char *buffer, size_t buflen);
|
||||
unsigned short getcrc16xmodem(const unsigned char *buffer, size_t buflen);
|
||||
unsigned short getcrc16ccitt(const unsigned char *buffer, size_t buflen);
|
||||
|
||||
/* u_file.c */
|
||||
int file_lock(FILE *fp, bool exclusive);
|
||||
void file_unlock(FILE *fp);
|
||||
int file_lock_wait(FILE *fp, bool exclusive);
|
||||
bool file_name_issafe(int ch);
|
||||
char *file_name_makesafe(char *filename);
|
||||
char *file_getname(char *filename);
|
||||
char *file_gettmp(void);
|
||||
char *file_get_dos_name(char *buffer, const char *filename);
|
||||
bool is_directory(const char *dirname);
|
||||
bool is_regfile(const char *filename);
|
||||
int directory_create(const char *dirname, mode_t access_mode);
|
||||
FILE *file_open(const char *path, const char *mode);
|
||||
int file_close(FILE *stream);
|
||||
|
||||
/* u_ftn.c */
|
||||
int ftn_addrparse(s_faddr *addr, const char *s, bool wildcard);
|
||||
char *ftn_addrstr_fido(char *buf, s_faddr addr);
|
||||
char *ftn_addrstr_inet(char *buf, s_faddr addr);
|
||||
char *ftn_addrstr(char *buf, s_faddr addr);
|
||||
int ftn_addrcomp(s_faddr addr1, s_faddr addr2);
|
||||
int ftn_addrcomp_logic(s_faddr addr1, int operator, s_faddr addr2);
|
||||
int ftn_addrcomp_mask(s_faddr addr, s_faddr mask);
|
||||
int ftn_addrsmetric(s_faddr addr1, s_faddr addr2);
|
||||
|
||||
/* u_md5.c */
|
||||
void md5_get(const unsigned char *data, size_t length, unsigned char *digest);
|
||||
void md5_cram_get(const unsigned char *secret, const unsigned char *challenge,
|
||||
int challenge_length, unsigned char *digest);
|
||||
|
||||
/* u_misc.c */
|
||||
void *xmalloc(size_t size);
|
||||
void *xrealloc(void *buf, size_t size);
|
||||
void *xmemcpy(const void *buffer, size_t buflen);
|
||||
char *strparse(char *str, char **next, int quoted);
|
||||
int strcasemask(const char *str, const char *mask);
|
||||
int checkmasks(const char *masks, const char *str);
|
||||
char *buffer_putlong(char *buffer, long val);
|
||||
char *buffer_putint(char *buf, int val);
|
||||
long buffer_getlong(const char *buf);
|
||||
int buffer_getint(const char *buf);
|
||||
void printf_usage(const char *ident, const char *fmt, ...);
|
||||
|
||||
/* u_pkt.c */
|
||||
int pkt_createpacket(const char *pktname, const s_packet *pkt);
|
||||
|
||||
/* u_plock.c */
|
||||
int plock_check(const char *lockname);
|
||||
int plock_create(const char *lockname);
|
||||
int plock_remove(const char *lockname);
|
||||
int plock_link(const char *lockname, const char *tmpname);
|
||||
|
||||
/* u_recode.c */
|
||||
char *recode(char *src, s_recode_table *tab, const char *filename);
|
||||
|
||||
/* u_string.c */
|
||||
char *xstrcpy(const char *src);
|
||||
char *xstrcat(char *src, const char *add);
|
||||
char *strnxcpy(char *dst, const char *src, size_t len);
|
||||
char *strnxcat(char *dst, const char *src, size_t len);
|
||||
char *string_token(char *str, char **next, const char *delim, int quoted);
|
||||
char *string_chomp(char *str);
|
||||
const char *string_casestr(const char *string, const char *substr);
|
||||
const char *string_casechr(const char *str, int ch);
|
||||
char *string_toupper(char *str);
|
||||
char *string_tolower(char *str);
|
||||
bool string_isupper(const char *str);
|
||||
bool string_islower(const char *str);
|
||||
char *string_trimright(char *str);
|
||||
char *string_trimleft(char *str);
|
||||
char *string_trimboth(char *str);
|
||||
char *string_printable_buffer(const char *buffer, size_t buflen);
|
||||
const char *string_printable(const char *str);
|
||||
char *string_replchar(char *str, char oldchar, char newchar);
|
||||
int string_parse(char **dest, int items, char *str, int separator);
|
||||
int string_parse_regular(char **dest, int items, char *str);
|
||||
char *string_translate(const char *str, const char *find, const char *repl);
|
||||
char *string_humansize(char *buffer, size_t size);
|
||||
int string_get_escape(char **pptr);
|
||||
int string_dequote(char *dst, char *src);
|
||||
char *string_concat(const char *str, ...);
|
||||
void string_bin_to_hex(char *string, const char *binptr, int binlen);
|
||||
int string_hex_to_bin(char *binptr, const char *string);
|
||||
bool string_is_empty(const char *string);
|
||||
|
||||
/* u_time.c */
|
||||
int time_settimer(time_t *timer, int value);
|
||||
int time_timerout(time_t timer);
|
||||
int time_timeleft(time_t timer);
|
||||
int time_elapsed(time_t since_time);
|
||||
char *time_string_format(char *buffer, size_t buflen, const char *fmt, time_t t);
|
||||
char *time_string_long(char *buffer, size_t buflen, time_t t);
|
||||
char *time_string_log(char *buffer, size_t buflen, time_t t);
|
||||
char *time_string_msghdr(char *buffer, time_t t);
|
||||
long time_gmtoffset(void);
|
||||
char *time_string_gmtoffset(char *buffer);
|
||||
char *time_string_timer(char *buffer, int timer);
|
||||
char *time_string_approx_interval(char *buffer, int seconds);
|
||||
int time_check(const char *str, struct tm *now);
|
||||
int time_checkintervals(const char *timestr, struct tm *now);
|
||||
int timevec_add(s_timevec *dest, int day_beg, int day_end, long beg, long end);
|
||||
int timevec_parse(s_timevec *dest, const char *str);
|
||||
int timevec_parse_list(s_timevec *dest, const char *str);
|
||||
int timevec_check(const s_timevec *tv, const struct tm *now);
|
||||
char *timevec_string(char *buffer, const s_timevec *tv, size_t buflen);
|
||||
bool timevec_isdefined(const s_timevec *tv);
|
||||
bool timevec_isnow(const s_timevec *tv, const struct tm *now);
|
||||
|
||||
#endif /* _UTIL_H_ */
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* binkleyforce -- unix FTN mailer project
|
||||
*
|
||||
* Copyright (c) 1998-2000 Alexander Belkin, 2:5020/1398.11
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef _VERSION_H_
|
||||
#define _VERSION_H_
|
||||
|
||||
|
||||
#define BF_PRODCODE 0xfe
|
||||
#define BF_NAME "binkleyforce"
|
||||
#define BF_RDATE "n/a"
|
||||
#define BF_VERSION RELEASE_VERSION
|
||||
#define BF_CDATE __DATE__ __TIME__
|
||||
#define BF_REG "free software"
|
||||
#define BF_COPYRIGHT "(c) 1997-2000 by Alexander Belkin"
|
||||
|
||||
#define BF_BANNERVER BF_NAME" "BF_VERSION"/"BF_OS
|
||||
|
||||
#define BF_EMSI_NUM "fe"
|
||||
#define BF_EMSI_NAME BF_NAME
|
||||
#define BF_EMSI_VER BF_VERSION"/"BF_OS
|
||||
#define BF_EMSI_REG BF_REG
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user