1 /* 2 * binkleyforce -- unix FTN mailer project 3 * 4 * Copyright (c) 1998-2000 Alexander Belkin, 2:5020/1398.11 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * $Id: confread.h,v 1.1.1.1 2004/09/09 09:52:40 kstepanenkov Exp $ 12 */ 13 14 #ifndef _CONFREAD_H_ 15 #define _CONFREAD_H_ 16 17 #include "util.h" 18 19 /* Constatnts for gotfile switches */ 20 #define GOTFILE_SW_SRIF 0x01 21 #define GOTFILE_SW_IMMED 0x01 22 #define GOTFILE_SW_ONLINE 0x01 23 24 #define MAXINCLUDELEVEL 10 25 26 #define PROC_RC_OK 0 /* Successfully processed string */ 27 #define PROC_RC_WARN 1 /* Successfully, but not all so good */ 28 #define PROC_RC_IGNORE 2 /* Line was ignored, but we can continue */ 29 #define PROC_RC_ABORT 3 /* Incorrect line and we can not continue */ 30 31 /* 32 * Options (from/for "options" keyword) 33 */ 34 #define OPTIONS_NO_ZMODEM 0x00000001L 35 #define OPTIONS_NO_ZEDZAP 0x00000002L 36 #define OPTIONS_NO_DIRZAP 0x00000004L 37 #define OPTIONS_NO_JANUS 0x00000008L 38 #define OPTIONS_NO_HYDRA 0x00000010L 39 #define OPTIONS_NO_BINKP 0x00000020L 40 #define OPTIONS_NO_TCP 0x00000040L 41 #define OPTIONS_NO_CHAT 0x00000080L 42 #define OPTIONS_NO_FTS1 0x00000100L 43 #define OPTIONS_NO_YOOHOO 0x00000200L 44 #define OPTIONS_NO_EMSI 0x00000400L 45 #define OPTIONS_NO_EMSI_II 0x00000800L 46 #define OPTIONS_NO_FREQS 0x00001000L 47 #define OPTIONS_MAILONLY 0x00002000L 48 #define OPTIONS_HOLDXT 0x00004000L 49 #define OPTIONS_HOLDREQ 0x00008000L 50 #define OPTIONS_HOLDALL 0x00010000L 51 #define OPTIONS_HOLDHOLD 0x00020000L 52 #define OPTIONS_NO_PICKUP 0x00040000L 53 #define OPTIONS_NO_RH1 0x00080000L 54 #define OPTIONS_NO_INTRO 0x00100000L 55 56 #define RESPTYPE_CONNECT 0x0000L 57 #define RESPTYPE_BUSY 0x0001L 58 #define RESPTYPE_NOCARRIER 0x0002L 59 #define RESPTYPE_NODIALTONE 0x0004L 60 #define RESPTYPE_NOANSWER 0x0008L 61 #define RESPTYPE_ERROR 0x0010L 62 63 #define TRIES_ACTION_UNDIALABLE 0x01 64 #define TRIES_ACTION_HOLDSYSTEM 0x02 65 #define TRIES_ACTION_HOLDALL 0x04 66 67 /* 68 * Add new entry to the end of list 69 */ 70 #define LIST_NEWENT(newp,list,type) \ 71 for( newp = list; *newp; newp = &((*newp)->next) ); \ 72 *newp = (type*)xmalloc(sizeof(type)); \ 73 memset(*newp, '\0', sizeof(type)); 74 75 typedef struct expr { 76 bool error; /* Incorrect expression. Don't try twice! */ 77 char *expr; /* Pointer to the expression string */ 78 } s_expr; 79 80 /* 81 * Storage structures for base config components 82 */ 83 typedef struct string { 84 char *str; 85 } s_string; 86 87 typedef struct number { 88 long num; 89 } s_number; 90 91 typedef struct boolean { 92 bool istrue; 93 } s_boolean; 94 95 typedef struct falist { 96 s_faddr addr; 97 char *what; 98 struct falist *next; 99 } s_falist; 100 101 typedef struct domain { 102 char *domain; 103 char *path; 104 int zone; 105 } s_domain; 106 107 typedef struct translate { 108 char *find; 109 char *repl; 110 } s_translate; 111 112 typedef struct connlist { 113 long speed; 114 long value; 115 } s_connlist; 116 117 typedef struct dialresp { 118 char *mstr; /* Modem string/substring */ 119 int type; /* Response meaning (for mailer) */ 120 int retv; /* Force this return code */ 121 } s_dialresp; 122 123 typedef struct filemode { 124 mode_t mode; 125 } s_filemode; 126 127 typedef struct modemport { 128 long speed; 129 char *name; 130 } s_modemport; 131 132 typedef struct tries { 133 int tries; 134 int action; 135 int arg; 136 } s_tries; 137 138 typedef struct override { 139 s_faddr addr; /* Overrides for this address */ 140 char *sIpaddr; 141 char *sPhone; 142 char *sFlags; 143 s_timevec worktime; 144 s_timevec freqtime; 145 struct override *hidden; /* Hidden lines list */ 146 } s_override; 147 148 typedef struct options { 149 unsigned long value; 150 unsigned long mask; /* bit[k] == 1 if bit[k] defined in value */ 151 } s_options; 152 153 typedef struct filebox { 154 s_faddr addr; 155 char *path; 156 int flavor; 157 struct falist *next; 158 } s_filebox; 159 160 typedef enum { 161 cf_address, 162 cf_amiga_outbound_directory, 163 cf_binkp_timeout, 164 cf_daemon_circle, 165 cf_daemon_circle_crash, 166 cf_daemon_circle_direct, 167 cf_daemon_circle_immed, 168 cf_daemon_circle_modem, 169 cf_daemon_circle_normal, 170 cf_daemon_circle_rescan, 171 cf_daemon_maxclients_modem, 172 cf_daemon_maxclients_tcpip, 173 cf_daemon_pid_file, 174 cf_delay_files_recv, 175 cf_delay_files_send, 176 cf_disable_aka_matching, 177 cf_domain, 178 cf_emsi_FR_time, 179 cf_emsi_OH_time, 180 cf_emsi_slave_sends_nak, 181 cf_filebox, 182 cf_filebox_directory, 183 cf_flags, 184 cf_flo_translate, 185 cf_freq_alias_list, 186 cf_freq_dir_list, 187 cf_freq_ignore_masks, 188 cf_freq_limit_number, 189 cf_freq_limit_size, 190 cf_freq_limit_time, 191 cf_freq_min_speed, 192 cf_freq_srif_command, 193 cf_hide_our_aka, 194 cf_history_file, 195 cf_hydra_options, 196 cf_hydra_mincps_recv, 197 cf_hydra_mincps_send, 198 cf_hydra_tx_window, 199 cf_hydra_rx_window, 200 cf_inbound_directory, 201 cf_location, 202 cf_log_file, 203 cf_log_file_daemon, 204 cf_max_speed, 205 cf_maxtries, 206 cf_maxtries_nodial, 207 cf_maxtries_noansw, 208 cf_maxtries_noconn, 209 cf_maxtries_hshake, 210 cf_maxtries_sessions, 211 cf_min_cps_recv, 212 cf_min_cps_send, 213 cf_min_cps_time, 214 cf_min_free_space, 215 cf_min_speed_in, 216 cf_min_speed_out, 217 cf_mode_netmail, 218 cf_mode_arcmail, 219 cf_mode_request, 220 cf_mode_ticfile, 221 cf_mode_default, 222 cf_modem_can_send_break, 223 cf_modem_dial_prefix, 224 cf_modem_dial_suffix, 225 cf_modem_dial_response, 226 cf_modem_hangup_command, 227 cf_modem_port, 228 cf_modem_reset_command, 229 cf_modem_stat_command, 230 cf_nodelist, 231 cf_nodelist_directory, 232 cf_nodial_flag, 233 cf_override, 234 cf_options, 235 cf_outbound_directory, 236 cf_password, 237 cf_phone, 238 cf_phone_translate, 239 cf_recode_file_in, 240 cf_recode_file_out, 241 cf_recode_intro_in, 242 cf_recv_buffer_size, 243 cf_rescan_delay, 244 cf_run_after_handshake, 245 cf_run_after_session, 246 cf_session_limit_in, 247 cf_session_limit_out, 248 cf_skip_files_recv, 249 cf_status_directory, 250 cf_system_name, 251 cf_sysop_name, 252 cf_uucp_lock_directory, 253 cf_wait_carrier_in, 254 cf_wait_carrier_out, 255 cf_zmodem_mincps_recv, 256 cf_zmodem_mincps_send, 257 cf_zmodem_send_dummy_pkt, 258 cf_zmodem_skip_by_pos, 259 cf_zmodem_start_block_size, 260 cf_zmodem_tx_window, 261 #ifdef DEBUG 262 cf_debug_file, 263 cf_debug_level, 264 #endif 265 BFORCE_NUMBER_OF_KEYWORDS 266 } bforce_config_keyword; 267 268 typedef struct cval_entry { 269 s_expr expr; 270 union { 271 s_falist falist; 272 s_domain domain; 273 s_override override; 274 s_options options; 275 s_translate translate; 276 s_connlist connlist; 277 s_number number; 278 s_boolean boolean; 279 s_string string; 280 s_modemport modemport; 281 s_dialresp dialresp; 282 s_tries tries; 283 s_filemode filemode; 284 s_filebox filebox; 285 } d; 286 struct cval_entry *next; 287 } s_cval_entry; 288 289 typedef struct conf_entry { 290 char *name; 291 enum { 292 CT_ADDRESS, 293 CT_BOOLEAN, 294 CT_CONNLIST, 295 CT_DIALRESP, 296 CT_DOMAIN, 297 CT_FILEMODE, 298 CT_MODEMPORT, 299 CT_NODELIST, 300 CT_NUMBER, 301 CT_OPTIONS, 302 CT_OVERRIDE, 303 CT_PATH, 304 CT_PASSWORD, 305 CT_STRING, 306 CT_TRANSLATE, 307 CT_TRIES, 308 CT_DEBLEVEL, 309 CT_FILEBOX 310 } type; 311 s_cval_entry *data; 312 bforce_config_keyword real_key; 313 } s_conf_entry; 314 315 extern s_conf_entry bforce_config[]; 316 317 /* conf_proc.c */ 318 int proc_configline(const char *k, const char *e, const char *v); 319 320 /* conf_deinit.c */ 321 void deinit_conf(void); 322 void deinit_cval_entry(s_cval_entry *dest, bforce_config_keyword type); 323 void deinit_dialresp(s_dialresp *dest); 324 void deinit_domain(s_domain *dest); 325 void deinit_expr(s_expr *dest); 326 void deinit_falist(s_falist *dest); 327 void deinit_modemport(s_modemport *dest); 328 void deinit_override(s_override *dest); 329 void deinit_string(s_string *dest); 330 void deinit_translate(s_translate *dest); 331 332 /* conf_read.c */ 333 const char *conf_getconfname(void); 334 int conf_postreadcheck(void); 335 int conf_readpasswdlist(s_falist **pwdlist, char *fname); 336 int conf_readconf(const char *confname, int inclevel); 337 #ifdef DEBUG 338 void log_overridelist(s_override *subst); 339 void log_options(s_options *opt); 340 #endif 341 342 /* conf_get.c */ 343 s_cval_entry *conf_first(bforce_config_keyword keyword); 344 s_cval_entry *conf_next(s_cval_entry *ptrl); 345 bool conf_boolean(bforce_config_keyword keyword); 346 mode_t conf_filemode(bforce_config_keyword keyword); 347 long conf_options(bforce_config_keyword keyword); 348 long conf_connlist(bforce_config_keyword keyword, long speed); 349 char *conf_string(bforce_config_keyword keyword); 350 long conf_number(bforce_config_keyword keyword); 351 s_override *conf_override(bforce_config_keyword keyword, s_faddr addr); 352 s_tries *conf_tries(bforce_config_keyword keyword); 353 354 /* expression.y */ 355 bool eventexpr(s_expr *expr); 356 357 #endif /* _CONFREAD_H_ */ 358 359