-#include <stdio.h>
-#include <signal.h>
-
+#include <cstdio>
+#include <cassert>
+#include <csignal>
#include <ctime>
#include <algorithm>
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-PING_SETTINGS::PING_SETTINGS()
- : pingDelay(0)
-{
-}
-//-----------------------------------------------------------------------------
int PING_SETTINGS::ParseSettings(const MODULE_SETTINGS & s)
{
PARAM_VALUE pv;
}
//-----------------------------------------------------------------------------
PING::PING()
- : users(NULL),
+ : errorStr(),
+ pingSettings(),
+ settings(),
+ users(NULL),
+ usersList(),
+ thread(),
+ mutex(),
nonstop(false),
isRunning(false),
+ pinger(),
+ ChgCurrIPNotifierList(),
+ ChgIPNotifierList(),
onAddUserNotifier(*this),
onDelUserNotifier(*this)
{
pthread_mutex_destroy(&mutex);
}
//-----------------------------------------------------------------------------
-const std::string PING::GetVersion() const
-{
-return "Pinger v.1.01";
-}
-//-----------------------------------------------------------------------------
-void PING::SetSettings(const MODULE_SETTINGS & s)
-{
-settings = s;
-}
-//-----------------------------------------------------------------------------
int PING::ParseSettings()
{
int ret = pingSettings.ParseSettings(settings);
return ret;
}
//-----------------------------------------------------------------------------
-void PING::SetUsers(USERS * u)
-{
-users = u;
-}
-//-----------------------------------------------------------------------------
-const std::string & PING::GetStrError() const
-{
-return errorStr;
-}
-//-----------------------------------------------------------------------------
int PING::Start()
{
GetUsers();
return NULL;
}
//-----------------------------------------------------------------------------
-uint16_t PING::GetStartPosition() const
-{
-return 100;
-}
-//-----------------------------------------------------------------------------
-uint16_t PING::GetStopPosition() const
-{
-return 100;
-}
-//-----------------------------------------------------------------------------
void PING::SetUserNotifiers(USER_PTR u)
{
CHG_CURRIP_NOTIFIER_PING ChgCurrIPNotifier(*this, u);
USER_PTR u;
int h = users->OpenSearch();
-if (!h)
- {
- printfd(__FILE__, "users->OpenSearch() error\n");
- return;
- }
+assert(h && "USERS::OpenSearch is always correct");
while (users->SearchNext(h, &u) == 0)
{