-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhttpsettingsresponder.cpp
More file actions
31 lines (26 loc) · 1.42 KB
/
Copy pathhttpsettingsresponder.cpp
File metadata and controls
31 lines (26 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "httpsettingsresponder.h"
HttpSettingsResponder::HttpSettingsResponder(QObject* parent, InvestigatorOrchestartor *investigatorPtr):
HttpRequestHandler(parent),
m_investigator(investigatorPtr) {
}
void HttpSettingsResponder::service(HttpRequest& request, HttpResponse& response) {
Q_UNUSED(request)
QJsonObject obj;
if(m_investigator) {
obj.insert("sourceDir", m_investigator->sourceDir());
obj.insert("processDir", m_investigator->processDir());
obj.insert("cleanDir", m_investigator->cleanDir());
obj.insert("infectedDir", m_investigator->infectedDir());
obj.insert("avsExecFileName", m_investigator->avsExecFileName());
obj.insert("currentWorkersNb", m_investigator->currentWorkersNb());
obj.insert("thresholdFilesNb", m_investigator->thresholdFilesNb());
obj.insert("thresholdFilesSize", m_investigator->thresholdFilesSize());
obj.insert("thresholdFilesSizeUnit", m_investigator->thresholdFilesSizeUnit());
obj.insert("syslogAddress", m_investigator->syslogAddress());
} else {
obj.insert("error", "ptr to investigator has been not defined");
}
QJsonDocument doc(obj);
response.setHeader("Content-Type", "application/json; charset=utf-8");
response.write(doc.toJson(QJsonDocument::Indented), true);
}