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 GetStopOnError() const { return stopOnError; }
73 bool GetWriteFreeMbTraffCost() const
74 { return writeFreeMbTraffCost; }
75 bool GetShowFeeInCash() const { return showFeeInCash; }
76 const std::string & GetMonitorDir() const { return monitorDir; }
77 bool GetMonitoring() const { return monitoring; }
78 unsigned GetMessageTimeout() const { return messageTimeout * 3600 * 24; }
79 unsigned GetFeeChargeType() const { return feeChargeType; }
80 bool GetReconnectOnTariffChange() const { return reconnectOnTariffChange; }
81 bool GetDisableSessionLog() const { return disableSessionLog; }
82 const std::vector<std::string> & GetFilterParamsLog() const { return filterParamsLog; }
84 const std::string & GetModulesPath() const { return modulesPath; }
85 const MODULE_SETTINGS & GetStoreModuleSettings() const
86 { return storeModuleSettings; }
87 const std::vector<MODULE_SETTINGS> & GetModulesSettings() const
88 { return modulesSettings; }
89 const std::vector<std::string> & GetScriptParams() const { return scriptParams; }
93 static void ErrorCallback(void * data, const char * buf);
98 std::string modulesPath;
99 std::vector<std::string> dirName;
101 std::string scriptsDir;
105 std::string monitorDir;
106 std::vector<std::string> scriptParams;
108 unsigned detailStatWritePeriod;
109 unsigned statWritePeriod;
111 unsigned executersNum;
114 unsigned dayResetTraff;
116 bool freeMbAllowInet;
117 bool dayFeeIsLastDay;
119 bool writeFreeMbTraffCost;
121 unsigned messageTimeout;
122 unsigned feeChargeType;
123 bool reconnectOnTariffChange;
124 bool disableSessionLog;
125 std::vector<std::string> filterParamsLog;
127 std::vector<MODULE_SETTINGS> modulesSettings;
128 MODULE_SETTINGS storeModuleSettings;
129 STG::RefWrapper<STG_LOGGER> logger;
131 //-----------------------------------------------------------------------------