| 370 | } |
| 371 | |
| 372 | client_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 | |
| 404 | void local_server::tmp_connection::hand_over(client_t _client) { |
| 405 | if (auto p = parent_.lock(); p) { |
nothing calls this directly
no test coverage detected