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.
53 lines
1.1 KiB
53 lines
1.1 KiB
|
9 years ago
|
#include <sstream>
|
||
|
|
#include <vector>
|
||
|
|
|
||
|
|
class TestTorrent {};
|
||
|
|
|
||
|
|
class TestRequest {
|
||
|
|
public:
|
||
|
|
std::stringstream content;
|
||
|
|
};
|
||
|
|
|
||
|
|
class TestResponse : public std::stringstream {
|
||
|
|
public:
|
||
|
|
std::string buffer;
|
||
|
|
std::string string();
|
||
|
|
std::string message();
|
||
|
|
std::string code();
|
||
|
|
};
|
||
|
|
|
||
|
|
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 TestTorrentSession {
|
||
|
|
public:
|
||
|
|
bool valid = false;
|
||
|
|
bool paused = false;
|
||
|
|
TestSessionSettings settings_;
|
||
|
|
bool is_valid();
|
||
|
|
TestSessionSettings get_settings();
|
||
|
|
bool is_paused() const;
|
||
|
|
void pause();
|
||
|
|
void resume();
|
||
|
|
int listen_port();
|
||
|
|
bool is_dht_running() const;
|
||
|
|
std::vector<TestTorrent> get_torrents() const;
|
||
|
|
void apply_settings(TestSessionSettings settings);
|
||
|
|
};
|