}
//-----------------------------------------------------------------------------
AUTH_AO::AUTH_AO()
- : errorStr(),
- users(NULL),
- usersList(),
+ : users(NULL),
isRunning(false),
- settings(),
- BeforeChgAONotifierList(),
- AfterChgAONotifierList(),
- BeforeChgIPNotifierList(),
- AfterChgIPNotifierList(),
onAddUserNotifier(*this),
onDelUserNotifier(*this),
logger(GetPluginLogger(GetStgLogger(), "auth_ao"))
///////////////////////////
pv.param = "Port";
pvi = find(s.moduleParams.begin(), s.moduleParams.end(), pv);
-if (pvi == s.moduleParams.end())
+if (pvi == s.moduleParams.end() || pvi->value.empty())
{
errorStr = "Parameter \'Port\' not found.";
printfd(__FILE__, "Parameter 'Port' not found\n");
///////////////////////////
pv.param = "UserDelay";
pvi = find(s.moduleParams.begin(), s.moduleParams.end(), pv);
-if (pvi == s.moduleParams.end())
+if (pvi == s.moduleParams.end() || pvi->value.empty())
{
errorStr = "Parameter \'UserDelay\' not found.";
printfd(__FILE__, "Parameter 'UserDelay' not found\n");
///////////////////////////
pv.param = "UserTimeout";
pvi = find(s.moduleParams.begin(), s.moduleParams.end(), pv);
-if (pvi == s.moduleParams.end())
+if (pvi == s.moduleParams.end() || pvi->value.empty())
{
errorStr = "Parameter \'UserTimeout\' not found.";
printfd(__FILE__, "Parameter 'UserTimeout' not found\n");
///////////////////////////
pv.param = "LogProtocolErrors";
pvi = find(s.moduleParams.begin(), s.moduleParams.end(), pv);
-if (pvi == s.moduleParams.end())
+if (pvi == s.moduleParams.end() || pvi->value.empty())
logProtocolErrors = false;
else if (ParseYesNo(pvi->value[0], &logProtocolErrors))
{
int n = 0;
pv.param = "FreeMb";
pvi = find(s.moduleParams.begin(), s.moduleParams.end(), pv);
-if (pvi == s.moduleParams.end())
+if (pvi == s.moduleParams.end() || pvi->value.empty())
{
errorStr = "Parameter \'FreeMb\' not found.";
printfd(__FILE__, "Parameter 'FreeMb' not found\n");
#ifdef IA_PHASE_DEBUG
IA_PHASE::IA_PHASE()
: phase(1),
- phaseTime(),
flog(NULL)
{
gettimeofday(&phaseTime, NULL);
}
#else
IA_PHASE::IA_PHASE()
- : phase(1),
- phaseTime()
+ : phase(1)
{
gettimeofday(&phaseTime, NULL);
}
NF_CAP::NF_CAP()
: traffCnt(NULL),
- settings(),
- tidTCP(),
- tidUDP(),
runningTCP(false),
runningUDP(false),
stoppedTCP(true),
portU(0),
sockTCP(-1),
sockUDP(-1),
- errorStr(),
logger(GetPluginLogger(GetStgLogger(), "cap_nf"))
{
}
std::vector<PARAM_VALUE>::iterator it;
for (it = settings.moduleParams.begin(); it != settings.moduleParams.end(); ++it)
{
- if (it->param == "TCPPort")
+ if (it->param == "TCPPort" && !it->value.empty())
{
if (str2x(it->value[0], portT))
{
}
continue;
}
- if (it->param == "UDPPort")
+ if (it->param == "UDPPort" && !it->value.empty())
{
if (str2x(it->value[0], portU))
{
}
//-----------------------------------------------------------------------------
DIVERT_CAP::DIVERT_CAP()
- : settings(),
- port(0),
+ : port(0),
disableForwarding(false),
- errorStr(),
- thread(),
nonstop(false),
isRunning(false),
traffCnt(NULL),
pv.param = "Port";
pvi = std::find(settings.moduleParams.begin(), settings.moduleParams.end(), pv);
-if (pvi == settings.moduleParams.end())
+if (pvi == settings.moduleParams.end() || pvi->value.empty())
{
p = 15701;
}
bool d = false;
pv.param = "DisableForwarding";
pvi = std::find(settings.moduleParams.begin(), settings.moduleParams.end(), pv);
-if (pvi == settings.moduleParams.end())
+if (pvi == settings.moduleParams.end() || pvi->value.empty())
{
disableForwarding = false;
}
}
//-----------------------------------------------------------------------------
BPF_CAP::BPF_CAP()
- : capSettings(),
- errorStr(),
- bpfData(),
- polld(),
- thread(),
- nonstop(false),
+ : nonstop(false),
isRunning(false),
capSock(-1),
- settings(),
traffCnt(NULL),
logger(GetPluginLogger(GetStgLogger(), "cap_bpf"))
{
}
//-----------------------------------------------------------------------------
ETHER_CAP::ETHER_CAP()
- : errorStr(),
- thread(),
- nonstop(false),
+ : nonstop(false),
isRunning(false),
capSock(-1),
traffCnt(NULL),
//-----------------------------------------------------------------------------
IPQ_CAP::IPQ_CAP()
: ipq_h(NULL),
- errorStr(),
- thread(),
nonstop(false),
isRunning(false),
capSock(-1),
traffCnt(NULL),
- buf(),
logger(GetPluginLogger(GetStgLogger(), "cap_ipq"))
{
memset(buf, 0, BUFSIZE);
}
//-----------------------------------------------------------------------------
NFQ_CAP::NFQ_CAP()
- : errorStr(),
- thread(),
- nonstop(false),
+ : nonstop(false),
isRunning(false),
queueNumber(0),
nfqHandle(NULL),
int NFQ_CAP::ParseSettings()
{
for (size_t i = 0; i < settings.moduleParams.size(); i++)
- if (settings.moduleParams[i].param == "queueNumber")
- if (str2x(settings.moduleParams[i].param, queueNumber) < 0)
+ if (settings.moduleParams[i].param == "queueNumber" && !settings.moduleParams[i].value.empty())
+ if (str2x(settings.moduleParams[i].value[0], queueNumber) < 0)
{
errorStr = "Queue number should be a number. Got: '" + settings.moduleParams[i].param + "'";
logger(errorStr);
extern "C" PLUGIN * GetPlugin();
RPC_CONFIG_SETTINGS::RPC_CONFIG_SETTINGS()
- : errorStr(),
- port(0),
+ : port(0),
cookieTimeout(0)
{
}
pv.param = "Port";
std::vector<PARAM_VALUE>::const_iterator pvi;
pvi = std::find(s.moduleParams.begin(), s.moduleParams.end(), pv);
-if (pvi == s.moduleParams.end())
+if (pvi == s.moduleParams.end() || pvi->value.empty())
{
errorStr = "Parameter \'Port\' not found.";
printfd(__FILE__, "Parameter 'Port' not found\n");
pv.param = "CookieTimeout";
pvi = std::find(s.moduleParams.begin(), s.moduleParams.end(), pv);
-if (pvi == s.moduleParams.end())
+if (pvi == s.moduleParams.end() || pvi->value.empty())
{
cookieTimeout = 1800; // 30 * 60
}
}
RPC_CONFIG::RPC_CONFIG()
- : errorStr(),
- rpcConfigSettings(),
- users(NULL),
+ : users(NULL),
admins(NULL),
tariffs(NULL),
store(NULL),
- settings(),
fd(-1),
- rpcRegistry(),
rpcServer(NULL),
running(false),
stopped(true),
- tid(),
- cookies(),
dayFee(0),
- dirNames(),
logger(GetPluginLogger(GetStgLogger(), "conf_rpc"))
{
}
///////////////////////////
pv.param = "Port";
pvi = std::find(s.moduleParams.begin(), s.moduleParams.end(), pv);
- if (pvi == s.moduleParams.end())
+ if (pvi == s.moduleParams.end() || pvi->value.empty())
{
errorStr = "Parameter \'Port\' is not found.";
printfd(__FILE__, "%s\n", errorStr.c_str());
pv.param = "BindAddress";
pvi = std::find(s.moduleParams.begin(), s.moduleParams.end(), pv);
- if (pvi != s.moduleParams.end())
+ if (pvi != s.moduleParams.end() && !pvi->value.empty())
m_bindAddress = pvi->value[0];
return true;
pv.param = "PingDelay";
pvi = std::find(s.moduleParams.begin(), s.moduleParams.end(), pv);
-if (pvi == s.moduleParams.end())
+if (pvi == s.moduleParams.end() || pvi->value.empty())
{
errorStr = "Parameter \'PingDelay\' not found.";
printfd(__FILE__, "Parameter 'PingDelay' not found\n");
}
//-----------------------------------------------------------------------------
PING::PING()
- : errorStr(),
- pingSettings(),
- settings(),
- users(NULL),
- usersList(),
- thread(),
- mutex(),
+ : users(NULL),
nonstop(false),
isRunning(false),
- pinger(),
- ChgCurrIPNotifierList(),
- ChgIPNotifierList(),
onAddUserNotifier(*this),
onDelUserNotifier(*this),
logger(GetPluginLogger(GetStgLogger(), "ping"))
//-----------------------------------------------------------------------------
RS::SETTINGS::SETTINGS()
: sendPeriod(0),
- port(0),
- errorStr(),
- netRouters(),
- userParams(),
- password(),
- subnetFile()
+ port(0)
{
}
//-----------------------------------------------------------------------------
///////////////////////////
pv.param = "Port";
pvi = find(s.moduleParams.begin(), s.moduleParams.end(), pv);
-if (pvi == s.moduleParams.end())
+if (pvi == s.moduleParams.end() || pvi->value.empty())
{
errorStr = "Parameter \'Port\' not found.";
printfd(__FILE__, "Parameter 'Port' not found\n");
///////////////////////////
pv.param = "SendPeriod";
pvi = find(s.moduleParams.begin(), s.moduleParams.end(), pv);
-if (pvi == s.moduleParams.end())
+if (pvi == s.moduleParams.end() || pvi->value.empty())
{
errorStr = "Parameter \'SendPeriod\' not found.";
printfd(__FILE__, "Parameter 'SendPeriod' not found\n");
///////////////////////////
pv.param = "UserParams";
pvi = find(s.moduleParams.begin(), s.moduleParams.end(), pv);
-if (pvi == s.moduleParams.end())
+if (pvi == s.moduleParams.end() || pvi->value.empty())
{
errorStr = "Parameter \'UserParams\' not found.";
printfd(__FILE__, "Parameter 'UserParams' not found\n");
///////////////////////////
pv.param = "Password";
pvi = find(s.moduleParams.begin(), s.moduleParams.end(), pv);
-if (pvi == s.moduleParams.end())
+if (pvi == s.moduleParams.end() || pvi->value.empty())
{
errorStr = "Parameter \'Password\' not found.";
printfd(__FILE__, "Parameter 'Password' not found\n");
///////////////////////////
pv.param = "SubnetFile";
pvi = find(s.moduleParams.begin(), s.moduleParams.end(), pv);
-if (pvi == s.moduleParams.end())
+if (pvi == s.moduleParams.end() || pvi->value.empty())
{
errorStr = "Parameter \'SubnetFile\' not found.";
printfd(__FILE__, "Parameter 'SubnetFile' not found\n");
{
PLUGIN_CREATOR<SMUX> smc;
-bool SPrefixLess(const Sensors::value_type & a,
- const Sensors::value_type & b);
-
bool SPrefixLess(const Sensors::value_type & a,
const Sensors::value_type & b)
{
pv.param = "Port";
pvi = std::find(s.moduleParams.begin(), s.moduleParams.end(), pv);
-if (pvi == s.moduleParams.end())
+if (pvi == s.moduleParams.end() || pvi->value.empty())
{
errorStr = "Parameter \'Port\' not found.";
printfd(__FILE__, "Parameter 'Port' not found\n");
pv.param = "Password";
pvi = std::find(s.moduleParams.begin(), s.moduleParams.end(), pv);
-if (pvi == s.moduleParams.end())
+if (pvi == s.moduleParams.end() || pvi->value.empty())
{
errorStr = "Parameter \'Password\' not found.";
printfd(__FILE__, "Parameter 'Password' not found\n");
pv.param = "Server";
pvi = std::find(s.moduleParams.begin(), s.moduleParams.end(), pv);
-if (pvi == s.moduleParams.end())
+if (pvi == s.moduleParams.end() || pvi->value.empty())
{
errorStr = "Parameter \'Server\' not found.";
printfd(__FILE__, "Parameter 'Server' not found\n");
//-----------------------------------------------------------------------------
FILES_STORE_SETTINGS::FILES_STORE_SETTINGS()
: settings(NULL),
- errorStr(),
- workDir(),
- usersDir(),
- adminsDir(),
- tariffsDir(),
statMode(0),
statUID(0),
statGID(0),
pv.param = owner;
std::vector<PARAM_VALUE>::const_iterator pvi;
pvi = find(moduleParams.begin(), moduleParams.end(), pv);
-if (pvi == moduleParams.end())
+if (pvi == moduleParams.end() || pvi->value.empty())
{
errorStr = "Parameter \'" + owner + "\' not found.";
printfd(__FILE__, "%s\n", errorStr.c_str());
pv.param = group;
std::vector<PARAM_VALUE>::const_iterator pvi;
pvi = find(moduleParams.begin(), moduleParams.end(), pv);
-if (pvi == moduleParams.end())
+if (pvi == moduleParams.end() || pvi->value.empty())
{
errorStr = "Parameter \'" + group + "\' not found.";
printfd(__FILE__, "%s\n", errorStr.c_str());
pv.param = modeStr;
std::vector<PARAM_VALUE>::const_iterator pvi;
pvi = find(moduleParams.begin(), moduleParams.end(), pv);
-if (pvi == moduleParams.end())
+if (pvi == moduleParams.end() || pvi->value.empty())
{
errorStr = "Parameter \'" + modeStr + "\' not found.";
printfd(__FILE__, "%s\n", errorStr.c_str());
PARAM_VALUE pv;
pv.param = "RemoveBak";
pvi = find(s.moduleParams.begin(), s.moduleParams.end(), pv);
-if (pvi == s.moduleParams.end())
+if (pvi == s.moduleParams.end() || pvi->value.empty())
{
removeBak = true;
}
pv.param = "ReadBak";
pvi = find(s.moduleParams.begin(), s.moduleParams.end(), pv);
-if (pvi == s.moduleParams.end())
+if (pvi == s.moduleParams.end() || pvi->value.empty())
{
readBak = false;
}
pv.param = "WorkDir";
pvi = find(s.moduleParams.begin(), s.moduleParams.end(), pv);
-if (pvi == s.moduleParams.end())
+if (pvi == s.moduleParams.end() || pvi->value.empty())
{
errorStr = "Parameter \'WorkDir\' not found.";
printfd(__FILE__, "Parameter 'WorkDir' not found\n");
//-----------------------------------------------------------------------------
FIREBIRD_STORE::FIREBIRD_STORE()
: version("firebird_store v.1.4"),
- strError(),
db_server("localhost"),
db_database("/var/stg/stargazer.fdb"),
db_user("stg"),
db_password("123456"),
- settings(),
- db(),
- mutex(),
til(IBPP::ilConcurrency),
tlr(IBPP::lrWait),
schemaVersion(0),
for(i = settings.moduleParams.begin(); i != settings.moduleParams.end(); ++i)
{
+ if (i->value.empty())
+ continue;
s = ToLower(i->param);
if (s == "server")
- db_server = *(i->value.begin());
+ db_server = i->value.front();
if (s == "database")
- db_database = *(i->value.begin());
+ db_database = i->value.front();
if (s == "user")
- db_user = *(i->value.begin());
+ db_user = i->value.front();
if (s == "password")
- db_password = *(i->value.begin());
+ db_password = i->value.front();
// Advanced settings block
if (s == "isolationLevel")
{
- if (*(i->value.begin()) == "Concurrency")
+ if (i->value.front() == "Concurrency")
til = IBPP::ilConcurrency;
- else if (*(i->value.begin()) == "DirtyRead")
+ else if (i->value.front() == "DirtyRead")
til = IBPP::ilReadDirty;
- else if (*(i->value.begin()) == "ReadCommitted")
+ else if (i->value.front() == "ReadCommitted")
til = IBPP::ilReadCommitted;
- else if (*(i->value.begin()) == "Consistency")
+ else if (i->value.front() == "Consistency")
til = IBPP::ilConsistency;
}
if (s == "lockResolution")
{
- if (*(i->value.begin()) == "Wait")
+ if (i->value.front() == "Wait")
tlr = IBPP::lrWait;
- else if (*(i->value.begin()) == "NoWait")
+ else if (i->value.front() == "NoWait")
tlr = IBPP::lrNoWait;
}
}
}
//-----------------------------------------------------------------------------
MYSQL_STORE_SETTINGS::MYSQL_STORE_SETTINGS()
- : settings(NULL),
- errorStr(),
- dbUser(),
- dbPass(),
- dbName(),
- dbHost()
+ : settings(NULL)
{
}
//-----------------------------------------------------------------------------
-int MYSQL_STORE_SETTINGS::ParseParam(const std::vector<PARAM_VALUE> & moduleParams,
- const std::string & name, std::string & result)
+int MYSQL_STORE_SETTINGS::ParseParam(const std::vector<PARAM_VALUE> & moduleParams,
+ const std::string & name, std::string & result)
{
PARAM_VALUE pv;
pv.param = name;
std::vector<PARAM_VALUE>::const_iterator pvi;
pvi = find(moduleParams.begin(), moduleParams.end(), pv);
-if (pvi == moduleParams.end())
+if (pvi == moduleParams.end() || pvi->value.empty())
{
errorStr = "Parameter \'" + name + "\' not found.";
return -1;
}
-
+
result = pvi->value[0];
return 0;
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
MYSQL_STORE::MYSQL_STORE()
- : errorStr(),
- version("mysql_store v.0.67"),
- storeSettings(),
- settings(),
+ : version("mysql_store v.0.67"),
schemaVersion(0),
logger(GetPluginLogger(GetStgLogger(), "store_mysql"))
{
//-----------------------------------------------------------------------------
POSTGRESQL_STORE::POSTGRESQL_STORE()
: versionString("postgresql_store v.1.3"),
- strError(),
server("localhost"),
database("stargazer"),
user("stg"),
password("123456"),
clientEncoding("KOI8"),
- settings(),
- mutex(),
version(0),
retries(3),
connection(NULL),
for(i = settings.moduleParams.begin(); i != settings.moduleParams.end(); ++i)
{
+ if (i->value.empty())
+ continue;
s = ToLower(i->param);
if (s == "server")
{
- server = *(i->value.begin());
+ server = i->value.front();
}
if (s == "database")
{
- database = *(i->value.begin());
+ database = i->value.front();
}
if (s == "user")
{
- user = *(i->value.begin());
+ user = i->value.front();
}
if (s == "password")
{
- password = *(i->value.begin());
+ password = i->value.front();
}
if (s == "retries")
{
- if (str2x(*(i->value.begin()), retries))
+ if (str2x(i->value.front(), retries))
{
strError = "Invalid 'retries' value";
printfd(__FILE__, "POSTGRESQL_STORE::ParseSettings(): '%s'\n", strError.c_str());