2  *    This program is free software; you can redistribute it and/or modify
 
   3  *    it under the terms of the GNU General Public License as published by
 
   4  *    the Free Software Foundation; either version 2 of the License, or
 
   5  *    (at your option) any later version.
 
   7  *    This program is distributed in the hope that it will be useful,
 
   8  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
   9  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
  10  *    GNU General Public License for more details.
 
  12  *    You should have received a copy of the GNU General Public License
 
  13  *    along with this program; if not, write to the Free Software
 
  14  *    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
  18  *    Author : Boris Mikhailenko <stg34@stargazer.dp.ua>
 
  23 #include "stg/settings.h"
 
  24 #include "stg/common.h"
 
  25 #include "stg/module_settings.h"
 
  30 class DOTCONFDocumentNode;
 
  35 //-----------------------------------------------------------------------------
 
  36 enum DETAIL_STAT_PERIOD {
 
  42 //-----------------------------------------------------------------------------
 
  43 class SettingsImpl : public Settings {
 
  45         explicit SettingsImpl(const std::string &);
 
  47         SettingsImpl(const SettingsImpl&) = default;
 
  48         SettingsImpl& operator=(const SettingsImpl&) = default;
 
  49         SettingsImpl(SettingsImpl&&) = default;
 
  50         SettingsImpl& operator=(SettingsImpl&&) = default;
 
  52         int Reload() { return ReadSettings(); }
 
  55         std::string GetStrError() const { return strError; }
 
  57         int                 GetExecMsgKey() const { return stgExecMsgKey; }
 
  58         unsigned            GetExecutersNum() const { return executersNum; }
 
  59         const std::string & GetDirName(size_t num) const { return dirName[num]; }
 
  60         const std::string & GetConfDir() const { return confDir; }
 
  61         const std::string & GetScriptsDir() const { return scriptsDir; }
 
  62         const std::string & GetRulesFileName() const { return rules; }
 
  63         const std::string & GetLogFileName() const { return logFile; }
 
  64         const std::string & GetPIDFileName() const { return pidFile; }
 
  65         unsigned            GetDetailStatWritePeriod() const
 
  66             { return detailStatWritePeriod; }
 
  67         unsigned            GetStatWritePeriod() const { return statWritePeriod * 60; }
 
  68         unsigned            GetDayFee() const { return dayFee; }
 
  69         bool                GetFullFee() const { return fullFee; }
 
  70         unsigned            GetDayResetTraff() const { return dayResetTraff; }
 
  71         bool                GetSpreadFee() const { return spreadFee; }
 
  72         bool                GetFreeMbAllowInet() const { return freeMbAllowInet; }
 
  73         bool                GetDayFeeIsLastDay() const { return dayFeeIsLastDay; }
 
  74         bool                GetStopOnError() const { return stopOnError; }
 
  75         bool                GetWriteFreeMbTraffCost() const
 
  76             { return writeFreeMbTraffCost; }
 
  77         bool                GetShowFeeInCash() const { return showFeeInCash; }
 
  78         const std::string & GetMonitorDir() const { return monitorDir; }
 
  79         bool                GetMonitoring() const { return monitoring; }
 
  80         unsigned            GetMessageTimeout() const { return messageTimeout * 3600 * 24; }
 
  81         unsigned            GetFeeChargeType() const { return feeChargeType; }
 
  82         bool                GetReconnectOnTariffChange() const { return reconnectOnTariffChange; }
 
  83         bool                GetDisableSessionLog() const { return disableSessionLog; }
 
  84         const std::vector<std::string> & GetFilterParamsLog() const { return filterParamsLog; }
 
  86         const std::string & GetModulesPath() const { return modulesPath; }
 
  87         const ModuleSettings & GetStoreModuleSettings() const
 
  88         { return storeModuleSettings; }
 
  89         const std::vector<ModuleSettings> & GetModulesSettings() const
 
  90         { return modulesSettings; }
 
  91         const std::vector<std::string> & GetScriptParams() const { return scriptParams; }
 
  97         std::string modulesPath;
 
  98         std::vector<std::string> dirName;
 
 100         std::string scriptsDir;
 
 104         std::string monitorDir;
 
 105         std::vector<std::string> scriptParams;
 
 107         unsigned    detailStatWritePeriod;
 
 108         unsigned    statWritePeriod;
 
 110         unsigned    executersNum;
 
 113         unsigned    dayResetTraff;
 
 115         bool        freeMbAllowInet;
 
 116         bool        dayFeeIsLastDay;
 
 118         bool        writeFreeMbTraffCost;
 
 120         unsigned    messageTimeout;
 
 121         unsigned    feeChargeType;
 
 122         bool        reconnectOnTariffChange;
 
 123         bool        disableSessionLog;
 
 124         std::vector<std::string> filterParamsLog;
 
 126         std::vector<ModuleSettings> modulesSettings;
 
 127         ModuleSettings storeModuleSettings;
 
 129 //-----------------------------------------------------------------------------