1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278
|
/*
* readcfg.h -- read config
*
* readcfg.h is a part of binkd project
*
* Copyright (C) 1996-1997 Dima Maloff, 5047/13
*
* 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. See COPYING.
*/
#ifndef _readcfg_h
#define _readcfg_h
#include <stdio.h>
#include "Config.h"
#include "btypes.h"
#include "iphdr.h"
typedef struct _BINKD_CONFIG BINKD_CONFIG;
#define MAXINCLUDELEVEL 8
#define MAXCFGLINE 1024
/* val: enum for checks */
typedef enum { A_ALL=-1, A_LST=1, A_UNLST=2, A_PROT=4, A_UNPROT=8 } addrtype;
/* val: use for overwrite and nolog */
struct maskchain
{
struct maskchain *next;
char *mask;
};
/* val: struct for skipmask */
struct skipchain
{
struct skipchain *next;
char *mask;
addrtype atype;
boff_t size;
int destr;
};
/* val: struct for hide-aka, present-aka */
struct akachain
{
struct akachain *next;
FTN_ADDR fa;
char *mask;
enum { ACT_UNKNOWN=0, ACT_HIDE, ACT_PRESENT } type;
};
struct listenchain
{
struct listenchain *next;
char addr[42];
char port[MAXSERVNAME + 1];
};
#if defined(WITH_ZLIB) || defined(WITH_BZLIB2)
/* val: struct for zallow, zdeny */
struct zrule
{
struct zrule *next;
char *mask;
enum { ZRULE_ALLOW, ZRULE_DENY } type;
};
#endif
#ifdef BW_LIM
/* val: struct for limit-rate */
struct ratechain
{
struct ratechain *next;
char *mask;
addrtype atype;
long rate;
};
#endif
struct conflist_type
{
struct conflist_type *next;
char *path;
time_t mtime;
};
struct perl_var
{
struct perl_var *next;
char *name, *val;
};
struct _BINKD_CONFIG
{
int usageCount; /* when it reaches zero, config can be freed */
int nAddr; /* total addresses defined */
FTN_ADDR *pAddr; /* array of adresses */
int nNod; /* number of nodes */
FTN_NODE **pNodArray; /* array of pointers to nodes */
int nNodSorted; /* internal flag */
int q_present; /* BSO scan: queue not empty */
char iport[MAXSERVNAME + 1];
char oport[MAXSERVNAME + 1];
int oblksize;
#if defined(WITH_ZLIB) || defined(WITH_BZLIB2)
int zminsize;
int zlevel;
#endif
int nettimeout;
int connect_timeout;
int rescan_delay;
int call_delay;
int max_servers;
int max_clients;
int kill_dup_partial_files;
int kill_old_partial_files;
int kill_old_bsy;
int minfree;
int minfree_nonsecure;
int tries;
int hold;
int hold_skipped;
int backresolv;
int send_if_pwd;
int remove_try_files;
int debugcfg;
int loglevel;
int conlog;
int printq;
int percents;
int tzoff;
int prescan;
enum inbcasetype inboundcase;
int deletedirs;
int havedefnode;
enum dontsendemptytype dontsendempty;
enum renamestyletype renamestyle;
#ifdef AMIGADOS_4D_OUTBOUND
int aso;
#endif
addrtype pkthdr_type;
char *pkthdr_bad;
DEFINE_LIST(conflist_type) config_list;
DEFINE_LIST(_FTN_DOMAIN) pDomains;
DEFINE_LIST(maskchain) overwrite, nolog;
DEFINE_LIST(skipchain) skipmask;
DEFINE_LIST(_RF_RULE) rf_rules;
DEFINE_LIST(_EVT_FLAG) evt_flags;
DEFINE_LIST(akachain) akamask;
DEFINE_LIST(listenchain) listen;
DEFINE_LIST(_SHARED_CHAIN) shares; /* Linked list for shared akas header */
#if defined(WITH_ZLIB) || defined(WITH_BZLIB2)
DEFINE_LIST(zrule) zrules;
#endif
#ifdef BW_LIM
DEFINE_LIST(ratechain) rates;
#endif
#ifdef WITH_PERL
DEFINE_LIST(perl_var) perl_vars;
#endif
/*
#ifdef HTTPS
struct simplelistheader proxylist;
#endif
*/
#ifdef HTTPS
char proxy[BINKD_FQDNLEN + 40];
char socks[BINKD_FQDNLEN + 40];
#endif
char root_domain[BINKD_FQDNLEN + 1];
char sysname[MAXSYSTEMNAME + 1];
char bindaddr[42];
char sysop[MAXSYSOPNAME + 1];
char location[MAXLOCATIONNAME + 1];
char nodeinfo[MAXNODEINFO + 1];
char inbound[MAXPATHLEN + 1];
char inbound_nonsecure[MAXPATHLEN + 1];
char temp_inbound[MAXPATHLEN + 1];
char logpath[MAXPATHLEN + 1];
char binlogpath[MAXPATHLEN + 1];
char fdinhist[MAXPATHLEN + 1];
char fdouthist[MAXPATHLEN + 1];
char pid_file[MAXPATHLEN + 1];
char passwords[MAXPATHLEN + 1];
#ifdef MAILBOX
char tfilebox[MAXPATHLEN + 1]; /* FileBoxes dir */
char bfilebox[MAXPATHLEN + 1]; /* BrakeBoxes dir */
int deleteablebox;
#endif
#if defined (WITH_ZLIB) && defined (ZLIBDL)
char zlib_dll[MAXPATHLEN + 1];
#endif
#if defined (WITH_BZLIB2) && defined (ZLIBDL)
char bzlib2_dll[MAXPATHLEN + 1];
#endif
#ifdef WITH_PERL
char perl_script[MAXPATHLEN + 1];
char perl_dll[MAXPATHLEN + 1];
int perl_strict;
void *perl;
int perl_ok;
#endif
};
extern BINKD_CONFIG *current_config;
#if defined (HAVE_VSYSLOG) && defined (HAVE_FACILITYNAMES)
extern int syslog_facility;
#endif
/*
* Parses and reads the path as a config
* Return 1 if config has been loaded Ok
*/
BINKD_CONFIG *readcfg (char *path);
/*
* Checking for changed config files and reloading if necessary.
* Return 1 if config has been reloaded Ok
*/
int checkcfg (void);
/*
* Dump parsed config
*/
void debug_readcfg (void);
/*
* Locks current config structure and return pointer to it in one
* thread-safe operation
*/
BINKD_CONFIG *lock_current_config(void);
/*
* Increment lock counter on specific config
*/
void lock_config_structure(BINKD_CONFIG *c);
/*
* Release config structure after usage
*/
void unlock_config_structure(BINKD_CONFIG *c, int on_exit);
/*
* Lists
*/
void simplelist_add(struct list_linkpoint *lp, void *data, int size);
void simplelist_free(struct list_linkpoint *lp, void (*destructor)(void *));
/*
* Popular destructors
*/
void destroy_maskchain(void *p);
int get_host_and_port (int n, char *host, char *port, char *src, FTN_ADDR *fa, BINKD_CONFIG *config);
char *mask_test(char *s, struct maskchain *chain);
#if defined(WITH_ZLIB) || defined(WITH_BZLIB2)
struct zrule *zrule_test(int type, char *s, struct zrule *root);
#endif
#ifdef BW_LIM
long parse_rate (char *w, char **err);
char *describe_rate(long rate);
#endif
#endif
|