You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.0 KiB

#ifndef _TR_TEST_SESSION_CONTEXT_HPP_
#define _TR_TEST_SESSION_CONTEXT_HPP_
9 years ago
#include <TorrentContext.hpp>
#include <sstream>
#include <vector>
class TestSessionSettings {
public:
int download_rate_limit = 1;
int upload_rate_limit = 2;
int listen_interfaces = 3;
int enable_dht = 4;
bool enable_dht_ = true;
int download_rate_limit_ = 0;
int upload_rate_limit_ = 0;
std::string listen_interfaces_ = "0.0.0.0:0";
void set_bool(int type, int value);
void set_int(int type, int value);
void set_str(int type, std::string value);
int get_int(int type) const;
bool get_bool(int type);
std::string get_str(int type);
};
class TestSession {
public:
bool valid = false;
bool paused = false;
std::vector<TestTorrent> torrents;
TestSessionSettings settings_;
bool is_valid();
TestSessionSettings get_settings();
bool is_paused() const;
void pause();
void resume();
int listen_port();
bool is_dht_running() const;
9 years ago
std::vector<TestTorrent> &get_torrents();
void apply_settings(TestSessionSettings settings);
};
#endif