10 #include "../framework/bridgetask.h"
11 #include "../json11/json11.hpp"
12 #include "../http/httphost.h"
13 #include "../http/cookiefile.h"
24 void sendToClient(
const std::string &method,
25 const std::string &jsonobj =
"{}") {
29 void sendTaskComplete(
const std::string &t,
const std::string &res =
"");
30 void sendTaskProgress(
const std::string &taskname,
31 double speed,
double progress);
32 void accumulateLog() {
35 void appendLog(
const std::string &str) {
36 accumulated_log <<
"\nAppend " << str.size() <<
"\n" << str;
38 void sendLogToServer();
40 std::string getDefaultConfig();
41 bool isValidHashkey(
const std::string &key);
42 void pollBridge(
const std::string &msg);
43 static bool isValidJson(
const std::string &s) {
45 auto obj = json11::Json::parse(s, err);
49 void handleMsgFromClient(
const std::string &method,
50 const json11::Json &args);
51 void handleConfigurationOption(
const std::string &name,
52 const std::string &value);
53 void uploadComplete();
55 void resetCurrentTest();
58 std::string current_ticket;
59 std::ostringstream accumulated_log;
66 enum class MeasurementState { IDLE, STARTED, FINISHED, ABORTED };
67 MeasurementState state = MeasurementState::IDLE;
72 std::string force_key;
78 std::string wserv_contentsurl =
"/api/content";
79 std::string wserv_measurementsurl =
"/api/measurements";
80 std::string wserv_settingsurl =
"/api/servers";
81 std::string settings_result;
84 std::map<std::string, std::string> report_template;
87 std::string options_filename;
Tasks may use a bridge to communicate with an application running outside the event loop.
Definition: bridgetask.h:43
virtual void sendMsgToClient(const std::string &msg)=0
The agent will call this to pass messages to the client.
Definition: cookiemanager.h:14
The host name and port number of a HTTP host.
Definition: httphost.h:17
static void setLogFile(std::ostream &stream)
Set global log destination.
Definition: logger.cpp:166
Definition: measurementagent.h:17
void handleExecution(Task *sender, const std::string &msg) override
Callback to execute code on behalf of another Task.
Definition: measurementagent.cpp:486
void taskMessage(Task *task) override
Definition: measurementagent.cpp:48
void taskFinished(Task *task) override
Definition: measurementagent.cpp:61
Definition: speedtest.h:16
Read configuration from file or string.
Definition: taskconfig.h:44
The purpose of a task is to manage socket connections, and/or to execute timers.
Definition: task.h:39