diff --git a/include/HostAlert.h b/include/HostAlert.h index ec10d7824b..539479faa0 100644 --- a/include/HostAlert.h +++ b/include/HostAlert.h @@ -41,8 +41,10 @@ class HostAlert { Adds to the passed `serializer` (generated with `getAlertSerializer`) information specific to this alert */ virtual ndpi_serializer* getAlertJSON(ndpi_serializer* serializer) { return serializer; } + void init(HostCheckID _check_id, std::string _check_name, Host *h, risk_percentage _cli_pctg); public: + HostAlert(HostCheckID check_id, std::string check_name, Host *h, risk_percentage _cli_pctg); HostAlert(HostCheck *c, Host *h, risk_percentage _cli_pctg); virtual ~HostAlert(); diff --git a/src/HostAlert.cpp b/src/HostAlert.cpp index fac45831b2..bf52f0816e 100644 --- a/src/HostAlert.cpp +++ b/src/HostAlert.cpp @@ -23,11 +23,11 @@ /* **************************************************** */ -HostAlert::HostAlert(HostCheck *c, Host *h, risk_percentage _cli_pctg) { +void HostAlert::init(HostCheckID _check_id, std::string _check_name, Host *h, risk_percentage _cli_pctg) { host = h; expiring = released = false; - check_id = c->getID(); - check_name = c->getName(); + check_id = _check_id; + check_name = _check_name; engage_time = time(NULL); release_time = 0; cli_pctg = _cli_pctg; @@ -36,6 +36,18 @@ HostAlert::HostAlert(HostCheck *c, Host *h, risk_percentage _cli_pctg) { /* **************************************************** */ +HostAlert::HostAlert(HostCheckID _check_id, std::string _check_name, Host *h, risk_percentage _cli_pctg) { + init(_check_id, _check_name, h, _cli_pctg); +} + +/* **************************************************** */ + +HostAlert::HostAlert(HostCheck *c, Host *h, risk_percentage _cli_pctg) { + init(c->getID(), c->getName(), h, _cli_pctg); +} + +/* **************************************************** */ + HostAlert::~HostAlert() { }