MCPcopy Create free account
hub / github.com/COVESA/vsomeip / read_config_command

Method read_config_command

implementation/endpoints/src/local_server.cpp:372–402  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

370}
371
372client_t local_server::tmp_connection::read_config_command(uint8_t const* _data, uint32_t _message_size, bool& _version_matches) {
373 std::vector<byte_t> its_data(_data, _data + _message_size);
374 protocol::config_command command;
375 protocol::error_e ec;
376
377 command.deserialize(its_data, ec);
378 if (ec != protocol::error_e::ERROR_OK) {
379 _version_matches = false;
380 VSOMEIP_ERROR_P << "Config command deserialization failed (" << static_cast<int>(ec) << ")";
381 return VSOMEIP_CLIENT_UNSET;
382 }
383 if (command.get_version() != protocol::IPC_VERSION) {
384 _version_matches = false;
385 VSOMEIP_ERROR_P << "Protocol version mismatch detected, expected: " << protocol::IPC_VERSION
386 << ", received: " << command.get_version();
387 return VSOMEIP_CLIENT_UNSET;
388 }
389 if (command.contains("expected_id")) {
390 auto str = command.at("expected_id");
391 if (str.size() == sizeof(expected_id_)) {
392 std::memcpy(&expected_id_, str.data(), sizeof(expected_id_));
393 }
394 }
395 if (!command.contains("hostname")) {
396 _version_matches = false;
397 VSOMEIP_ERROR_P << "Config command did not contain hostname";
398 return VSOMEIP_CLIENT_UNSET;
399 }
400 client_host_ = command.at("hostname");
401 return command.get_client();
402}
403
404void local_server::tmp_connection::hand_over(client_t _client) {
405 if (auto p = parent_.lock(); p) {

Callers

nothing calls this directly

Calls 6

deserializeMethod · 0.45
get_versionMethod · 0.45
containsMethod · 0.45
sizeMethod · 0.45
dataMethod · 0.45
get_clientMethod · 0.45

Tested by

no test coverage detected