Skip to content

Commit

Permalink
Added arch field.
Browse files Browse the repository at this point in the history
  • Loading branch information
dchapyshev committed Nov 9, 2023
1 parent d2377c3 commit 17c69b0
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
13 changes: 13 additions & 0 deletions source/base/peer/client_authenticator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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);
}
Expand Down
13 changes: 13 additions & 0 deletions source/base/peer/server_authenticator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions source/proto/key_exchange.proto
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ message SessionChallenge
uint32 cpu_cores = 3;
string os_name = 4;
string computer_name = 5;
string arch = 6;
}

// Client to server.
Expand All @@ -124,4 +125,5 @@ message SessionResponse
uint32 cpu_cores = 3;
string os_name = 4;
string computer_name = 5;
string arch = 6;
}

0 comments on commit 17c69b0

Please sign in to comment.