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>
21 #ifndef SETTINGS_IMPL_H
22 #define SETTINGS_IMPL_H
24 #include "stg/settings.h"
25 #include "stg/common.h"
26 #include "stg/module_settings.h"
32 //-----------------------------------------------------------------------------
33 enum DETAIL_STAT_PERIOD {
39 //-----------------------------------------------------------------------------
41 class DOTCONFDocumentNode;
42 //-----------------------------------------------------------------------------
43 class SETTINGS_IMPL : public SETTINGS {
45 explicit SETTINGS_IMPL(const std::string &);
46 SETTINGS_IMPL(const SETTINGS_IMPL & rhs);
47 virtual ~SETTINGS_IMPL() {}
48 SETTINGS_IMPL & operator=(const SETTINGS_IMPL &);
50 int Reload() { return ReadSettings(); }
53 std::string GetStrError() const { return strError; }
55 int GetExecMsgKey() const { return stgExecMsgKey; }
56 unsigned GetExecutersNum() const { return executersNum; }
57 const std::string & GetDirName(size_t num) const { return dirName[num]; }
58 const std::string & GetConfDir() const { return confDir; }
59 const std::string & GetScriptsDir() const { return scriptsDir; }
60 const std::string & GetRulesFileName() const { return rules; }
61 const std::string & GetLogFileName() const { return logFile; }
62 const std::string & GetPIDFileName() const { return pidFile; }
63 unsigned GetDetailStatWritePeriod() const
64 { return detailStatWritePeriod; }
65 unsigned GetStatWritePeriod() const { return statWritePeriod * 60; }
66 unsigned GetDayFee() const { return dayFee; }
67 bool GetFullFee() const { return fullFee; }
68 unsigned GetDayResetTraff() const { return dayResetTraff; }
69 bool GetSpreadFee() const { return spreadFee; }
70 bool GetFreeMbAllowInet() const { return freeMbAllowInet; }
71 bool GetDayFeeIsLastDay() const { return dayFeeIsLastDay; }
72 bool GetWriteFreeMbTraffCost() const
73 { return writeFreeMbTraffCost; }
74 bool GetShowFeeInCash() const { return showFeeInCash; }
75 const std::string & GetMonitorDir() const { return monitorDir; }
76 bool GetMonitoring() const { return monitoring; }
77 unsigned GetMessageTimeout() const { return messageTimeout * 3600 * 24; }
78 unsigned GetFeeChargeType() const { return feeChargeType; }
79 bool GetReconnectOnTariffChange() const { return reconnectOnTariffChange; }
80 bool GetDisableSessionLog() const { return disableSessionLog; }
81 const std::vector<std::string> & GetFilterParamsLog() const { return filterParamsLog; }
83 const std::string & GetModulesPath() const { return modulesPath; }
84 const MODULE_SETTINGS & GetStoreModuleSettings() const
85 { return storeModuleSettings; }
86 const std::vector<MODULE_SETTINGS> & GetModulesSettings() const
87 { return modulesSettings; }
88 const std::vector<std::string> & GetScriptParams() const { return scriptParams; }
92 static void ErrorCallback(void * data, const char * buf);
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;
117 bool writeFreeMbTraffCost;
119 unsigned messageTimeout;
120 unsigned feeChargeType;
121 bool reconnectOnTariffChange;
122 bool disableSessionLog;
123 std::vector<std::string> filterParamsLog;
125 std::vector<MODULE_SETTINGS> modulesSettings;
126 MODULE_SETTINGS storeModuleSettings;
127 STG::RefWrapper<STG_LOGGER> logger;
129 //-----------------------------------------------------------------------------