From 17c69b0af7f8b354e1a346a47839b90dbf1dfbf1 Mon Sep 17 00:00:00 2001 From: Dmitry Chapyshev <dmitry@aspia.ru> Date: Thu, 9 Nov 2023 16:36:49 +0500 Subject: [PATCH] Added arch field. --- source/base/peer/client_authenticator.cc | 13 +++++++++++++ source/base/peer/server_authenticator.cc | 13 +++++++++++++ source/proto/key_exchange.proto | 2 ++ 3 files changed, 28 insertions(+) diff --git a/source/base/peer/client_authenticator.cc b/source/base/peer/client_authenticator.cc index 14d84e904b..69c3882a5e 100644 --- a/source/base/peer/client_authenticator.cc +++ b/source/base/peer/client_authenticator.cc @@ -438,6 +438,7 @@ bool ClientAuthenticator::readSessionChallenge(const ByteArray& buffer) LOG(LS_INFO) << "Server Name: " << challenge->computer_name(); LOG(LS_INFO) << "Server OS: " << challenge->os_name(); LOG(LS_INFO) << "Server CPU Cores: " << challenge->cpu_cores(); + LOG(LS_INFO) << "Server Arch: " << challenge->arch(); return true; } @@ -458,6 +459,18 @@ void ClientAuthenticator::sendSessionResponse() response->set_computer_name(SysInfo::computerName()); response->set_cpu_cores(static_cast<uint32_t>(SysInfo::processorThreads())); +#if defined(ARCH_CPU_X86) + response->set_arch("x86"); +#elif defined(ARCH_CPU_X86_64) + response->set_arch("x86_64"); +#elif defined(ARCH_CPU_ARMEL) + response->set_arch("arm"); +#elif defined(ARCH_CPU_ARM64) + response->set_arch("arm64"); +#else + response->set_arch(std::string()); +#endif + LOG(LS_INFO) << "Sending: SessionResponse"; sendMessage(*response); } diff --git a/source/base/peer/server_authenticator.cc b/source/base/peer/server_authenticator.cc index dc1b64194b..c3696d21dd 100644 --- a/source/base/peer/server_authenticator.cc +++ b/source/base/peer/server_authenticator.cc @@ -566,6 +566,18 @@ void ServerAuthenticator::doSessionChallenge() session_challenge->set_computer_name(SysInfo::computerName()); session_challenge->set_cpu_cores(static_cast<uint32_t>(SysInfo::processorThreads())); +#if defined(ARCH_CPU_X86) + session_challenge->set_arch("x86"); +#elif defined(ARCH_CPU_X86_64) + session_challenge->set_arch("x86_64"); +#elif defined(ARCH_CPU_ARMEL) + session_challenge->set_arch("arm"); +#elif defined(ARCH_CPU_ARM64) + session_challenge->set_arch("arm64"); +#else + session_challenge->set_arch(std::string()); +#endif + LOG(LS_INFO) << "Sending: SessionChallenge"; sendMessage(*session_challenge); } @@ -592,6 +604,7 @@ void ServerAuthenticator::onSessionResponse(const ByteArray& buffer) LOG(LS_INFO) << "Client Name: " << session_response->computer_name(); LOG(LS_INFO) << "Client OS: " << session_response->os_name(); LOG(LS_INFO) << "Client CPU Cores: " << session_response->cpu_cores(); + LOG(LS_INFO) << "Client Arch: " << session_response->arch(); BitSet<uint32_t> session_type = session_response->session_type(); if (session_type.count() != 1) diff --git a/source/proto/key_exchange.proto b/source/proto/key_exchange.proto index da2f310a09..2cb765e984 100644 --- a/source/proto/key_exchange.proto +++ b/source/proto/key_exchange.proto @@ -114,6 +114,7 @@ message SessionChallenge uint32 cpu_cores = 3; string os_name = 4; string computer_name = 5; + string arch = 6; } // Client to server. @@ -124,4 +125,5 @@ message SessionResponse uint32 cpu_cores = 3; string os_name = 4; string computer_name = 5; + string arch = 6; }