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
27 #include "stg/settings.h"
28 #include "stg/module_settings.h"
31 //-----------------------------------------------------------------------------
32 enum DETAIL_STAT_PERIOD {
38 //-----------------------------------------------------------------------------
40 class DOTCONFDocumentNode;
41 //-----------------------------------------------------------------------------
42 class SETTINGS_IMPL : public SETTINGS {
44 SETTINGS_IMPL(const std::string &);
45 virtual ~SETTINGS_IMPL() {}
46 int Reload() { return ReadSettings(); }
49 std::string GetStrError() const { return strError; }
51 int GetExecMsgKey() const { return stgExecMsgKey; }
52 unsigned GetExecutersNum() const { return executersNum; }
53 const std::string & GetDirName(size_t num) const { return dirName[num]; }
54 const std::string & GetConfDir() const { return confDir; }
55 const std::string & GetScriptsDir() const { return scriptsDir; }
56 const std::string & GetRulesFileName() const { return rules; }
57 const std::string & GetLogFileName() const { return logFile; }
58 const std::string & GetPIDFileName() const { return pidFile; }
59 unsigned GetDetailStatWritePeriod() const
60 { return detailStatWritePeriod; }
61 unsigned GetStatWritePeriod() const { return statWritePeriod * 60; }
62 unsigned GetDayFee() const { return dayFee; }
63 bool GetFullFee() const { return fullFee; }
64 unsigned GetDayResetTraff() const { return dayResetTraff; }
65 bool GetSpreadFee() const { return spreadFee; }
66 bool GetFreeMbAllowInet() const { return freeMbAllowInet; }
67 bool GetDayFeeIsLastDay() const { return dayFeeIsLastDay; }
68 bool GetWriteFreeMbTraffCost() const
69 { return writeFreeMbTraffCost; }
70 bool GetShowFeeInCash() const { return showFeeInCash; }
71 const std::string & GetMonitorDir() const { return monitorDir; }
72 bool GetMonitoring() const { return monitoring; }
73 unsigned GetMessageTimeout() const { return messageTimeout * 3600 * 24; }
74 unsigned GetFeeChargeType() const { return feeChargeType; }
75 bool GetReconnectOnTariffChange() const { return reconnectOnTariffChange; }
77 const std::string & GetModulesPath() const { return modulesPath; }
78 const MODULE_SETTINGS & GetStoreModuleSettings() const
79 { return storeModuleSettings; }
80 const std::vector<MODULE_SETTINGS> & GetModulesSettings() const
81 { return modulesSettings; }
82 const std::vector<std::string> & GetScriptParams() const { return scriptParams; }
86 static void ErrorCallback(void * data, const char * buf);
91 std::string modulesPath;
92 std::vector<std::string> dirName;
94 std::string scriptsDir;
98 std::string monitorDir;
99 std::vector<std::string> scriptParams;
101 unsigned detailStatWritePeriod;
102 unsigned statWritePeriod;
104 unsigned executersNum;
107 unsigned dayResetTraff;
109 bool freeMbAllowInet;
110 bool dayFeeIsLastDay;
111 bool writeFreeMbTraffCost;
113 unsigned messageTimeout;
114 unsigned feeChargeType;
115 bool reconnectOnTariffChange;
117 std::vector<MODULE_SETTINGS> modulesSettings;
118 MODULE_SETTINGS storeModuleSettings;
119 STG::RefWrapper<STG_LOGGER> logger;
121 //-----------------------------------------------------------------------------