/usr/include/measurement_kit/ooni/orchestrate.hpp is in libmeasurement-kit-dev 0.7.1-2build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | // Part of measurement-kit <https://measurement-kit.github.io/>.
// Measurement-kit is free software. See AUTHORS and LICENSE for more
// information on the copying conditions.
#ifndef MEASUREMENT_KIT_OONI_ORCHESTRATE_HPP
#define MEASUREMENT_KIT_OONI_ORCHESTRATE_HPP
// Documentation: doc/api/ooni/orchestrate.md
#include <measurement_kit/common.hpp>
namespace mk {
namespace ooni {
namespace orchestrate {
/*
* URLs
*/
#define MK_OONI_PRODUCTION_PROTEUS_REGISTRY_URL \
"https://a.registry.proteus.ooni.io"
#define MK_OONI_TESTING_PROTEUS_REGISTRY_URL \
"https://registry.proteus.test.ooni.io"
#define MK_OONI_PRODUCTION_PROTEUS_EVENTS_URL "https://a.events.proteus.ooni.io"
#define MK_OONI_TESTING_PROTEUS_EVENTS_URL "https://events.proteus.test.ooni.io"
std::string production_registry_url();
std::string testing_registry_url();
std::string production_events_url();
std::string testing_events_url();
/*
* Registry database
*/
class Auth {
public:
std::string auth_token;
std::string expiry_time;
bool logged_in = false;
std::string username;
std::string password;
static std::string make_password();
Error load(const std::string &filepath) noexcept;
Error loads(const std::string &data) noexcept;
Error dump(const std::string &filepath) noexcept;
std::string dumps() noexcept;
bool is_valid(Var<Logger>) const noexcept;
};
class ClientMetadata {
public:
Var<Logger> logger = Logger::global();
Settings settings = {};
std::string available_bandwidth;
std::string device_token;
std::string events_url = production_events_url();
std::string language;
std::string network_type;
std::string geoip_country_path;
std::string geoip_asn_path;
std::string platform;
std::string probe_asn;
std::string probe_cc;
std::string probe_family;
std::string registry_url = production_registry_url();
std::string software_name = "measurement_kit";
std::string software_version = MK_VERSION;
std::vector<std::string> supported_tests;
nlohmann::json as_json() const;
};
class Task; /* Forward declaration */
class Client : public ClientMetadata {
public:
void register_probe(
std::string &&, Callback<Error &&, Auth &&> &&callback) const;
void find_location(
Callback<Error &&, std::string &&, std::string &&> &&callback) const;
void update(Auth &&, Callback<Error &&, Auth &&> &&callback) const;
void list_tasks(
Auth &&,
Callback<Error &&, Auth &&, std::vector<Task> &&> &&callback) const;
};
/*
* Events database
*/
class TaskData {
public:
std::string events_url = production_events_url();
std::string task_id;
};
class Task : public TaskData {
public:
void get(Auth &&,
Callback<Error &&, Auth &&, std::string &&> &&callback) const;
void accept(Auth &&, Callback<Error &&, Auth &&> &&callback) const;
void reject(Auth &&, Callback<Error &&, Auth &&> &&callback) const;
void done(Auth &&, Callback<Error &&, Auth &&> &&callback) const;
};
} // namespace orchestrate
} // namespace ooni
} // namespace mk
#endif
|