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 $
43 #include "base_settings.h"
47 //-----------------------------------------------------------------------------
48 enum DETAIL_STAT_PERIOD
55 //-----------------------------------------------------------------------------
57 class DOTCONFDocumentNode;
58 //-----------------------------------------------------------------------------
63 SETTINGS(const std::string &);
64 SETTINGS(const SETTINGS &);
66 int Reload() { return ReadSettings(); };
69 string GetStrError() const { return strError; };
71 int GetExecMsgKey() const { return stgExecMsgKey; };
72 unsigned GetExecutersNum() const { return executersNum; };
73 const string & GetDirName(int num) const { return dirName[num]; };
74 const string & GetConfDir() const { return confDir; };
75 const string & GetScriptDir() const { return scriptDir; };
76 const string & GetRulesFileName() const { return rules; };
77 const string & GetLogFileName() const { return logFile; };
78 const string & GetPIDFileName() const { return pidFile; };
79 unsigned GetDetailStatWritePeriod() const
80 { return detailStatWritePeriod; };
81 unsigned GetStatWritePeriod() const { return statWritePeriod * 60; };
82 unsigned GetDayFee() const { return dayFee; };
83 bool GetFullFee() const { return fullFee; };
84 unsigned GetDayResetTraff() const { return dayResetTraff; };
85 bool GetSpreadFee() const { return spreadFee; };
86 bool GetFreeMbAllowInet() const { return freeMbAllowInet; };
87 bool GetDayFeeIsLastDay() const { return dayFeeIsLastDay; };
88 bool GetWriteFreeMbTraffCost() const
89 { return writeFreeMbTraffCost; };
90 bool GetShowFeeInCash() const { return showFeeInCash; };
91 const string & GetMonitorDir() const { return monitorDir; };
92 bool GetMonitoring() const { return monitoring; };
93 unsigned GetMessageTimeout() const { return messageTimeout * 3600 * 24; };
95 const string & GetModulesPath() const { return modulesPath; };
96 const MODULE_SETTINGS & GetStoreModuleSettings() const
97 { return storeModuleSettings; };
98 const vector<MODULE_SETTINGS> & GetModulesSettings() const
99 { return modulesSettings; };
103 int ParseInt(const string & value, int * val);
104 int ParseUnsigned(const string & value, unsigned * val);
105 int ParseIntInRange(const string & value, int min, int max, int * val);
106 int ParseUnsignedInRange(const string & value, unsigned min, unsigned max, unsigned * val);
107 int ParseYesNo(const string & value, bool * val);
108 int ParseDetailStatWritePeriod(const string & detailStatPeriodStr);
110 int ParseModuleSettings(const DOTCONFDocumentNode * dirNameNode, vector<PARAM_VALUE> * params);
112 static void ErrorCallback(void * data, const char * buf);
117 string dirName[DIR_NUM];
125 unsigned detailStatWritePeriod;
126 unsigned statWritePeriod;
128 unsigned executersNum;
130 unsigned dayFee; // ÄÅÎØ ÓÎÑÔÉÑ ÁÂÏÎÐÌÁÔÙ
131 unsigned dayResetTraff; // îÁÞÁÌÏ ÕÞÅÔÎÏÇÏ ÐÅÒÉÏÄÁ: ÄÅÎØ ÏÂÎÕÌÅÎÉÑ ÔÒÁÆÉËÁ É ÓÍÅÎÙ ÔÁÒÉÆÁ
133 bool freeMbAllowInet;
134 bool dayFeeIsLastDay; // áð ÓÎÉÍÁÅÔÓÑ × ËÏÎÃÅ ÍÅÓÑÃÁ (true) ÉÌÉ × ÎÁÞÁÌÅ (false)
135 bool writeFreeMbTraffCost; // ðÉÓÁÔØ × ÄÅÔÁÌØÎÕÀ ÓÔÁÔÉÓÔÉËÕ ÓÔÏÉÍÏÓÔØ ÔÒÁÆÉËÁ, ÅÓÌÉ ÅÝÅ ÅÓÔØ ÐÒÅÄÏÐÌÁÞÅÎÎÙÊ ÔÒÁÆÉË
136 bool showFeeInCash; // ðÏËÁÚÙ×ÁÔØ ÐÏÌØÚÏ×ÁÔÅÌÀ áð ÎÅ ÓÞÅÔÕ É ÐÏÚ×ÏÌÑÔØ ÅÅ ÉÓÐÏÌØÚÏ×ÁÔØ
137 unsigned messageTimeout; // ÷ÒÅÍÑ ÖÉÚÎÉ ÎÅÏÔÐÒÁ×ÌÅÎÎÏÇÏ ÓÏÏÂÝÅÎÉÑ × ÓÅËÕÎÄÁÈ
139 vector<MODULE_SETTINGS> modulesSettings;
140 MODULE_SETTINGS storeModuleSettings;
144 //-----------------------------------------------------------------------------