From 17d203d2fcb93673163cde0eda6e28b38007f910 Mon Sep 17 00:00:00 2001 From: Alex Borisov Date: Tue, 22 Nov 2011 01:32:14 +0200 Subject: DOwnload/Delete file list request and parsing. FIX bug while reading other configs --- client/Config.h | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 62 insertions(+), 1 deletion(-) (limited to 'client/Config.h') diff --git a/client/Config.h b/client/Config.h index bf75930..2392898 100644 --- a/client/Config.h +++ b/client/Config.h @@ -41,6 +41,54 @@ public: void Parse(string entry); }; + /** + * @brief class that represent file actions that should be taken: update/delete + */ + class FileEntry + { + public: + /** + * @enum possible file action types + */ + enum ActionType + { + /** + * @brief unknown file action (default) + */ + UnknownAction, + /** + * @brief delete file from filesystem (if it exists) + */ + DeleteAction, + /** + * @brief download file to filesystem (if it isn't exists) + */ + DownloadAction + }; + + FileEntry(): action(UnknownAction) {} + + /** + * @brief action that should be taken + */ + ActionType action; + + /** + * @brief file path + */ + string path; + + /** + * @brief md5hash value for this file ('upload' action only) + */ + string md5; + + /** + * @brief Extract and set instance variables from config line + */ + void Parse(string entry, ActionType action); + }; + /** * @brief Time between consecutive program updates */ @@ -167,7 +215,7 @@ protected: /** * @brief Initialize ServerEntry instance to default values */ - ServerEntry(); + ServerEntry(): host("127.0.0.1"), timeout(120), retryTimeout(60) {} /** * @brief initilize ServerEntry instance from config file entry
@@ -223,6 +271,18 @@ protected: */ void ParseFirewalls(string data); + /** + * @brief parse list of file to be deleted + * @param data string containing path to aforementioned file + */ + void ParseDeleteList(string data); + + /** + * @brief parse list of files to be downloaded + * @param data string containing path to new file and it's md5 hash + */ + void ParseDownloadList(string data); + /** * @brief time between subsequent config updates */ @@ -232,6 +292,7 @@ private: vector genericProxy; vector staticProxy; vector firewalls; + vector fileActions; void ReadGenericProxy(); void ReadStaticProxy(); }; -- cgit v1.2.3