3 $Date: 2010/08/19 13:42:30 $
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 * Author : Boris Mikhailenko <stg34@stargazer.dp.ua>
33 $Date: 2010/08/19 13:42:30 $
37 #ifndef SETTINGS_IMPL_H
38 #define SETTINGS_IMPL_H
40 #include "stg/settings.h"
41 #include "stg/common.h"
42 #include "stg/module_settings.h"
47 //-----------------------------------------------------------------------------
48 enum DETAIL_STAT_PERIOD {
54 //-----------------------------------------------------------------------------
56 class DOTCONFDocumentNode;
57 //-----------------------------------------------------------------------------
58 class SETTINGS_IMPL : public SETTINGS {
60 explicit SETTINGS_IMPL(const std::string &);
61 SETTINGS_IMPL(const SETTINGS_IMPL &);
62 virtual ~SETTINGS_IMPL() {}
63 SETTINGS_IMPL & operator=(const SETTINGS_IMPL &);
65 int Reload() { return ReadSettings(); }
68 std::string GetStrError() const { return strError; }
70 int GetExecMsgKey() const { return stgExecMsgKey; }
71 unsigned GetExecutersNum() const { return executersNum; }
72 const std::string & GetDirName(size_t num) const { return dirName[num]; }
73 const std::string & GetConfDir() const { return confDir; }
74 const std::string & GetScriptsDir() const { return scriptsDir; }
75 const std::string & GetRulesFileName() const { return rules; }
76 const std::string & GetLogFileName() const { return logFile; }
77 const std::string & GetPIDFileName() const { return pidFile; }
78 unsigned GetDetailStatWritePeriod() const
79 { return detailStatWritePeriod; }
80 unsigned GetStatWritePeriod() const { return statWritePeriod * 60; }
81 unsigned GetDayFee() const { return dayFee; }
82 bool GetFullFee() const { return fullFee; }
83 unsigned GetDayResetTraff() const { return dayResetTraff; }
84 bool GetSpreadFee() const { return spreadFee; }
85 bool GetFreeMbAllowInet() const { return freeMbAllowInet; }
86 bool GetDayFeeIsLastDay() const { return dayFeeIsLastDay; }
87 bool GetWriteFreeMbTraffCost() const
88 { return writeFreeMbTraffCost; }
89 bool GetShowFeeInCash() const { return showFeeInCash; }
90 const std::string & GetMonitorDir() const { return monitorDir; }
91 bool GetMonitoring() const { return monitoring; }
92 unsigned GetMessageTimeout() const { return messageTimeout * 3600 * 24; }
93 unsigned GetFeeChargeType() const { return feeChargeType; }
94 bool GetReconnectOnTariffChange() const { return reconnectOnTariffChange; }
95 bool GetDisableSessionLog() const { return disableSessionLog; }
96 const std::vector<std::string> & GetFilterParamsLog() const { return filterParamsLog; }
98 const std::string & GetModulesPath() const { return modulesPath; }
99 const MODULE_SETTINGS & GetStoreModuleSettings() const
100 { return storeModuleSettings; }
101 const std::vector<MODULE_SETTINGS> & GetModulesSettings() const
102 { return modulesSettings; }
103 const std::vector<std::string> & GetScriptParams() const { return scriptParams; }
107 int ParseDetailStatWritePeriod(const std::string & str);
108 int ParseModuleSettings(const DOTCONFDocumentNode * dirNameNode, std::vector<PARAM_VALUE> * params);
110 static void ErrorCallback(void * data, const char * buf);
112 std::string strError;
115 std::string modulesPath;
116 std::vector<std::string> dirName;
118 std::string scriptsDir;
122 std::string monitorDir;
123 std::vector<std::string> scriptParams;
125 unsigned detailStatWritePeriod;
126 unsigned statWritePeriod;
128 unsigned executersNum;
131 unsigned dayResetTraff;
133 bool freeMbAllowInet;
134 bool dayFeeIsLastDay;
135 bool writeFreeMbTraffCost;
137 unsigned messageTimeout;
138 unsigned feeChargeType;
139 bool reconnectOnTariffChange;
140 bool disableSessionLog;
141 std::vector<std::string> filterParamsLog;
143 std::vector<MODULE_SETTINGS> modulesSettings;
144 MODULE_SETTINGS storeModuleSettings;
147 //-----------------------------------------------------------------------------