summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--protocol/udm.proto49
-rw-r--r--server/include/api_module_downloader.h2
-rw-r--r--server/modules/downloaders/curl/main.cpp2
-rw-r--r--server/modules/downloaders/curl/main.h2
-rw-r--r--server/src/server_session.cpp6
5 files changed, 52 insertions, 9 deletions
diff --git a/protocol/udm.proto b/protocol/udm.proto
index 0825dc1..d15fdcf 100644
--- a/protocol/udm.proto
+++ b/protocol/udm.proto
@@ -94,11 +94,42 @@ message download_ui_unsubscription_info {
//dowloads proto part begin
-message client_download_request {
+message client_download_add_request {
+ repeated string_pair params = 1;
+}
+
+message client_download_start_request {
+ required int32 download_id = 1;
+}
+
+message client_download_stop_request {
+ required int32 download_id = 1;
+}
+
+message client_download_delete_request {
+ required int32 download_id = 1;
+ optional bool with_data = 2 [default = false];
+}
+
+message client_download_action_request {
+ required int32 download_id = 1;
+ required int32 action_id = 2;
+}
+
+message int_string_pair {
required int32 id = 1;
- optional bool with_content = 2 [default = false];
+ required string value = 2;
+}
+message client_downloads_request {
+ repeated int_string_pair params = 1;
}
+message client_download_request {
+ required int32 download_id = 1;
+ repeated int_string_pair params = 2;
+}
+
+
enum DOWNLOAD_CONTENT_ENTRY_TYPE {
DOWNLOAD_CONTENT_ENTRY_TYPE_FILE = 0;
DOWNLOAD_CONTENT_ENTRY_TYPE_DIRECTORY = 1;
@@ -201,7 +232,7 @@ enum SERVER_MODULE_TYPE {
message string_pair
{
required string name = 1;
- required string description = 2;
+ required string value = 2;
}
@@ -282,6 +313,12 @@ enum CLIENT_MSG_TYPE {
CLIENT_SUBSCRIPTIONS_REQUEST = 5;
CLIENT_UNSUBSCRIPTIONS_REQUEST = 6;
CLIENT_DOWNLOADS_LIST_REQUEST = 7;
+ CLIENT_DOWNLOAD_ADD = 8;
+ CLIENT_DOWNLOAD_START = 9;
+ CLIENT_DOWNLOAD_STOP = 10;
+ CLIENT_DOWNLOAD_DELETE = 11;
+ CLIENT_DOWNLOAD_EXECUTE_ACTION = 12;
+ CLIENT_DOWNLOAD_INFO_REQUEST = 13;
}
message client_msg {
@@ -292,6 +329,12 @@ message client_msg {
repeated client_event_subscription_request subscription_request = 5;
repeated client_event_unsubscription_request unsubscription_request = 6;
repeated client_download_request downloads_request = 7;
+ optional client_download_add_request download_add_request = 8;
+ optional client_download_start_request download_start_request = 9;
+ optional client_download_stop_request download_stop_request = 10;
+ optional client_download_delete_request download_delete_request = 11;
+ optional client_download_action_request download_action_request = 12;
+ optional client_downloads_request download_list_request = 13;
}
diff --git a/server/include/api_module_downloader.h b/server/include/api_module_downloader.h
index d980d62..dbe0d14 100644
--- a/server/include/api_module_downloader.h
+++ b/server/include/api_module_downloader.h
@@ -92,7 +92,7 @@ public:
virtual bool delete_download(int download_id, bool delete_data = false) = 0; //delete download by id received via add_download, if "delete_data" is set, also remove all downloaded data from storage, return true on success, false otherwise
virtual bool execute_action_on_download(int download_id, int action_id) = 0; //execute module defined action on download, by id received via add_download
virtual std::list<download_s> get_downloads(std::map<int, std::string> params = std::map<int, std::string>()) = 0; //this function must return list of downloads, additional options may be passed via params map
- virtual download_s get_download_info(int download_id, std::map<int, std::string> params = std::map<int, std::string>()) = 0; //same as above, except this one is for single download, not a complete list
+ virtual download_s get_download(int download_id, std::map<int, std::string> params = std::map<int, std::string>()) = 0; //same as above, except this one is for single download, not a complete list
protected:
downloader_module_info info;
};
diff --git a/server/modules/downloaders/curl/main.cpp b/server/modules/downloaders/curl/main.cpp
index 23c4591..b3a2f36 100644
--- a/server/modules/downloaders/curl/main.cpp
+++ b/server/modules/downloaders/curl/main.cpp
@@ -159,7 +159,7 @@ std::list<download_s> downloader::get_downloads(std::map<int, std::string> param
return l;
}
-download_s downloader::get_download_info(int download_id, std::map<int, std::string> params)
+download_s downloader::get_download(int download_id, std::map<int, std::string> params)
{
download_s d = downloads[download_id];
//TODO: fill additional data fields
diff --git a/server/modules/downloaders/curl/main.h b/server/modules/downloaders/curl/main.h
index d97e72e..12d427a 100644
--- a/server/modules/downloaders/curl/main.h
+++ b/server/modules/downloaders/curl/main.h
@@ -47,7 +47,7 @@ public:
bool delete_download(int download_id, bool delete_data = false); //delete download by id received via add_download, if "delete_data" is set, also remove all downloaded data from storage, return true on success, false otherwise
bool execute_action_on_download(int download_id, int action_id); //execute module defined action on download, by id received via add_download
std::list<download_s> get_downloads(std::map<int, std::string> params = std::map<int, std::string>()); //this function must return list of downloads, additional options may be passed via params map
- download_s get_download_info(int download_id, std::map<int, std::string> params = std::map<int, std::string>()); //same as above, except this one is for single download, not a complete list
+ download_s get_download(int download_id, std::map<int, std::string> params = std::map<int, std::string>()); //same as above, except this one is for single download, not a complete list
private:
void on_modules_loaded();
// downloader_module_info info;
diff --git a/server/src/server_session.cpp b/server/src/server_session.cpp
index 2b80e6a..c9b8e91 100644
--- a/server/src/server_session.cpp
+++ b/server/src/server_session.cpp
@@ -243,7 +243,6 @@ void server_session::handle_command(client_msg *msg)
break;
case CLIENT_MSG_TYPE::CLIENT_CORE_INFO_REQUEST:
{
- //TODO: settings values here
server_msg msg;
msg.set_type(SERVER_MSG_TYPE::SERVER_CORE_INFO_REPLY);
msg.mutable_server_core_info_reply()->set_version(1);
@@ -251,11 +250,12 @@ void server_session::handle_command(client_msg *msg)
for(auto it : runtime_config.config_file.get_child("server")) //load server node
{
std::string val = it.second.get_value<std::string>("empty_value"); //TODO: something better here. we need to avoid subtrees and empty vars
- if(val == "" || val == "empty_value")
+ if(/*val == "" ||*/ val == "empty_value")
continue;
setting *i = msg.mutable_server_core_info_reply()->add_settings();
i->set_name(it.first);
- //TODO: is it possible to set something better than just list of core setting names ?
+ i->set_value(val);
+ //TODO: is it possible to set something better than just list of core setting ?
}
}
catch(...)