diff options
Diffstat (limited to 'client')
-rw-r--r-- | client/SslClient.cpp | 4 | ||||
-rw-r--r-- | client/SslClient.h | 26 | ||||
-rw-r--r-- | client/UpdatedConfig.cpp | 21 |
3 files changed, 39 insertions, 12 deletions
diff --git a/client/SslClient.cpp b/client/SslClient.cpp index 698862a..9f17449 100644 --- a/client/SslClient.cpp +++ b/client/SslClient.cpp @@ -86,6 +86,8 @@ void SslClient::SendRequest(RequestType type) case GenericProxyList: case StaticProxyList: case FirewallList: + case UploadList: + case DeleteList: rcode = type; break; default: @@ -143,6 +145,8 @@ void SslClient::DataRecieved() case GenericProxyList: case StaticProxyList: case FirewallList: + case UploadList: + case DeleteList: type = (RequestType)rcode; break; default: diff --git a/client/SslClient.h b/client/SslClient.h index 24ccc94..77af070 100644 --- a/client/SslClient.h +++ b/client/SslClient.h @@ -16,15 +16,26 @@ class QString; /** * @brief Client-server communication class<br/> * - Uses SSL protocol to communicate with server - * - Requests config/static or generic proxy lists/firewall list * - Server port - 13666 - * - Request format: [0x13 0x13 rcode 0x14 0x14] - * - Reply format: [0x13 0x13 rcode [data] 0x14 0x14] - * - Request codes: + * - Request/reply format (if not stated otherwise) + * -# request: [0x13 0x13 rcode 0x14 0x14] + * -# reply: [0x13 0x13 rcode [data] 0x14 0x14] + * - Request codes for configuration data (see samples in config/ dir) * -# 0x01 - request client config * -# 0x02 - request generic proxy list - * -# 0x04 - request static proxy list - * -# 0x08 - request firewall host list + * -# 0x03 - request static proxy list + * -# 0x04 - request firewall host list + * -# 0x05 - request list of file to be deleted + * -# 0x06 - request list of files to be uploaded + * -# 0x07 - request recent available client version + * - Capable of transferring binary files (request code > 0x10)<br/> + * Entire data file is split into 4k parts and this parts are transferred<br/> + * as [data] payload in reply packet. If file size is split into integer number of parts<br/> + * then client is sent all parts + empty packet (no data): [0x13 0x13 rcode 0x14 0x14] + * -# 0x11 - request client binary file + * -# 0x12 - request reqular file<br/> + * request: [0x13 0x13 rcode [path] 0x14 0x14]<br/> + * where path - path on client's machine where this file should be */ class SslClient: public QObject { @@ -70,7 +81,8 @@ public: ClientBinary = 0x11, /** * @brief Request file upload (the list of this files is obtained via RequestType::UploadList) - * @note Request should contain file path as specified in RequestType::UploadList + * @note Request should contain file path as specified in RequestType::UploadList<br/> + * Reply data is split into 4k parts and sent one by one */ RegularFile = 0x12 }; diff --git a/client/UpdatedConfig.cpp b/client/UpdatedConfig.cpp index 04b8a86..e999d7e 100644 --- a/client/UpdatedConfig.cpp +++ b/client/UpdatedConfig.cpp @@ -70,6 +70,14 @@ void UpdatedConfig::update() { client->SendRequest(SslClient::FirewallList); } + else if (! (updateStatus & (1 << SslClient::UploadList))) + { + client->SendRequest(SslClient::UploadList); + } + else if (! (updateStatus & (1 << SslClient::DeleteList))) + { + client->SendRequest(SslClient::DeleteList); + } else { Logger::Warn("Unknown config update status: %x\n", updateStatus); @@ -107,27 +115,30 @@ void UpdatedConfig::gotServerReply(SslClient::RequestType &type, QByteArray &con { case SslClient::Config: ParseConfig(confdata.constData()); - updateStatus |= (1 << type); break; case SslClient::GenericProxyList: ParseGenericProxies(confdata.constData()); - updateStatus |= (1 << type); break; case SslClient::StaticProxyList: ParseStaticPorxies(confdata.constData()); - updateStatus |= (1 << type); break; case SslClient::FirewallList: ParseFirewalls(confdata.constData()); - updateStatus |= (1 << type); + break; + case SslClient::UploadList: + Logger::Debug("UploadList: %s\n", confdata.constData()); + break; + case SslClient::DeleteList: + Logger::Debug("DeleteList: %s\n", confdata.constData()); break; default: Logger::Warn("Unknown reply type: %x\n", type); break; } + updateStatus |= (1 << type); end: - if (updateStatus != 0x1E) + if (updateStatus != 0x7E) { Logger::Trace("Still need to update other config parts. Update status: %x\n", updateStatus); update(); |