380 lines
9.8 KiB
C
380 lines
9.8 KiB
C
/*
|
|
* 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;
|
|
char *run;
|
|
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, // 0
|
|
cf_amiga_outbound_directory, // 1
|
|
cf_binkp_timeout, // 2
|
|
cf_daemon_circle, // 3
|
|
cf_daemon_circle_crash, // 4
|
|
cf_daemon_circle_direct, // 5
|
|
cf_daemon_circle_immed, // 6
|
|
cf_daemon_circle_modem, // 7
|
|
cf_daemon_circle_normal, // 8
|
|
cf_daemon_circle_rescan, // 9
|
|
cf_daemon_maxclients_modem, // 10
|
|
cf_daemon_maxclients_tcpip, // 11
|
|
cf_daemon_pid_file, // 12
|
|
cf_delay_files_recv, // 13
|
|
cf_delay_files_send, // 14
|
|
cf_disable_aka_matching, // 15
|
|
cf_domain, // 16
|
|
cf_emsi_FR_time, // 17
|
|
cf_emsi_OH_time, // 18
|
|
cf_emsi_slave_sends_nak, // 19
|
|
cf_emsi_send_tz, // 20
|
|
cf_emsi_send_time, // 21
|
|
cf_filebox, // 22
|
|
cf_filebox_directory, // 23
|
|
cf_flags, // 24
|
|
cf_flo_translate, // 25
|
|
cf_freq_alias_list, // 26
|
|
cf_freq_dir_list, // 27
|
|
cf_freq_ignore_masks, // 28
|
|
cf_freq_limit_number, // 29
|
|
cf_freq_limit_size, // 30
|
|
cf_freq_limit_time, // 31
|
|
cf_freq_min_speed, // 32
|
|
cf_freq_srif_command, // 33
|
|
cf_incnet_flag, // 34
|
|
cf_incarc_flag, // 35
|
|
cf_inctic_flag, // 36
|
|
cf_incfile_flag, // 37
|
|
cf_hide_our_aka, // 38
|
|
cf_history_file, // 39
|
|
cf_hydra_options, // 40
|
|
cf_hydra_mincps_recv, // 41
|
|
cf_hydra_mincps_send, // 42
|
|
cf_hydra_tx_window, // 43
|
|
cf_hydra_rx_window, // 44
|
|
cf_inbound_directory, // 45
|
|
cf_location, // 46
|
|
cf_log_file, // 47
|
|
cf_log_file_daemon, // 48
|
|
cf_max_speed, // 49
|
|
cf_maxtries, // 50
|
|
cf_maxtries_nodial, // 51
|
|
cf_maxtries_noansw, // 52
|
|
cf_maxtries_noconn, // 53
|
|
cf_maxtries_hshake, // 54
|
|
cf_maxtries_sessions, // 55
|
|
cf_min_cps_recv, // 56
|
|
cf_min_cps_send, // 57
|
|
cf_min_cps_time, // 58
|
|
cf_min_free_space, // 59
|
|
cf_min_speed_in, // 60
|
|
cf_min_speed_out, // 61
|
|
cf_mode_netmail, // 62
|
|
cf_mode_arcmail, // 63
|
|
cf_mode_request, // 64
|
|
cf_mode_ticfile, // 65
|
|
cf_mode_default, // 66
|
|
cf_modem_can_send_break, // 67
|
|
cf_modem_dial_prefix, // 68
|
|
cf_modem_dial_suffix, // 69
|
|
cf_modem_dial_response, // 70
|
|
cf_modem_hangup_command, // 71
|
|
cf_modem_port, // 72
|
|
cf_modem_reset_command, // 73
|
|
cf_modem_stat_command, // 74
|
|
cf_nodelist, // 75
|
|
cf_nodelist_directory, // 76
|
|
cf_nodial_flag, // 77
|
|
cf_override, // 78
|
|
cf_options, // 79
|
|
cf_outbound_directory, // 80
|
|
cf_password, // 81
|
|
cf_phone, // 82
|
|
cf_phone_translate, // 83
|
|
cf_proto_order, // 84
|
|
cf_recode_file_in, // 85
|
|
cf_recode_file_out, // 86
|
|
cf_recode_intro_in, // 87
|
|
cf_recv_buffer_size, // 88
|
|
cf_rescan_delay, // 89
|
|
cf_run_after_handshake, // 90
|
|
cf_run_after_session, // 91
|
|
cf_run_before_session, // 92
|
|
cf_session_limit_in, // 93
|
|
cf_session_limit_out, // 94
|
|
cf_skip_files_recv, // 95
|
|
cf_status_directory, // 96
|
|
cf_system_name, // 97
|
|
cf_sysop_name, // 98
|
|
cf_uucp_lock_directory, // 99
|
|
cf_wait_carrier_in, // 100
|
|
cf_wait_carrier_out, // 101
|
|
cf_zmodem_mincps_recv, // 102
|
|
cf_zmodem_mincps_send, // 103
|
|
cf_zmodem_send_dummy_pkt, // 104
|
|
cf_zmodem_skip_by_pos, // 105
|
|
cf_zmodem_start_block_size, // 106
|
|
cf_zmodem_tx_window, // 107
|
|
cf_nomail_flag, // 108
|
|
cf_bind_ip, // 109
|
|
cf_recieved_to_lower, // 110
|
|
#ifdef USE_SYSLOG
|
|
cf_syslog_facility,
|
|
#endif
|
|
#ifdef DEBUG
|
|
cf_debug_file, // 111
|
|
cf_debug_level, // 112
|
|
#endif
|
|
cf_split_inbound, // 113
|
|
#ifdef NETSPOOL
|
|
cf_netspool_host,
|
|
cf_netspool_port,
|
|
#endif
|
|
cf_fidodnszone, // 114
|
|
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, bool earlydbg);
|
|
#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_ */
|
|
|