Rule management added.
[platform/core/security/suspicious-activity-monitor.git] / daemon / audithandler.cpp
1 #include <jsoncpp/json/value.h>
2 #include "audithandler.h"
3 #include "audit/rule_manager.h"
4
5 namespace
6 {
7 const std::string RULE_STATE_KEY{"state-rule"};
8 }
9
10 namespace agent
11 {
12
13 AuditHandler::AuditHandler(communication::Connection& conn) :
14     communication::EventListener(conn, RULE_STATE_KEY)
15 {
16 }
17
18
19 void AuditHandler::accept(communication::Event& event)
20 {
21     Json::Value rules;
22     rules["type"] = RULE_STATE_KEY;
23
24     rules["data"] = audit::RuleManager::GetInstance().getRulesAsJson();
25     connection.sendData(rules);
26     event.confirm();
27 }
28
29 } // namespace agent