diff --git a/examples/request-sample.cpp b/examples/request-sample.cpp index dfebe6fb7..7a7bf4533 100644 --- a/examples/request-sample.cpp +++ b/examples/request-sample.cpp @@ -108,7 +108,7 @@ class client_sample { void on_availability(vsomeip::service_t _service, vsomeip::instance_t _instance, bool _is_available) { std::cout << "Service [" - << std::setw(4) << std::setfill('0') << std::hex << _service << "." << _instance + << std::hex << std::setfill('0') << std::setw(4) << _service << "." << _instance << "] is " << (_is_available ? "available." : "NOT available.") << std::endl; @@ -125,7 +125,7 @@ class client_sample { void on_message(const std::shared_ptr< vsomeip::message > &_response) { std::cout << "Received a response from Service [" - << std::setfill('0') << std::hex + << std::hex << std::setfill('0') << std::setw(4) << _response->get_service() << "." << std::setw(4) << _response->get_instance() @@ -156,7 +156,7 @@ class client_sample { if (is_available_) { app_->send(request_); std::cout << "Client/Session [" - << std::setfill('0') << std::hex + << std::hex << std::setfill('0') << std::setw(4) << request_->get_client() << "/" << std::setw(4) << request_->get_session() diff --git a/examples/response-sample.cpp b/examples/response-sample.cpp index 35b45b74b..aad5e167a 100644 --- a/examples/response-sample.cpp +++ b/examples/response-sample.cpp @@ -96,7 +96,7 @@ class service_sample { void on_message(const std::shared_ptr &_request) { std::cout << "Received a message with Client/Session [" - << std::setfill('0') << std::hex + << std::hex << std::setfill('0') << std::setw(4) << _request->get_client() << "/" << std::setw(4) << _request->get_session() << "]" << std::endl; diff --git a/examples/subscribe-sample.cpp b/examples/subscribe-sample.cpp index 11f0e1489..04e906168 100644 --- a/examples/subscribe-sample.cpp +++ b/examples/subscribe-sample.cpp @@ -80,7 +80,7 @@ class client_sample { void on_availability(vsomeip::service_t _service, vsomeip::instance_t _instance, bool _is_available) { std::cout << "Service [" - << std::setw(4) << std::setfill('0') << std::hex << _service << "." << _instance + << std::hex << std::setfill('0') << std::setw(4) << _service << "." << _instance << "] is " << (_is_available ? "available." : "NOT available.") << std::endl; @@ -89,7 +89,7 @@ class client_sample { void on_message(const std::shared_ptr &_response) { std::stringstream its_message; its_message << "Received a notification for Event [" - << std::setfill('0') << std::hex + << std::hex << std::setfill('0') << std::setw(4) << _response->get_service() << "." << std::setw(4) << _response->get_instance() << "." << std::setw(4) << _response->get_method() << "] to Client/Session [" @@ -99,9 +99,9 @@ class client_sample { std::shared_ptr its_payload = _response->get_payload(); its_message << "(" << std::dec << its_payload->get_length() << ") " - << std::hex << std::setw(2); + << std::hex; for (uint32_t i = 0; i < its_payload->get_length(); ++i) - its_message << std::setw(2) << (int) its_payload->get_data()[i] << " "; + its_message << std::setw(2) << static_cast(its_payload->get_data()[i]) << " "; std::cout << its_message.str() << std::endl; if (_response->get_client() == 0) { diff --git a/implementation/configuration/src/configuration_impl.cpp b/implementation/configuration/src/configuration_impl.cpp index 4e8215100..5dd9b4ab1 100644 --- a/implementation/configuration/src/configuration_impl.cpp +++ b/implementation/configuration/src/configuration_impl.cpp @@ -433,7 +433,7 @@ bool configuration_impl::remote_offer_info_add(service_t _service, auto found_instance = found_service->second.find(its_service->instance_); if (found_instance != found_service->second.end()) { VSOMEIP_INFO << "Updating remote configuration for service [" - << std::hex << std::setw(4) << std::setfill('0') + << std::hex << std::setfill('0') << std::setw(4) << its_service->service_ << "." << its_service->instance_ << "]"; if (_reliable) { found_instance->second->reliable_ = its_service->reliable_; @@ -478,7 +478,7 @@ bool configuration_impl::remote_offer_info_remove(service_t _service, auto found_instance = found_service->second.find(_instance); if (found_instance != found_service->second.end()) { VSOMEIP_INFO << "Removing remote configuration for service [" - << std::hex << std::setw(4) << std::setfill('0') + << std::hex << std::setfill('0') << std::setw(4) << _service << "." << _instance << "]"; if (_reliable) { found_instance->second->reliable_ = ILLEGAL_PORT; @@ -4490,7 +4490,7 @@ void configuration_impl::load_someip_tp_for_service( << std::setw(4) << its_method << "]:" << " using (" << std::dec << its_entry->second.first << ", " - << std::dec << its_entry->second.second << ")"; + << its_entry->second.second << ")"; } } } else { diff --git a/implementation/e2e_protection/src/buffer/buffer.cpp b/implementation/e2e_protection/src/buffer/buffer.cpp index 6d82622bf..f4646131c 100644 --- a/implementation/e2e_protection/src/buffer/buffer.cpp +++ b/implementation/e2e_protection/src/buffer/buffer.cpp @@ -13,7 +13,7 @@ std::ostream &operator<<(std::ostream &_os, const e2e_buffer &_buffer) { if (isupper(b)) { _os << b; } else { - _os << "[" << std::setfill('0') << std::setw(2) << std::hex << (uint32_t)b << std::dec << "]"; + _os << "[" << std::hex << std::setfill('0') << std::setw(2) << (uint32_t)b << std::dec << "]"; } } return _os; diff --git a/implementation/endpoints/src/client_endpoint_impl.cpp b/implementation/endpoints/src/client_endpoint_impl.cpp index fe91ca949..ec5548199 100644 --- a/implementation/endpoints/src/client_endpoint_impl.cpp +++ b/implementation/endpoints/src/client_endpoint_impl.cpp @@ -177,7 +177,7 @@ bool client_endpoint_impl::send(const uint8_t *_data, uint32_t _size) std::stringstream msg; msg << "cei::send: "; for (uint32_t i = 0; i < _size; i++) - msg << std::hex << std::setw(2) << std::setfill('0') << (int)_data[i] << " "; + msg << std::hex << std::setfill('0') << std::setw(2) << static_cast(_data[i]) << " "; VSOMEIP_DEBUG << msg.str(); #endif @@ -565,10 +565,11 @@ void client_endpoint_impl::send_cbk( << _error.value() << ") " << get_remote_information() << " " << std::dec << queue_.size() << " " << std::dec << queue_size_ << " (" - << std::hex << std::setw(4) << std::setfill('0') << its_client <<"): [" - << std::hex << std::setw(4) << std::setfill('0') << its_service << "." - << std::hex << std::setw(4) << std::setfill('0') << its_method << "." - << std::hex << std::setw(4) << std::setfill('0') << its_session << "]" + << std::hex << std::setfill('0') + << std::setw(4) << its_client << "): [" + << std::setw(4) << its_service << "." + << std::setw(4) << its_method << "." + << std::setw(4) << its_session << "]" << " endpoint > " << this << " socket state > " << static_cast(state_.load()); } } @@ -622,12 +623,13 @@ void client_endpoint_impl::send_cbk( VSOMEIP_WARNING << "cei::send_cbk received error: " << _error.message() << " (" << std::dec << _error.value() << ") " << get_remote_information() << " " - << " " << std::dec << queue_.size() - << " " << std::dec << queue_size_ << " (" - << std::hex << std::setw(4) << std::setfill('0') << its_client <<"): [" - << std::hex << std::setw(4) << std::setfill('0') << its_service << "." - << std::hex << std::setw(4) << std::setfill('0') << its_method << "." - << std::hex << std::setw(4) << std::setfill('0') << its_session << "]" + << " " << queue_.size() + << " " << queue_size_ << " (" + << std::hex << std::setfill('0') + << std::setw(4) << its_client << "): [" + << std::setw(4) << its_service << "." + << std::setw(4) << its_method << "." + << std::setw(4) << its_session << "]" << " endpoint > " << this << " socket state > " << static_cast(state_.load()); print_status(); } @@ -801,12 +803,13 @@ bool client_endpoint_impl::check_queue_limit(const uint8_t *_data, std VSOMEIP_ERROR << "cei::check_queue_limit: queue size limit (" << std::dec << endpoint_impl::queue_limit_ << ") reached. Dropping message (" - << std::hex << std::setw(4) << std::setfill('0') << its_client <<"): [" - << std::hex << std::setw(4) << std::setfill('0') << its_service << "." - << std::hex << std::setw(4) << std::setfill('0') << its_method << "." - << std::hex << std::setw(4) << std::setfill('0') << its_session << "] " + << std::hex << std::setfill('0') + << std::setw(4) << its_client << "): [" + << std::setw(4) << its_service << "." + << std::setw(4) << its_method << "." + << std::setw(4) << its_session << "] " << "queue_size: " << std::dec << queue_size_ - << " data size: " << std::dec << _size; + << " data size: " << _size; return false; } return true; diff --git a/implementation/endpoints/src/endpoint_manager_base.cpp b/implementation/endpoints/src/endpoint_manager_base.cpp index f13b41839..761fad288 100644 --- a/implementation/endpoints/src/endpoint_manager_base.cpp +++ b/implementation/endpoints/src/endpoint_manager_base.cpp @@ -115,12 +115,12 @@ std::shared_ptr endpoint_manager_base::create_local_server( its_local_server = its_tmp; } else { VSOMEIP_ERROR << "Local UDS server endpoint initialization failed. Client " - << std::hex << std::setw(4) << std::setfill('0') << its_client + << std::hex << std::setfill('0') << std::setw(4) << its_client << " Path: " << its_path.str() << " Reason: " << its_error.message(); } } else { VSOMEIP_ERROR << "Local UDS server endpoint creation failed. Client " - << std::hex << std::setw(4) << std::setfill('0') << its_client + << std::hex << std::setfill('0') << std::setw(4) << its_client << " Path: " << its_path.str() << " Reason: out_of_memory"; } } catch (const std::exception& e) { @@ -178,12 +178,12 @@ std::shared_ptr endpoint_manager_base::create_local_server( rm_->add_guest(its_client, its_address, its_port); } else { VSOMEIP_ERROR << __func__ << ": Local TCP server endpoint initialization failed. " - << "Client " << std::hex << std::setw(4) << std::setfill('0') << its_client + << "Client " << std::hex << std::setfill('0') << std::setw(4) << its_client << " Reason: No local port available!"; } } else { VSOMEIP_ERROR << __func__ << ": Local TCP server endpoint creation failed. " - << "Client " << std::hex << std::setw(4) << std::setfill('0') << its_client + << "Client " << std::hex << std::setfill('0') << std::setw(4) << its_client << " Reason: No local port available!"; } } catch (const std::exception& e) { @@ -314,11 +314,11 @@ endpoint_manager_base::create_local_unlocked(client_t _client) { io_, configuration_); VSOMEIP_INFO << "Client [" - << std::hex << std::setw(4) << std::setfill('0') << rm_->get_client() + << std::hex << std::setfill('0') << std::setw(4) << rm_->get_client() << "] @ " << its_local_address.to_string() << ":" << std::dec << local_port_ << " is connecting to [" - << std::hex << std::setw(4) << std::setfill('0') << _client << "] @ " + << std::hex << std::setfill('0') << std::setw(4) << _client << "] @ " << its_remote_address.to_string() << ":" << std::dec << its_remote_port << " endpoint > " << its_endpoint; @@ -327,7 +327,7 @@ endpoint_manager_base::create_local_unlocked(client_t _client) { } else { VSOMEIP_ERROR << __func__ << ": Cannot get guest address of client [" - << std::hex << std::setw(4) << std::setfill('0') + << std::hex << std::setfill('0') << std::setw(4) << _client << "]"; } } diff --git a/implementation/endpoints/src/endpoint_manager_impl.cpp b/implementation/endpoints/src/endpoint_manager_impl.cpp index 4b2bf17a8..4678a66e1 100644 --- a/implementation/endpoints/src/endpoint_manager_impl.cpp +++ b/implementation/endpoints/src/endpoint_manager_impl.cpp @@ -645,10 +645,10 @@ bool endpoint_manager_impl::create_routing_root(std::shared_ptr& _root if (configuration_->is_security_enabled() && get_client() != its_routing_host_id) { VSOMEIP_ERROR << "endpoint_manager_impl::" << __func__ << ": " << "Client [" - << std::hex << std::setw(4) << std::setfill('0') + << std::hex << std::setfill('0') << std::setw(4) << get_client() << "] does not match the configured routing manager client identifier [" - << std::hex << std::setw(4) << std::setfill('0') + << std::hex << std::setfill('0') << std::setw(4) << its_routing_host_id << "]"; @@ -679,7 +679,7 @@ bool endpoint_manager_impl::create_routing_root(std::shared_ptr& _root its_root->init(its_endpoint, its_socket, its_error); if (its_error) { VSOMEIP_ERROR << "Routing endpoint creation failed. Client ID: " - << std::hex << std::setw(4) << std::setfill('0') + << std::hex << std::setfill('0') << std::setw(4) << VSOMEIP_ROUTING_CLIENT << ": " << its_error.message(); its_root->deinit(); @@ -711,7 +711,7 @@ bool endpoint_manager_impl::create_routing_root(std::shared_ptr& _root its_root->init(its_endpoint, its_error); if (its_error) { VSOMEIP_ERROR << "Local routing endpoint creation failed. Client ID: " - << std::hex << std::setw(4) << std::setfill('0') + << std::hex << std::setfill('0') << std::setw(4) << VSOMEIP_ROUTING_CLIENT << ": " << its_error.message(); its_root->deinit(); @@ -741,7 +741,7 @@ bool endpoint_manager_impl::create_routing_root(std::shared_ptr& _root its_root->init(its_endpoint, its_error); if (its_error) { VSOMEIP_ERROR << "Local routing endpoint creation failed. Client ID: " - << std::hex << std::setw(4) << std::setfill('0') + << std::hex << std::setfill('0') << std::setw(4) << VSOMEIP_ROUTING_CLIENT << ": " << its_error.message(); its_root->deinit(); return false; @@ -775,7 +775,7 @@ bool endpoint_manager_impl::create_routing_root(std::shared_ptr& _root if (its_error) { VSOMEIP_ERROR << "endpoint_manager_impl::create_routing_root: " << "Remote routing root endpoint creation failed (" << its_retry << ") " - << "Client: " << std::hex << std::setw(4) << std::setfill('0') + << "Client: " << std::hex << std::setfill('0') << std::setw(4) << VSOMEIP_ROUTING_CLIENT << ": " << its_error.message(); its_root->deinit(); @@ -1271,7 +1271,7 @@ endpoint_manager_impl::log_client_states() const { size_t its_max(std::min(size_t(5), its_client_queue_sizes.size())); for (size_t i = 0; i < its_max; i++) { - its_log << std::hex << std::setw(4) << std::setfill('0') + its_log << std::hex << std::setfill('0') << std::setw(4) << std::get<0>(its_client_queue_sizes[i].first).to_string() << ":" << std::dec << std::get<1>(its_client_queue_sizes[i].first) << "(" << (std::get<2>(its_client_queue_sizes[i].first) ? "tcp" : "udp") << "):" diff --git a/implementation/endpoints/src/local_tcp_client_endpoint_impl.cpp b/implementation/endpoints/src/local_tcp_client_endpoint_impl.cpp index b4f00dc55..b4c1801ea 100644 --- a/implementation/endpoints/src/local_tcp_client_endpoint_impl.cpp +++ b/implementation/endpoints/src/local_tcp_client_endpoint_impl.cpp @@ -223,8 +223,8 @@ bool local_tcp_client_endpoint_impl::send(const uint8_t *_data, uint32_t _size) std::stringstream msg; msg << "lce::send: "; for (uint32_t i = 0; i < _size; i++) - msg << std::hex << std::setw(2) << std::setfill('0') - << (int)_data[i] << " "; + msg << std::hex << std::setfill('0') << std::setw(2) + << static_cast(_data[i]) << " "; VSOMEIP_INFO << msg.str(); #endif train_->buffer_->insert(train_->buffer_->end(), _data, _data + _size); @@ -310,8 +310,8 @@ void local_tcp_client_endpoint_impl::receive_cbk( std::stringstream msg; msg << "lce<" << this << ">::recv: "; for (std::size_t i = 0; i < recv_buffer_.size(); i++) - msg << std::setw(2) << std::setfill('0') << std::hex - << (int)recv_buffer_[i] << " "; + msg << std::hex << std::setfill('0') << std::setw(2) + << static_cast(recv_buffer_[i]) << " "; VSOMEIP_INFO << msg.str(); #endif diff --git a/implementation/endpoints/src/local_tcp_server_endpoint_impl.cpp b/implementation/endpoints/src/local_tcp_server_endpoint_impl.cpp index 3f0ce28d8..bd9ec7ab2 100644 --- a/implementation/endpoints/src/local_tcp_server_endpoint_impl.cpp +++ b/implementation/endpoints/src/local_tcp_server_endpoint_impl.cpp @@ -137,7 +137,7 @@ bool local_tcp_server_endpoint_impl::send(const uint8_t *_data, uint32_t _size) std::stringstream msg; msg << "lse(" << get_local_port() << ")::send "; for (uint32_t i = 0; i < _size; i++) - msg << std::setw(2) << std::setfill('0') << std::hex << (int)_data[i] << " "; + msg << std::hex << std::setfill('0') << std::setw(2) << static_cast(_data[i]) << " "; VSOMEIP_INFO << msg.str(); #endif std::lock_guard its_lock(mutex_); @@ -424,8 +424,8 @@ void local_tcp_server_endpoint_impl::connection::send_queued( std::stringstream msg; msg << "ltsei::sq: "; for (std::size_t i = 0; i < _buffer->size(); i++) - msg << std::setw(2) << std::setfill('0') << std::hex - << (int)(*_buffer)[i] << " "; + msg << std::hex << std::setfill('0') << std::setw(2) + << static_cast((*_buffer)[i]) << " "; VSOMEIP_INFO << msg.str(); #endif @@ -525,8 +525,8 @@ void local_tcp_server_endpoint_impl::connection::receive_cbk( std::stringstream msg; msg << "lse::c<" << this << ">rcb: "; for (std::size_t i = 0; i < _bytes + recv_buffer_size_; i++) - msg << std::setw(2) << std::setfill('0') << std::hex - << (int) (recv_buffer_[i]) << " "; + msg << std::hex << std::setfill('0') << std::setw(2) + << static_cast (recv_buffer_[i]) << " "; VSOMEIP_INFO << msg.str(); #endif @@ -624,11 +624,11 @@ void local_tcp_server_endpoint_impl::connection::receive_cbk( protocol::COMMAND_HEADER_SIZE + protocol::TAG_SIZE - recv_buffer_size_); } else { std::stringstream local_msg; - local_msg << std::setfill('0') << std::hex; + local_msg << std::hex << std::setfill('0'); for (std::size_t i = its_iteration_gap; i < recv_buffer_size_ + its_iteration_gap && i - its_iteration_gap < 32; i++) { - local_msg << std::setw(2) << (int) recv_buffer_[i] << " "; + local_msg << std::setw(2) << static_cast(recv_buffer_[i])<< " "; } VSOMEIP_ERROR << "ltsei::c<" << this << ">rcb: recv_buffer_size is: " << std::dec @@ -681,7 +681,7 @@ void local_tcp_server_endpoint_impl::connection::receive_cbk( its_address, its_port); } else { VSOMEIP_WARNING << std::hex << "Client 0x" << its_host->get_client() - << " endpoint encountered an error[" << ec.value() << "]: " + << " endpoint encountered an error[" << ec.value() << "]: " << ec.message() << " endpoint > " << this; } } else { @@ -693,8 +693,8 @@ void local_tcp_server_endpoint_impl::connection::receive_cbk( std::stringstream local_msg; local_msg << "lse::c<" << this << ">rcb::thunk: "; for (std::size_t i = its_start; i < its_end; i++) - local_msg << std::setw(2) << std::setfill('0') << std::hex - << (int) recv_buffer_[i] << " "; + local_msg << std::hex << std::setfill('0') << std::setw(2) + << static_cast(recv_buffer_[i]) << " "; VSOMEIP_INFO << local_msg.str(); #endif calculate_shrink_count(); @@ -798,15 +798,15 @@ void local_tcp_server_endpoint_impl::connection::handle_recv_buffer_exception( its_message << "local_tcp_server_endpoint_impl::connection catched exception" << _e.what() << " local: " << get_path_local() << " remote: " << get_path_remote() << " shutting down connection. Start of buffer: " - << std::setfill('0') << std::hex; + << std::hex << std::setfill('0'); for (std::size_t i = 0; i < recv_buffer_size_ && i < 16; i++) { - its_message << std::setw(2) << (int) (recv_buffer_[i]) << " "; + its_message << std::setw(2) << static_cast (recv_buffer_[i]) << " "; } its_message << " Last 16 Bytes captured: "; for (int i = 15; recv_buffer_size_ > 15u && i >= 0; i--) { - its_message << std::setw(2) << (int) (recv_buffer_[static_cast(i)]) << " "; + its_message << std::setw(2) << static_cast(recv_buffer_[static_cast(i)]) << " "; } VSOMEIP_ERROR << its_message.str(); recv_buffer_.clear(); diff --git a/implementation/endpoints/src/local_uds_client_endpoint_impl.cpp b/implementation/endpoints/src/local_uds_client_endpoint_impl.cpp index deca6d850..1692e1084 100644 --- a/implementation/endpoints/src/local_uds_client_endpoint_impl.cpp +++ b/implementation/endpoints/src/local_uds_client_endpoint_impl.cpp @@ -201,8 +201,8 @@ bool local_uds_client_endpoint_impl::send(const uint8_t *_data, uint32_t _size) std::stringstream msg; msg << "lce::send: "; for (uint32_t i = 0; i < _size; i++) - msg << std::hex << std::setw(2) << std::setfill('0') - << (int)_data[i] << " "; + msg << std::hex << std::setfill('0') << std::setw(2) + << static_cast(_data[i]) << " "; VSOMEIP_INFO << msg.str(); #endif train_->buffer_->insert(train_->buffer_->end(), _data, _data + _size); @@ -287,8 +287,8 @@ void local_uds_client_endpoint_impl::receive_cbk( std::stringstream msg; msg << "lce<" << this << ">::recv: "; for (std::size_t i = 0; i < recv_buffer_.size(); i++) - msg << std::setw(2) << std::setfill('0') << std::hex - << (int)recv_buffer_[i] << " "; + msg << std::hex << std::setfill('0') << std::setw(2) + << static_cast(recv_buffer_[i]) << " "; VSOMEIP_INFO << msg.str(); #endif diff --git a/implementation/endpoints/src/local_uds_server_endpoint_impl.cpp b/implementation/endpoints/src/local_uds_server_endpoint_impl.cpp index 0b552b455..2717a6869 100644 --- a/implementation/endpoints/src/local_uds_server_endpoint_impl.cpp +++ b/implementation/endpoints/src/local_uds_server_endpoint_impl.cpp @@ -150,7 +150,7 @@ bool local_uds_server_endpoint_impl::send(const uint8_t *_data, uint32_t _size) std::stringstream msg; msg << "lse::send "; for (uint32_t i = 0; i < _size; i++) - msg << std::setw(2) << std::setfill('0') << std::hex << (int)_data[i] << " "; + msg << std::hex << std::setfill('0') << std::setw(2) << static_cast(_data[i] << " "; VSOMEIP_INFO << msg.str(); #endif std::lock_guard its_lock(mutex_); @@ -514,8 +514,8 @@ void local_uds_server_endpoint_impl::connection::send_queued( std::stringstream msg; msg << "lse::sq: "; for (std::size_t i = 0; i < _buffer->size(); i++) - msg << std::setw(2) << std::setfill('0') << std::hex - << (int)(*_buffer)[i] << " "; + msg << std::hex << std::setfill('0') << std::setw(2) + << static_cast((*_buffer)[i] << " "; VSOMEIP_INFO << msg.str(); #endif @@ -616,8 +616,8 @@ void local_uds_server_endpoint_impl::connection::receive_cbk( std::stringstream msg; msg << "lse::c<" << this << ">rcb: "; for (std::size_t i = 0; i < _bytes + recv_buffer_size_; i++) - msg << std::setw(2) << std::setfill('0') << std::hex - << (int) (recv_buffer_[i]) << " "; + msg << std::hex << std::setfill('0') << std::setw(2) + << static_cast (recv_buffer_[i]) << " "; VSOMEIP_INFO << msg.str(); #endif @@ -710,11 +710,11 @@ void local_uds_server_endpoint_impl::connection::receive_cbk( protocol::COMMAND_HEADER_SIZE + protocol::TAG_SIZE - recv_buffer_size_); } else { std::stringstream local_msg; - local_msg << std::setfill('0') << std::hex; + local_msg << std::hex << std::setfill('0'); for (std::size_t i = its_iteration_gap; i < recv_buffer_size_ + its_iteration_gap && i - its_iteration_gap < 32; i++) { - local_msg << std::setw(2) << (int) recv_buffer_[i] << " "; + local_msg << std::setw(2) << static_cast (recv_buffer_[i]) << " "; } VSOMEIP_ERROR << "lse::c<" << this << ">rcb: recv_buffer_size is: " << std::dec @@ -796,8 +796,8 @@ void local_uds_server_endpoint_impl::connection::receive_cbk( std::stringstream local_msg; local_msg << "lse::c<" << this << ">rcb::thunk: "; for (std::size_t i = its_start; i < its_end; i++) - local_msg << std::setw(2) << std::setfill('0') << std::hex - << (int) recv_buffer_[i] << " "; + local_msg << std::hex << std::setfill('0') << std::setw(2) + << static_cast( recv_buffer_[i] << " "; VSOMEIP_INFO << local_msg.str(); #endif calculate_shrink_count(); @@ -905,15 +905,15 @@ void local_uds_server_endpoint_impl::connection::handle_recv_buffer_exception( its_message << "local_uds_server_endpoint_impl::connection catched exception" << _e.what() << " local: " << get_path_local() << " remote: " << get_path_remote() << " shutting down connection. Start of buffer: " - << std::setfill('0') << std::hex; + << std::hex << std::setfill('0'); for (std::size_t i = 0; i < recv_buffer_size_ && i < 16; i++) { - its_message << std::setw(2) << (int) (recv_buffer_[i]) << " "; + its_message << std::setw(2) << static_cast (recv_buffer_[i]) << " "; } its_message << " Last 16 Bytes captured: "; for (int i = 15; recv_buffer_size_ > 15u && i >= 0; i--) { - its_message << std::setw(2) << (int) (recv_buffer_[static_cast(i)]) << " "; + its_message << std::setw(2) << static_cast(recv_buffer_[static_cast(i)]) << " "; } VSOMEIP_ERROR << its_message.str(); recv_buffer_.clear(); diff --git a/implementation/endpoints/src/server_endpoint_impl.cpp b/implementation/endpoints/src/server_endpoint_impl.cpp index 97f43d49b..4d1c6a918 100644 --- a/implementation/endpoints/src/server_endpoint_impl.cpp +++ b/implementation/endpoints/src/server_endpoint_impl.cpp @@ -152,7 +152,7 @@ templatebool server_endpoint_impl::send(const uint8 std::stringstream msg; msg << "sei::send "; for (uint32_t i = 0; i < _size; i++) - msg << std::hex << std::setw(2) << std::setfill('0') << (int)_data[i] << " "; + msg << std::hex << std::setfill('0') << std::setw(2) << static_cast(_data[i]) << " "; VSOMEIP_INFO << msg.str(); #endif endpoint_type its_target; @@ -254,7 +254,7 @@ bool server_endpoint_impl::send_intern( std::stringstream msg; msg << "sei::send_intern: "; for (uint32_t i = 0; i < _size; i++) - msg << std::hex << std::setw(2) << std::setfill('0') << (int)_data[i] << " "; + msg << std::hex << std::setfill('0') << std::setw(2) << static_cast(_data[i]) << " "; VSOMEIP_DEBUG << msg.str(); #endif // STEP 1: Check queue limit @@ -715,10 +715,11 @@ void server_endpoint_impl::send_cbk(const endpoint_type _key, parse_message_ids(its_buffer, its_service, its_method, its_client, its_session); VSOMEIP_WARNING << __func__ << ": prevented queue_size underflow. queue_size: " << its_data.queue_size_ << " payload_size: " << payload_size << " payload: (" - << std::hex << std::setw(4) << std::setfill('0') << its_client <<"): [" - << std::hex << std::setw(4) << std::setfill('0') << its_service << "." - << std::hex << std::setw(4) << std::setfill('0') << its_method << "." - << std::hex << std::setw(4) << std::setfill('0') << its_session << "]"; + << std::hex << std::setfill('0') + << std::setw(4) << its_client <<"): [" + << std::setw(4) << its_service << "." + << std::setw(4) << its_method << "." + << std::setw(4) << its_session << "]"; its_data.queue_.pop_front(); recalculate_queue_size(its_data); } @@ -748,7 +749,7 @@ void server_endpoint_impl::send_cbk(const endpoint_type _key, VSOMEIP_WARNING << "sei::send_cbk received error: " << _error.message() << " (" << std::dec << _error.value() << ") " << get_remote_information(it) << " " - << std::dec << its_data.queue_.size() << " " + << its_data.queue_.size() << " " << its_data.queue_size_ << " (" << std::hex << std::setfill('0') << std::setw(4) << its_client << "): [" @@ -788,7 +789,7 @@ void server_endpoint_impl::remove_stop_handler(service_t _service) { std::lock_guard its_lock{mutex_}; for (const auto &its_service : prepare_stop_handlers_) - its_services_log << std::hex << std::setw(4) << std::setfill('0') << its_service.first << ' '; + its_services_log << std::hex << std::setfill('0') << std::setw(4) << its_service.first << ' '; VSOMEIP_INFO << its_services_log.str(); prepare_stop_handlers_.erase(_service); diff --git a/implementation/endpoints/src/tcp_client_endpoint_impl.cpp b/implementation/endpoints/src/tcp_client_endpoint_impl.cpp index 124c78b70..d30ba76e4 100644 --- a/implementation/endpoints/src/tcp_client_endpoint_impl.cpp +++ b/implementation/endpoints/src/tcp_client_endpoint_impl.cpp @@ -349,8 +349,8 @@ void tcp_client_endpoint_impl::send_queued(std::pair::sq: "; for (std::size_t i = 0; i < _buffer->size(); i++) - msg << std::hex << std::setw(2) << std::setfill('0') - << (int)(*_entry.first)[i] << " "; + msg << std::hex << std::setfill('0') << std::setw(2) + << static_cast((*_entry.first)[i] << " "; VSOMEIP_INFO << msg.str(); #endif { @@ -542,8 +542,8 @@ void tcp_client_endpoint_impl::receive_cbk( std::stringstream msg; msg << "cei::rcb (" << _error.message() << "): "; for (std::size_t i = 0; i < _bytes + _recv_buffer_size; ++i) - msg << std::hex << std::setw(2) << std::setfill('0') - << (int) (_recv_buffer)[i] << " "; + msg << std::hex << std::setfill('0') << std::setw(2) + << static_cast( (_recv_buffer)[i] << " "; VSOMEIP_INFO << msg.str(); #endif std::unique_lock its_lock(socket_mutex_); @@ -644,7 +644,7 @@ void tcp_client_endpoint_impl::receive_cbk( } else if ((*recv_buffer_)[its_iteration_gap + VSOMEIP_PROTOCOL_VERSION_POS] != VSOMEIP_PROTOCOL_VERSION) { invalid_parameter_detected = true; VSOMEIP_ERROR << "tce: Wrong protocol version: 0x" - << std::hex << std::setw(2) << std::setfill('0') + << std::hex << std::setfill('0') << std::setw(2) << std::uint32_t((*recv_buffer_)[its_iteration_gap + VSOMEIP_PROTOCOL_VERSION_POS]) << " local: " << get_address_port_local() << " remote: " << get_address_port_remote(); @@ -662,7 +662,7 @@ void tcp_client_endpoint_impl::receive_cbk( (*recv_buffer_)[its_iteration_gap + VSOMEIP_MESSAGE_TYPE_POS]))) { invalid_parameter_detected = true; VSOMEIP_ERROR << "tce: Invalid message type: 0x" - << std::hex << std::setw(2) << std::setfill('0') + << std::hex << std::setfill('0') << std::setw(2) << std::uint32_t((*recv_buffer_)[its_iteration_gap + VSOMEIP_MESSAGE_TYPE_POS]) << " local: " << get_address_port_local() << " remote: " << get_address_port_remote(); @@ -670,7 +670,7 @@ void tcp_client_endpoint_impl::receive_cbk( (*recv_buffer_)[its_iteration_gap + VSOMEIP_RETURN_CODE_POS]))) { invalid_parameter_detected = true; VSOMEIP_ERROR << "tce: Invalid return code: 0x" - << std::hex << std::setw(2) << std::setfill('0') + << std::hex << std::setfill('0') << std::setw(2) << std::uint32_t((*recv_buffer_)[its_iteration_gap + VSOMEIP_RETURN_CODE_POS]) << " local: " << get_address_port_local() << " remote: " << get_address_port_remote(); @@ -860,15 +860,15 @@ void tcp_client_endpoint_impl::handle_recv_buffer_exception( << _e.what() << " local: " << get_address_port_local() << " remote: " << get_address_port_remote() << " shutting down connection. Start of buffer: " - << std::setfill('0') << std::hex; + << std::hex << std::setfill('0'); for (std::size_t i = 0; i < _recv_buffer_size && i < 16; i++) { - its_message << std::setw(2) << (int) ((*_recv_buffer)[i]) << " "; + its_message << std::setw(2) << static_cast((*_recv_buffer)[i]) << " "; } its_message << " Last 16 Bytes captured: "; for (int i = 15; _recv_buffer_size > 15 && i >= 0; i--) { - its_message << std::setw(2) << (int) ((*_recv_buffer)[static_cast(i)]) << " "; + its_message << std::setw(2) << static_cast( ((*_recv_buffer)[static_cast(i)]) )<< " "; } VSOMEIP_ERROR << its_message.str(); _recv_buffer->clear(); @@ -993,10 +993,11 @@ void tcp_client_endpoint_impl::send_cbk(boost::system::error_code const &_error, << _error.value() << ") " << get_remote_information() << " " << std::dec << queue_.size() << " " << std::dec << queue_size_ << " (" - << std::hex << std::setw(4) << std::setfill('0') << its_client <<"): [" - << std::hex << std::setw(4) << std::setfill('0') << its_service << "." - << std::hex << std::setw(4) << std::setfill('0') << its_method << "." - << std::hex << std::setw(4) << std::setfill('0') << its_session << "]"; + << std::hex << std::setfill('0') + << std::setw(4) << its_client << "): [" + << std::setw(4) << its_service << "." + << std::setw(4) << its_method << "." + << std::setw(4) << its_session << "]"; } } } diff --git a/implementation/endpoints/src/tcp_server_endpoint_impl.cpp b/implementation/endpoints/src/tcp_server_endpoint_impl.cpp index fa4639d0d..04a3b21a5 100644 --- a/implementation/endpoints/src/tcp_server_endpoint_impl.cpp +++ b/implementation/endpoints/src/tcp_server_endpoint_impl.cpp @@ -160,11 +160,10 @@ bool tcp_server_endpoint_impl::send_queued(const target_data_iterator_type _it) its_connection->send_queued(_it); } } else { - VSOMEIP_INFO << "Didn't find connection: " - << _it->first.address().to_string() << ":" << std::dec - << static_cast(_it->first.port()) - << " dropping outstanding messages (" << std::dec - << _it->second.queue_.size() << ")."; + VSOMEIP_INFO << "Didn't find connection: " << _it->first.address().to_string() << ":" + << std::dec << static_cast(_it->first.port()) + << " dropping outstanding messages (" << std::dec + << _it->second.queue_.size() << ")."; if (_it->second.queue_.size()) { std::set its_services; @@ -184,7 +183,7 @@ bool tcp_server_endpoint_impl::send_queued(const target_data_iterator_type _it) if (found_cbk != prepare_stop_handlers_.end()) { VSOMEIP_INFO << "Calling prepare stop handler " << "for service: 0x" - << std::hex << std::setw(4) << std::setfill('0') + << std::hex << std::setfill('0') << std::setw(4) << its_service; auto handler = found_cbk->second; auto ptr = this->shared_from_this(); @@ -223,8 +222,8 @@ bool tcp_server_endpoint_impl::is_established_to(const std::shared_ptr(endpoint.port()); + << "rejected for: " << endpoint.address().to_string() << ":" << std::dec + << static_cast(endpoint.port()); } } return is_connected; @@ -558,8 +557,8 @@ void tcp_server_endpoint_impl::connection::receive_cbk( #if 0 std::stringstream msg; for (std::size_t i = 0; i < _bytes + recv_buffer_size_; ++i) - msg << std::hex << std::setw(2) << std::setfill('0') - << (int) recv_buffer_[i] << " "; + msg << std::hex << std::setfill('0') << std::setw(2) + << static_cast( recv_buffer_[i] << " "; VSOMEIP_INFO << msg.str(); #endif std::shared_ptr its_host = its_server->routing_host_.lock(); @@ -691,8 +690,10 @@ void tcp_server_endpoint_impl::connection::receive_cbk( { std::lock_guard its_lock(socket_mutex_); VSOMEIP_ERROR << "tse: Wrong protocol version: 0x" - << std::hex << std::setw(2) << std::setfill('0') - << std::uint32_t(recv_buffer_[its_iteration_gap + VSOMEIP_PROTOCOL_VERSION_POS]) + << std::hex << std::setfill('0') << std::setw(2) + << std::uint32_t( + recv_buffer_[its_iteration_gap + + VSOMEIP_PROTOCOL_VERSION_POS]) << " local: " << get_address_port_local() << " remote: " << get_address_port_remote() << ". Closing connection due to missing/broken data TCP stream."; @@ -708,8 +709,9 @@ void tcp_server_endpoint_impl::connection::receive_cbk( recv_buffer_[its_iteration_gap + VSOMEIP_MESSAGE_TYPE_POS]))) { std::lock_guard its_lock(socket_mutex_); VSOMEIP_ERROR << "tse: Invalid message type: 0x" - << std::hex << std::setw(2) << std::setfill('0') - << std::uint32_t(recv_buffer_[its_iteration_gap + VSOMEIP_MESSAGE_TYPE_POS]) + << std::hex << std::setfill('0') << std::setw(2) + << std::uint32_t(recv_buffer_[its_iteration_gap + + VSOMEIP_MESSAGE_TYPE_POS]) << " local: " << get_address_port_local() << " remote: " << get_address_port_remote() << ". Closing connection due to missing/broken data TCP stream."; @@ -717,8 +719,9 @@ void tcp_server_endpoint_impl::connection::receive_cbk( recv_buffer_[its_iteration_gap + VSOMEIP_RETURN_CODE_POS]))) { std::lock_guard its_lock(socket_mutex_); VSOMEIP_ERROR << "tse: Invalid return code: 0x" - << std::hex << std::setw(2) << std::setfill('0') - << std::uint32_t(recv_buffer_[its_iteration_gap + VSOMEIP_RETURN_CODE_POS]) + << std::hex << std::setfill('0') << std::setw(2) + << std::uint32_t(recv_buffer_[its_iteration_gap + + VSOMEIP_RETURN_CODE_POS]) << " local: " << get_address_port_local() << " remote: " << get_address_port_remote() << ". Closing connection due to missing/broken data TCP stream."; @@ -744,9 +747,9 @@ void tcp_server_endpoint_impl::connection::receive_cbk( { std::lock_guard its_lock(socket_mutex_); VSOMEIP_ERROR << "Received a TCP message which exceeds " - << "maximum message size (" - << std::dec << current_message_size - << " > " << std::dec << max_message_size_ + << "maximum message size (" << std::dec + << current_message_size << " > " << std::dec + << max_message_size_ << ") Magic cookies are disabled: " << "Connection will be closed! local: " << get_address_port_local() << " remote: " diff --git a/implementation/endpoints/src/tp_message.cpp b/implementation/endpoints/src/tp_message.cpp index 7cb77b804..5bcc35afc 100644 --- a/implementation/endpoints/src/tp_message.cpp +++ b/implementation/endpoints/src/tp_message.cpp @@ -266,8 +266,8 @@ std::string tp_message::get_message_id(const byte_t* const _data, std::uint32_t << std::setw(4) << its_client << ") [" << std::setw(4) << its_service << "." << std::setw(4) << its_method << "." - << std::setw(2) << std::uint32_t(its_interface_version) << "." - << std::setw(2) << std::uint32_t(its_msg_type) << "." + << std::setw(2) << static_cast(its_interface_version) << "." + << std::setw(2) << static_cast(its_msg_type) << "." << std::setw(4) << its_session << "] "; if (_data_length > VSOMEIP_TP_HEADER_POS_MAX) { @@ -322,7 +322,7 @@ bool tp_message::check_lengths(const byte_t* const _data, << " data: " << std::dec << _data_length << " header: " << std::dec << its_length; ret = false; - } else if (current_message_size_ + _segment_size > max_message_size_ + } else if (current_message_size_ + _segment_size > max_message_size_ || current_message_size_ + _segment_size < _segment_size) { // overflow check VSOMEIP_ERROR << __func__ << ": Message exceeds maximum configured size: " << get_message_id(_data, _data_length) @@ -330,7 +330,7 @@ bool tp_message::check_lengths(const byte_t* const _data, << " current message size: " << std::dec << current_message_size_ << " maximum message size: " << std::dec << max_message_size_; ret = false; - } else if (tp::get_offset(its_tp_header) + _segment_size > max_message_size_ + } else if (tp::get_offset(its_tp_header) + _segment_size > max_message_size_ || tp::get_offset(its_tp_header) + _segment_size < _segment_size) { // overflow check VSOMEIP_ERROR << __func__ << ": SomeIP/TP offset field exceeds maximum configured message size: " << get_message_id(_data, _data_length) diff --git a/implementation/endpoints/src/tp_reassembler.cpp b/implementation/endpoints/src/tp_reassembler.cpp index f235957fc..dfd9c8872 100644 --- a/implementation/endpoints/src/tp_reassembler.cpp +++ b/implementation/endpoints/src/tp_reassembler.cpp @@ -83,8 +83,8 @@ std::pair tp_reassembler::process_tp_message( << std::setw(4) << its_client << ") [" << std::setw(4) << its_service << "." << std::setw(4) << its_method << "." - << std::setw(2) << std::uint32_t(its_interface_version) << "." - << std::setw(2) << std::uint32_t(its_msg_type) << "] Old: 0x" + << std::setw(2) << static_cast (its_interface_version) << "." + << std::setw(2) << static_cast (its_msg_type) << "] Old: 0x" << std::setw(4) << found_tp_msg->second.first << ", new: 0x" << std::setw(4) << its_session; // new segment with different session id -> throw away current diff --git a/implementation/endpoints/src/udp_client_endpoint_impl.cpp b/implementation/endpoints/src/udp_client_endpoint_impl.cpp index 4f7bd46ac..0151ebd68 100644 --- a/implementation/endpoints/src/udp_client_endpoint_impl.cpp +++ b/implementation/endpoints/src/udp_client_endpoint_impl.cpp @@ -220,8 +220,8 @@ void udp_client_endpoint_impl::send_queued(std::pair::sq: "; for (std::size_t i = 0; i < _buffer->size(); i++) - msg << std::hex << std::setw(2) << std::setfill('0') - << (int)(*_entry.first)[i] << " "; + msg << std::hex << std::setfill('0') << std::setw(2) + << static_cast((*_entry.first)[i]) << " "; VSOMEIP_INFO << msg.str(); #endif { diff --git a/implementation/endpoints/src/udp_server_endpoint_impl.cpp b/implementation/endpoints/src/udp_server_endpoint_impl.cpp index 23675b4aa..b3b99ce00 100644 --- a/implementation/endpoints/src/udp_server_endpoint_impl.cpp +++ b/implementation/endpoints/src/udp_server_endpoint_impl.cpp @@ -295,8 +295,8 @@ bool udp_server_endpoint_impl::send_queued( msg << "usei::sq(" << _queue_iterator->first.address().to_string() << ":" << _queue_iterator->first.port() << "): "; for (std::size_t i = 0; i < its_buffer->size(); ++i) - msg << std::hex << std::setw(2) << std::setfill('0') - << (int)(*its_entry.first)[i] << " "; + msg << std::hex << std::setfill('0') << std::setw(2) + << static_cast((*its_entry.first)[i]) << " "; VSOMEIP_INFO << msg.str(); #endif @@ -526,8 +526,8 @@ void udp_server_endpoint_impl::on_message_received( std::stringstream msg; msg << "usei::rcb(" << _error.message() << "): "; for (std::size_t i = 0; i < _bytes; ++i) - msg << std::hex << std::setw(2) << std::setfill('0') - << (int) _buffer[i] << " "; + msg << std::hex << std::setfill('0') << std::setw(2) + << static_cast(_buffer[i]) << " "; VSOMEIP_INFO << msg.str(); #endif std::shared_ptr its_host = routing_host_.lock(); @@ -560,10 +560,11 @@ void udp_server_endpoint_impl::on_message_received( )) { if (_buffer[i + VSOMEIP_PROTOCOL_VERSION_POS] != VSOMEIP_PROTOCOL_VERSION) { VSOMEIP_ERROR << "use: Wrong protocol version: 0x" - << std::hex << std::setw(2) << std::setfill('0') + << std::hex << std::setfill('0') << std::setw(2) << std::uint32_t(_buffer[i + VSOMEIP_PROTOCOL_VERSION_POS]) << " local: " << get_address_port_local() - << " remote: " << its_remote_address << ":" << std::dec << its_remote_port; + << " remote: " << its_remote_address << ":" << std::dec + << its_remote_port; // ensure to send back a message w/ wrong protocol version its_host->on_message(&_buffer[i], VSOMEIP_SOMEIP_HEADER_SIZE + 8, this, @@ -574,22 +575,23 @@ void udp_server_endpoint_impl::on_message_received( } else if (!utility::is_valid_message_type(tp::tp::tp_flag_unset( _buffer[i + VSOMEIP_MESSAGE_TYPE_POS]))) { VSOMEIP_ERROR << "use: Invalid message type: 0x" - << std::hex << std::setw(2) << std::setfill('0') + << std::hex << std::setfill('0') << std::setw(2) << std::uint32_t(_buffer[i + VSOMEIP_MESSAGE_TYPE_POS]) << " local: " << get_address_port_local() << " remote: " << its_remote_address << ":" << std::dec << its_remote_port; } else if (!utility::is_valid_return_code(static_cast( _buffer[i + VSOMEIP_RETURN_CODE_POS]))) { VSOMEIP_ERROR << "use: Invalid return code: 0x" - << std::hex << std::setw(2) << std::setfill('0') + << std::hex << std::setfill('0') << std::setw(2) << std::uint32_t(_buffer[i + VSOMEIP_RETURN_CODE_POS]) << " local: " << get_address_port_local() << " remote: " << its_remote_address << ":" << std::dec << its_remote_port; } else if (tp::tp::tp_flag_is_set(_buffer[i + VSOMEIP_MESSAGE_TYPE_POS]) && get_local_port() == configuration_->get_sd_port()) { VSOMEIP_WARNING << "use: Received a SomeIP/TP message on SD port:" - << " local: " << get_address_port_local() - << " remote: " << its_remote_address << ":" << std::dec << its_remote_port; + << " local: " << get_address_port_local() + << " remote: " << its_remote_address << ":" << std::dec + << its_remote_port; } return; } @@ -612,10 +614,13 @@ void udp_server_endpoint_impl::on_message_received( if (its_instance != ANY_INSTANCE) { if (!tp_segmentation_enabled(its_service, its_instance, its_method)) { - VSOMEIP_WARNING << "use: Received a SomeIP/TP message for service: 0x" << std::hex << its_service - << " method: 0x" << its_method << " which is not configured for TP:" + VSOMEIP_WARNING + << "use: Received a SomeIP/TP message for service: 0x" + << std::hex << its_service << " method: 0x" << its_method + << " which is not configured for TP:" << " local: " << get_address_port_local() - << " remote: " << its_remote_address << ":" << std::dec << its_remote_port; + << " remote: " << its_remote_address << ":" << std::dec + << its_remote_port; return; } } @@ -656,8 +661,9 @@ void udp_server_endpoint_impl::on_message_received( i += current_message_size; } else { VSOMEIP_ERROR << "Received an unreliable vSomeIP message with bad length field" - << " local: " << get_address_port_local() - << " remote: " << its_remote_address << ":" << std::dec << its_remote_port; + << " local: " << get_address_port_local() + << " remote: " << its_remote_address << ":" << std::dec + << its_remote_port; if (remaining_bytes > VSOMEIP_SERVICE_POS_MAX) { service_t its_service = bithelper::read_uint16_be(&_buffer[VSOMEIP_SERVICE_POS_MIN]); if (its_service != VSOMEIP_SD_SERVICE) { @@ -699,12 +705,10 @@ bool udp_server_endpoint_impl::is_same_subnet(const boost::asio::ip::address &_a void udp_server_endpoint_impl::print_status() { std::lock_guard its_lock(mutex_); - VSOMEIP_INFO << "status use: " << std::dec << local_port_ - << " number targets: " << std::dec << targets_.size() - << " recv_buffer: " - << std::dec << unicast_recv_buffer_.capacity() - << " multicast_recv_buffer: " - << std::dec << multicast_recv_buffer_.capacity(); + VSOMEIP_INFO << "status use: " << std::dec << local_port_ << " number targets: " << std::dec + << targets_.size() << " recv_buffer: " << std::dec + << unicast_recv_buffer_.capacity() << " multicast_recv_buffer: " << std::dec + << multicast_recv_buffer_.capacity(); for (const auto &c : targets_) { std::size_t its_data_size(0); @@ -876,10 +880,9 @@ udp_server_endpoint_impl::set_multicast_option(const boost::asio::ip::address& _ } } #endif - VSOMEIP_INFO << "udp_server_endpoint_impl: SO_RCVBUF is: " - << std::dec << its_option.value() - << " (" << its_udp_recv_buffer_size << ") local port:" - << std::dec << local_port_; + VSOMEIP_INFO << "udp_server_endpoint_impl: SO_RCVBUF is: " << std::dec + << its_option.value() << " (" << its_udp_recv_buffer_size + << ") local port:" << std::dec << local_port_; multicast_id_++; receive_multicast(multicast_id_); diff --git a/implementation/logger/src/message.cpp b/implementation/logger/src/message.cpp index 0ea45922f..67fc12943 100644 --- a/implementation/logger/src/message.cpp +++ b/implementation/logger/src/message.cpp @@ -125,15 +125,19 @@ message::~message() try { #ifndef ANDROID { std::unique_lock app_name_lock = its_logger->get_app_name_lock(); - std::cout << std::dec << std::setw(4) << its_time.tm_year + 1900 << "-" << std::dec - << std::setw(2) << std::setfill('0') << its_time.tm_mon + 1 << "-" - << std::dec << std::setw(2) << std::setfill('0') << its_time.tm_mday - << " " << std::dec << std::setw(2) << std::setfill('0') - << its_time.tm_hour << ":" << std::dec << std::setw(2) - << std::setfill('0') << its_time.tm_min << ":" << std::dec << std::setw(2) - << std::setfill('0') << its_time.tm_sec << "." << std::dec << std::setw(6) - << std::setfill('0') << its_ms << " " << its_logger->get_app_name() - << " [" << its_level << "] " << buffer_.data_.str() << std::endl; + std::cout + << std::dec + << std::setw(4) << its_time.tm_year + 1900 << "-" + << std::setfill('0') + << std::setw(2) << its_time.tm_mon + 1 << "-" + << std::setw(2) << its_time.tm_mday << " " + << std::setw(2) << its_time.tm_hour << ":" + << std::setw(2) << its_time.tm_min << ":" + << std::setw(2) << its_time.tm_sec << "." + << std::setw(6) << its_ms << " [" + << its_level << "] " + << buffer_.data_.str() + << std::endl; } #else std::string app = runtime::get_property("LogApplication"); @@ -166,15 +170,20 @@ message::~message() try { if (its_logger->has_file_log()) { std::ofstream its_logfile(its_logger->get_logfile(), std::ios_base::app); if (its_logfile.is_open()) { - its_logfile << std::dec << std::setw(4) << its_time.tm_year + 1900 << "-" - << std::dec << std::setw(2) << std::setfill('0') << its_time.tm_mon + 1 - << "-" << std::dec << std::setw(2) << std::setfill('0') - << its_time.tm_mday << " " << std::dec << std::setw(2) - << std::setfill('0') << its_time.tm_hour << ":" << std::dec - << std::setw(2) << std::setfill('0') << its_time.tm_min << ":" - << std::dec << std::setw(2) << std::setfill('0') << its_time.tm_sec - << "." << std::dec << std::setw(6) << std::setfill('0') << its_ms - << " [" << its_level << "] " << buffer_.data_.str() << std::endl; + its_logfile + << std::dec + << std::setw(4) << its_time.tm_year + 1900 << "-" + << std::setfill('0') + << std::setw(2) << its_time.tm_mon + 1 << "-" + << std::setw(2) << its_time.tm_mday << " " + << std::setw(2) << its_time.tm_hour << ":" + << std::setw(2) << its_time.tm_min << ":" + << std::setw(2) << its_time.tm_sec << "." + << std::setw(6) << its_ms << " " + << its_logger->get_app_name() << " [" + << its_level << "] " + << buffer_.data_.str() + << std::endl; } } } diff --git a/implementation/message/src/deserializer.cpp b/implementation/message/src/deserializer.cpp index 746b83630..28f0a4541 100644 --- a/implementation/message/src/deserializer.cpp +++ b/implementation/message/src/deserializer.cpp @@ -234,12 +234,12 @@ void deserializer::reset() { void deserializer::show() const { std::stringstream its_message; its_message << "(" - << std::hex << std::setw(2) << std::setfill('0') - << (int)*position_ << ", " + << std::hex << std::setfill('0') << std::setw(2) + << static_cast(*position_ << ", " << std:: dec << remaining_ << ") " << std::hex << std::setfill('0'); for (int i = 0; i < data_.size(); ++i) - its_message << std::setw(2) << (int)data_[i] << " "; + its_message << std::setw(2) << static_cast(data_[i]) << " "; VSOMEIP_INFO << its_message; } #endif diff --git a/implementation/routing/src/event.cpp b/implementation/routing/src/event.cpp index 688baf5eb..9bcc7a348 100644 --- a/implementation/routing/src/event.cpp +++ b/implementation/routing/src/event.cpp @@ -169,7 +169,7 @@ event::set_payload(const std::shared_ptr &_payload, bool _force) { } else { VSOMEIP_INFO << __func__ << ":" << __LINE__ << " Cannot set payload for event [" - << std::hex << std::setw(4) << std::setfill('0') + << std::hex << std::setfill('0') << std::setw(4) << current_->get_service() << "." << current_->get_instance() << "." << current_->get_method() @@ -192,7 +192,7 @@ event::set_payload(const std::shared_ptr &_payload, client_t _client, } else { VSOMEIP_INFO << __func__ << ":" << __LINE__ << " Cannot set payload for event [" - << std::hex << std::setw(4) << std::setfill('0') + << std::hex << std::setfill('0') << std::setw(4) << current_->get_service() << "." << current_->get_instance() << "." << current_->get_method() @@ -217,7 +217,7 @@ event::set_payload(const std::shared_ptr &_payload, } else { VSOMEIP_INFO << __func__ << ":" << __LINE__ << " Cannot set payload for event [" - << std::hex << std::setw(4) << std::setfill('0') + << std::hex << std::setfill('0') << std::setw(4) << current_->get_service() << "." << current_->get_instance() << "." << current_->get_method() @@ -367,7 +367,7 @@ event::notify(bool _force) { } else { VSOMEIP_INFO << __func__ << ": Notifying " - << std::hex << std::setw(4) << std::setfill('0') + << std::hex << std::setfill('0') << std::setw(4) << get_service() << "." << get_instance() << "." << get_event() << " failed. Event payload not (yet) set!"; } @@ -383,7 +383,7 @@ event::notify_one(client_t _client, } else { VSOMEIP_WARNING << __func__ << ": Notifying " - << std::hex << std::setw(4) << std::setfill('0') + << std::hex << std::setfill('0') << std::setw(4) << get_service() << "." << get_instance() << "." << get_event() << " failed. Target undefined"; } @@ -400,7 +400,7 @@ event::notify_one_unlocked(client_t _client, } else { VSOMEIP_INFO << __func__ << ": Notifying " - << std::hex << std::setw(4) << std::setfill('0') + << std::hex << std::setfill('0') << std::setw(4) << get_service() << "." << get_instance() << "." << get_event() << " failed. Event payload not (yet) set!"; pending_.insert(_target); @@ -408,7 +408,7 @@ event::notify_one_unlocked(client_t _client, } else { VSOMEIP_WARNING << __func__ << ": Notifying " - << std::hex << std::setw(4) << std::setfill('0') + << std::hex << std::setfill('0') << std::setw(4) << get_service() << "." << get_instance() << "." << get_event() << " failed. Target undefined"; } @@ -430,7 +430,7 @@ event::notify_one_unlocked(client_t _client, bool _force) { } else { VSOMEIP_INFO << __func__ << ": Initial value for [" - << std::hex << std::setw(4) << std::setfill('0') + << std::hex << std::setfill('0') << std::setw(4) << get_service() << "." << get_instance() << "." << get_event() << "] not yet set by the service/client." << " Client " << _client @@ -522,7 +522,7 @@ event::add_subscriber(eventgroup_t _eventgroup, if (_filter) { VSOMEIP_WARNING << "Using client [" - << std::hex << std::setw(4) << std::setfill('0') + << std::hex << std::setfill('0') << std::setw(4) << _client << "] specific filter configuration for SOME/IP event " << get_service() << "." << get_instance() << "." << get_event() << "."; @@ -535,8 +535,8 @@ event::add_subscriber(eventgroup_t _eventgroup, << ", ignore=[ "; for (auto i : _filter->ignore_) its_filter_parameters << "(" << std::dec << i.first << ", " - << std::hex << std::setw(2) << std::setfill('0') - << (int)i.second << ") "; + << std::hex << std::setfill('0') << std::setw(2) + << static_cast(i.second) << ") "; its_filter_parameters << "])"; VSOMEIP_INFO << "Filter parameters: " << its_filter_parameters.str(); @@ -620,9 +620,9 @@ event::add_subscriber(eventgroup_t _eventgroup, } else { VSOMEIP_WARNING << __func__ << ": Didnt' insert client " - << std::hex << std::setw(4) << std::setfill('0') << _client + << std::hex << std::setfill('0') << std::setw(4) << _client << " to eventgroup 0x" - << std::hex << std::setw(4) << std::setfill('0') + << std::setw(4) << get_service() << "." << get_instance() << "." << _eventgroup; } diff --git a/implementation/routing/src/routing_manager_base.cpp b/implementation/routing/src/routing_manager_base.cpp index a9438ef4b..e4c0628ee 100644 --- a/implementation/routing/src/routing_manager_base.cpp +++ b/implementation/routing/src/routing_manager_base.cpp @@ -470,12 +470,10 @@ void routing_manager_base::register_event(client_t _client, VSOMEIP_WARNING << "Using debounce configuration for " << " SOME/IP event " - << std::hex << std::setw(4) << std::setfill('0') - << _service << "." - << std::hex << std::setw(4) << std::setfill('0') - << _instance << "." - << std::hex << std::setw(4) << std::setfill('0') - << _notifier << "." + << std::hex << std::setfill('0') + << std::setw(4) << _service << "." + << std::setw(4) << _instance << "." + << std::setw(4) << _notifier << "." << " Debounce parameters: " << its_debounce_parameters.str(); diff --git a/implementation/routing/src/routing_manager_client.cpp b/implementation/routing/src/routing_manager_client.cpp index e480be63a..9cb22e5cd 100644 --- a/implementation/routing/src/routing_manager_client.cpp +++ b/implementation/routing/src/routing_manager_client.cpp @@ -177,7 +177,7 @@ void routing_manager_client::stop() { while (state_ == inner_state_type_e::ST_REGISTERING) { std::cv_status status = state_condition_.wait_for(its_lock, its_timeout); if (status == std::cv_status::timeout) { - VSOMEIP_WARNING << std::hex << std::setw(4) << std::setfill('0') << get_client() + VSOMEIP_WARNING << std::hex << std::setfill('0') << std::setw(4) << get_client() << " registering timeout on stop"; break; } @@ -189,7 +189,7 @@ void routing_manager_client::stop() { while (state_ == inner_state_type_e::ST_REGISTERED) { std::cv_status status = state_condition_.wait_for(its_lock, its_timeout); if (status == std::cv_status::timeout) { - VSOMEIP_WARNING << std::hex << std::setw(4) << std::setfill('0') << get_client() + VSOMEIP_WARNING << std::hex << std::setfill('0') << std::setw(4) << get_client() << " couldn't deregister application - timeout"; break; } @@ -874,7 +874,7 @@ bool routing_manager_client::send(client_t _client, const byte_t *_data, } } else { VSOMEIP_ERROR << "routing_manager_client::send: (" - << std::hex << std::setw(4) << std::setfill('0') << get_client() + << std::hex << std::setfill('0') << std::setw(4) << get_client() << "): message too short to log: " << std::dec << _size; } } @@ -1008,7 +1008,7 @@ void routing_manager_client::on_disconnect(const std::shared_ptr& _end } if (!is_connected_) { VSOMEIP_INFO << "routing_manager_client::on_disconnect: Client 0x" - << std::hex << std::setw(4) << std::setfill('0') << get_client() + << std::hex << std::setfill('0') << std::setw(4) << get_client() << " calling host_->on_state with DEREGISTERED"; host_->on_state(state_type_e::ST_DEREGISTERED); } @@ -1030,7 +1030,7 @@ void routing_manager_client::on_message( std::stringstream msg; msg << "rmp::on_message<" << std::hex << get_client() << ">: "; for (length_t i = 0; i < _size; ++i) - msg << std::hex << std::setw(2) << std::setfill('0') << (int)_data[i] << " "; + msg << std::hex << std::setfill('0') << std::setw(2) << static_cast(_data[i] << " "; VSOMEIP_INFO << msg.str(); #endif protocol::id_e its_id; @@ -1079,11 +1079,13 @@ void routing_manager_client::on_message( if (configuration_->is_security_enabled() && configuration_->is_local_routing() && !is_from_routing && _bound_client != its_client) { - VSOMEIP_WARNING << "Client " << std::hex << std::setw(4) << std::setfill('0') - << get_client() << " received a message with command " << int(its_id) - << " from " << std::hex << std::setw(4) << std::setfill('0') - << its_client << " which doesn't match the bound client " << std::hex - << std::setw(4) << std::setfill('0') << _bound_client + VSOMEIP_WARNING << "Client " + << std::hex << std::setfill('0') + << std::setw(4) << get_client() + << " received a message with command " << static_cast(its_id) + << " from " << std::setw(4) << its_client + << " which doesn't match the bound client " + << std::setw(4) << _bound_client << " ~> skip message!"; return; } @@ -1114,7 +1116,7 @@ void routing_manager_client::on_message( if (!is_response_allowed(_bound_client, its_message->get_service(), its_message->get_instance(), its_message->get_method())) { VSOMEIP_WARNING << "vSomeIP Security: Client 0x" - << std::hex << std::setw(4) << std::setfill('0') << get_client() + << std::hex << std::setfill('0') << std::setw(4) << get_client() << " : routing_manager_client::on_message: " << " received a notification from client 0x" << _bound_client << " which does not offer service/instance/event " @@ -1127,7 +1129,7 @@ void routing_manager_client::on_message( get_sec_client(), its_message->get_service(), its_message->get_instance(), its_message->get_method())) { VSOMEIP_WARNING << "vSomeIP Security: Client 0x" - << std::hex << std::setw(4) << std::setfill('0') << get_client() + << std::hex << std::setfill('0') << std::setw(4) << get_client() << " : routing_manager_client::on_message: " << " isn't allowed to receive a notification from service/instance/event " << its_message->get_service() << "/" << its_message->get_instance() @@ -1142,22 +1144,21 @@ void routing_manager_client::on_message( if (configuration_->is_security_enabled() && configuration_->is_local_routing() && its_message->get_client() != _bound_client) { - VSOMEIP_WARNING << std::hex << "vSomeIP Security: Client 0x" - << std::hex << std::setw(4) << std::setfill('0') << get_client() - << " received a request from client 0x" - << std::hex << std::setw(4) << std::setfill('0') << its_message->get_client() - << " to service/instance/method " << its_message->get_service() - << "/" << its_message->get_instance() << "/" << its_message->get_method() - << " which doesn't match the bound client 0x" - << std::hex << std::setw(4) << std::setfill('0') << _bound_client - << " ~> skip message!"; + VSOMEIP_WARNING << std::hex << std::setfill('0') + << "vSomeIP Security: Client 0x" << std::setw(4) << get_client() + << " received a request from client 0x" << std::setw(4) << its_message->get_client() + << " to service/instance/method " + << its_message->get_service() << "/" << its_message->get_instance() + << "/" << its_message->get_method() + << " which doesn't match the bound client 0x" << std::setw(4) << _bound_client + << " ~> skip message!"; return; } if (VSOMEIP_SEC_OK != configuration_->get_security()->is_client_allowed_to_access_member( _sec_client, its_message->get_service(), its_message->get_instance(), its_message->get_method())) { VSOMEIP_WARNING << "vSomeIP Security: Client 0x" - << std::hex << std::setw(4) << std::setfill('0') << its_message->get_client() + << std::hex << std::setfill('0') << std::setw(4) << its_message->get_client() << " : routing_manager_client::on_message: " << "isn't allowed to send a request to service/instance/method " << its_message->get_service() << "/" << its_message->get_instance() @@ -1169,7 +1170,7 @@ void routing_manager_client::on_message( if (!is_response_allowed(_bound_client, its_message->get_service(), its_message->get_instance(), its_message->get_method())) { VSOMEIP_WARNING << "vSomeIP Security: Client 0x" - << std::hex << std::setw(4) << std::setfill('0') << get_client() + << std::hex << std::setfill('0') << std::setw(4) << get_client() << " : routing_manager_client::on_message: " << " received a response from client 0x" << _bound_client << " which does not offer service/instance/method " @@ -1182,7 +1183,7 @@ void routing_manager_client::on_message( get_sec_client(), its_message->get_service(), its_message->get_instance(), its_message->get_method())) { VSOMEIP_WARNING << "vSomeIP Security: Client 0x" - << std::hex << std::setw(4) << std::setfill('0') << get_client() + << std::hex << std::setfill('0') << std::setw(4) << get_client() << " : routing_manager_client::on_message: " << " isn't allowed to receive a response from service/instance/method " << its_message->get_service() << "/" << its_message->get_instance() @@ -1198,7 +1199,7 @@ void routing_manager_client::on_message( // if the message is from routing manager, check if // policy allows remote requests. VSOMEIP_WARNING << "vSomeIP Security: Client 0x" - << std::hex << std::setw(4) << std::setfill('0') << get_client() + << std::hex << std::setfill('0') << std::setw(4) << get_client() << " : routing_manager_client::on_message: " << std::hex << "Security: Remote clients via routing manager with client ID 0x" << its_client << " are not allowed to communicate with service/instance/method " @@ -1275,7 +1276,7 @@ void routing_manager_client::on_message( } else { VSOMEIP_WARNING << "routing_manager_client::on_message: " << "Security: Client 0x" - << std::hex << std::setw(4) << std::setfill('0')<< get_client() + << std::hex << std::setfill('0') << std::setw(4)<< get_client() << " received an routing info from a client which isn't the routing manager" << " : Skip message!"; } @@ -1288,7 +1289,7 @@ void routing_manager_client::on_message( if (its_error == protocol::error_e::ERROR_OK) { send_pong(); VSOMEIP_TRACE << "PING(" - << std::hex << std::setw(4) << std::setfill('0') << get_client() << ")"; + << std::hex << std::setfill('0') << std::setw(4) << get_client() << ")"; } else VSOMEIP_ERROR << __func__ << ": ping command deserialization failed (" @@ -1353,20 +1354,18 @@ void routing_manager_client::on_message( its_eventgroup, its_event, its_pending_id); } - VSOMEIP_INFO - << "SUBSCRIBE(" << std::hex << std::setw(4) - << std::setfill('0') << its_client << "): [" << std::hex - << std::setw(4) << std::setfill('0') << its_service - << "." << std::hex << std::setw(4) << std::setfill('0') - << its_instance << "." << std::hex << std::setw(4) - << std::setfill('0') << its_eventgroup << ":" - << std::hex << std::setw(4) << std::setfill('0') - << its_event << ":" << std::dec << (uint16_t)its_major - << "] " << std::boolalpha - << (its_pending_id != PENDING_SUBSCRIPTION_ID) << " " - << (_subscription_accepted - ? std::to_string(its_count) + " accepted." - : "not accepted."); + VSOMEIP_INFO << "SUBSCRIBE(" + << std::hex << std::setfill('0') + << std::setw(4) << its_client << "): [" + << std::setw(4) << its_service << "." + << std::setw(4) << its_instance << "." + << std::setw(4) << its_eventgroup << ":" + << std::setw(4) << its_event << ":" + << std::dec << static_cast(its_major) << "] " + << std::boolalpha << (its_pending_id != PENDING_SUBSCRIPTION_ID) + << " " + << (_subscription_accepted ? + std::to_string(its_count) + " accepted." : "not accepted."); }); } else { send_subscribe_nack(its_client, its_service, its_instance, its_eventgroup, @@ -1480,7 +1479,7 @@ void routing_manager_client::on_message( << std::setw(4) << its_instance << "." << std::setw(4) << its_eventgroup << ":" << std::setw(4) << its_event << ":" - << std::dec << (uint16_t)its_major << "]"; + << std::dec << static_cast(its_major) << "]"; } } else { VSOMEIP_ERROR << __func__ @@ -1529,7 +1528,8 @@ void routing_manager_client::on_message( << std::setw(4) << its_instance << "." << std::setw(4) << its_eventgroup << "." << std::setw(4) << its_event << "] " - << (bool)(its_pending_id != PENDING_SUBSCRIPTION_ID) << " " + << std::boolalpha + << (its_pending_id != PENDING_SUBSCRIPTION_ID) << " " << std::dec << its_remote_subscriber_count; } else VSOMEIP_ERROR << __func__ @@ -1574,7 +1574,8 @@ void routing_manager_client::on_message( << std::setw(4) << its_instance << "." << std::setw(4) << its_eventgroup << "." << std::setw(4) << its_event << "] " - << (bool)(its_pending_id != PENDING_SUBSCRIPTION_ID) << " " + << std::boolalpha + << (its_pending_id != PENDING_SUBSCRIPTION_ID) << " " << std::dec << its_remote_subscriber_count; } else VSOMEIP_ERROR << __func__ @@ -1665,7 +1666,7 @@ void routing_manager_client::on_message( send_resend_provided_event_response(its_command.get_remote_offer_id()); VSOMEIP_INFO << "RESEND_PROVIDED_EVENTS(" - << std::hex << std::setw(4) << std::setfill('0') + << std::hex << std::setfill('0') << std::setw(4) << its_command.get_client() << ")"; } else VSOMEIP_ERROR << __func__ @@ -1705,7 +1706,7 @@ void routing_manager_client::on_message( } } else { VSOMEIP_WARNING << "vSomeIP Security: Client 0x" - << std::hex << std::setw(4) << std::setfill('0') << get_client() + << std::hex << std::setfill('0') << std::setw(4) << get_client() << " : routing_manager_client::on_message: " << " received a security policy update from a client which isn't the routing manager" << " : Skip message!"; @@ -1734,7 +1735,7 @@ void routing_manager_client::on_message( << ")"; } else VSOMEIP_WARNING << "vSomeIP Security: Client 0x" - << std::hex << std::setw(4) << std::setfill('0') << get_client() + << std::hex << std::setfill('0') << std::setw(4) << get_client() << " : routing_manager_client::on_message: " << "received a security policy removal from a client which isn't the routing manager" << " : Skip message!"; @@ -1761,7 +1762,7 @@ void routing_manager_client::on_message( << ")"; } else VSOMEIP_WARNING << "vSomeIP Security: Client 0x" - << std::hex << std::setw(4) << std::setfill('0') << get_client() + << std::hex << std::setfill('0') << std::setw(4) << get_client() << " : routing_manager_client::on_message: " << " received a security policy distribution command from a client which isn't the routing manager" << " : Skip message!"; @@ -1782,7 +1783,7 @@ void routing_manager_client::on_message( << ")"; } else VSOMEIP_WARNING << "vSomeIP Security: Client 0x" - << std::hex << std::setw(4) << std::setfill('0') << get_client() + << std::hex << std::setfill('0') << std::setw(4) << get_client() << " : routing_manager_client::on_message: " << "received a security credential update from a client which isn't the routing manager" << " : Skip message!"; @@ -1818,9 +1819,9 @@ void routing_manager_client::on_routing_info( const byte_t *_data, uint32_t _size) { #if 0 std::stringstream msg; - msg << "rmp::on_routing_info(" << std::hex << std::setw(4) << std::setfill('0') << get_client() << "): "; + msg << "rmp::on_routing_info(" << std::hex << std::setfill('0') << std::setw(4) << get_client() << "): "; for (uint32_t i = 0; i < _size; ++i) - msg << std::hex << std::setw(2) << std::setfill('0') << (int)_data[i] << " "; + msg << std::hex << std::setfill('0') << std::setw(2) << static_cast(_data[i] << " "; VSOMEIP_INFO << msg.str(); #endif auto its_policy_manager = configuration_->get_policy_manager(); @@ -1853,11 +1854,11 @@ void routing_manager_client::on_routing_info( if (its_client == get_client()) { VSOMEIP_INFO << "Application/Client " - << std::hex << std::setw(4) << std::setfill('0') << get_client() + << std::hex << std::setfill('0') << std::setw(4) << get_client() << " (" << host_->get_name() << ") is registered."; #if defined(__linux__) || defined(ANDROID) || defined(__QNX__) if (!its_policy_manager->check_credentials(get_client(), get_sec_client())) { - VSOMEIP_ERROR << "vSomeIP Security: Client 0x" << std::hex << std::setw(4) << std::setfill('0') << get_client() + VSOMEIP_ERROR << "vSomeIP Security: Client 0x" << std::hex << std::setfill('0') << std::setw(4) << get_client() << " : routing_manager_client::on_routing_info: RIE_ADD_CLIENT: isn't allowed" << " to use the server endpoint due to credential check failed!"; deregister_application(); @@ -1894,7 +1895,7 @@ void routing_manager_client::on_routing_info( } if (its_client == get_client()) { its_policy_manager->remove_client_to_sec_client_mapping(its_client); - VSOMEIP_INFO << "Application/Client " << std::hex << std::setw(4) << std::setfill('0') << get_client() + VSOMEIP_INFO << "Application/Client " << std::hex << std::setfill('0') << std::setw(4) << get_client() << " (" << host_->get_name() << ") is deregistered."; // inform host about its own registration state changes @@ -2113,13 +2114,13 @@ void routing_manager_client::reconnect(const std::map &_c } } - VSOMEIP_INFO << std::hex << "Application/Client " - << std::hex << std::setw(4) << std::setfill('0') << get_client() + VSOMEIP_INFO << "Application/Client " + << std::hex << std::setfill('0') << std::setw(4) << get_client() <<": Reconnecting to routing manager."; #if defined(__linux__) || defined(ANDROID) || defined(__QNX__) if (!its_policy_manager->check_credentials(get_client(), get_sec_client())) { - VSOMEIP_ERROR << "vSomeIP Security: Client 0x" << std::hex << std::setw(4) << std::setfill('0') << get_client() + VSOMEIP_ERROR << "vSomeIP Security: Client 0x" << std::hex << std::setfill('0') << std::setw(4) << get_client() << " : routing_manager_client::reconnect: isn't allowed" << " to use the server endpoint due to credential check failed!"; std::lock_guard its_lock(sender_mutex_); @@ -2138,7 +2139,7 @@ void routing_manager_client::reconnect(const std::map &_c void routing_manager_client::assign_client() { - VSOMEIP_INFO << __func__ << ": (" << std::hex << std::setw(4) << std::setfill('0') + VSOMEIP_INFO << __func__ << ": (" << std::hex << std::setfill('0') << std::setw(4) << get_client() << ":" << host_->get_name() << ")"; protocol::assign_client_command its_command; @@ -2161,7 +2162,7 @@ void routing_manager_client::assign_client() { std::lock_guard its_lock(sender_mutex_); if (sender_) { if (state_ != inner_state_type_e::ST_DEREGISTERED) { - VSOMEIP_WARNING << __func__ << ": (" << std::hex << std::setw(4) << std::setfill('0') + VSOMEIP_WARNING << __func__ << ": (" << std::hex << std::setfill('0') << std::setw(4) << get_client() << ") Non-Deregistered State Set. Returning"; return; } @@ -2178,12 +2179,12 @@ void routing_manager_client::assign_client() { std::dynamic_pointer_cast(shared_from_this()), std::placeholders::_1)); } else { - VSOMEIP_WARNING << __func__ << ": (" << std::hex << std::setw(4) << std::setfill('0') + VSOMEIP_WARNING << __func__ << ": (" << std::hex << std::setfill('0') << std::setw(4) << get_client() << ") sender not initialized. Ignoring client assignment"; } } else { - VSOMEIP_WARNING << __func__ << ": (" << std::hex << std::setw(4) << std::setfill('0') + VSOMEIP_WARNING << __func__ << ": (" << std::hex << std::setfill('0') << std::setw(4) << get_client() << ") not connected. Ignoring client assignment"; } } @@ -2424,12 +2425,13 @@ void routing_manager_client::on_subscribe_ack(client_t _client, (void)_client; #if 0 VSOMEIP_ERROR << "routing_manager_client::" << __func__ - << "(" << std::hex << std::setw(4) << std::setfill('0') << host_->get_client() << "):" + << std::hex << std::setfill('0') + << "(" << std::setw(4) << host_->get_client() << "):" << "event=" - << std::hex << std::setw(4) << std::setfill('0') << _service << "." - << std::hex << std::setw(4) << std::setfill('0') << _instance << "." - << std::hex << std::setw(4) << std::setfill('0') << _eventgroup << "." - << std::hex << std::setw(4) << std::setfill('0') << _event; + << std::setw(4) << _service << "." + << std::setw(4) << _instance << "." + << std::setw(4) << _eventgroup << "." + << std::setw(4) << _event; #endif if (_event == ANY_EVENT) { auto its_eventgroup = find_eventgroup(_service, _instance, _eventgroup); @@ -2640,13 +2642,13 @@ routing_manager_client::assign_client_timeout_cbk( register_again = true; } else { VSOMEIP_INFO << __func__ << ": Will not retry registry for Client [0x" - << std::hex << std::setw(4) << std::setfill('0') << get_client() + << std::hex << std::setfill('0') << std::setw(4) << get_client() << "] : already registered "; } } if (register_again) { std::lock_guard its_lock(sender_mutex_); - VSOMEIP_WARNING << "Client 0x" << std::hex << std::setw(4) << std::setfill('0') + VSOMEIP_WARNING << "Client 0x" << std::hex << std::setfill('0') << std::setw(4) << get_client() << " request client timeout! Trying again..."; if (sender_) { @@ -2655,7 +2657,7 @@ routing_manager_client::assign_client_timeout_cbk( } } else if (_error != boost::asio::error::operation_aborted) { //ignore error when timer is deliberately cancelled VSOMEIP_WARNING << __func__ << ": Ignoring Client 0x" - << std::hex << std::setw(4) << std::setfill('0') << get_client() + << std::hex << std::setfill('0') << std::setw(4) << get_client() << " due to error_code: " << _error.value() ; } } @@ -2673,8 +2675,8 @@ void routing_manager_client::register_application_timeout_cbk( } if (register_again) { std::lock_guard its_lock(sender_mutex_); - VSOMEIP_WARNING << std::hex << "Client 0x" - << std::hex << std::setw(4) << std::setfill('0') << get_client() + VSOMEIP_WARNING << std::hex << std::setfill('0') << "Client 0x" + << std::setw(4) << get_client() << " register timeout! Trying again..."; if (sender_) @@ -2970,12 +2972,12 @@ void routing_manager_client::on_client_assign_ack(const client_t &_client) { receiver_->start(); VSOMEIP_INFO << "Client " - << std::hex << std::setw(4) << std::setfill('0') << get_client() + << std::hex << std::setfill('0') << std::setw(4) << get_client() << " (" << host_->get_name() << ") successfully connected to routing ~> registering.."; register_application(); } else { VSOMEIP_WARNING << __func__ << ": (" << host_->get_name() << ":" - << std::hex << std::setw(4) << std::setfill('0') + << std::hex << std::setfill('0') << std::setw(4) << _client << ") Receiver not started. Restarting"; state_ = inner_state_type_e::ST_DEREGISTERED; @@ -2985,16 +2987,16 @@ void routing_manager_client::on_client_assign_ack(const client_t &_client) { } } else { VSOMEIP_WARNING << __func__ << ": (" << host_->get_name() << ":" - << std::hex << std::setw(4) << std::setfill('0') + << std::hex << std::setfill('0') << std::setw(4) << _client << ") Not started. Discarding"; } } else { VSOMEIP_ERROR << __func__ << ": (" << host_->get_name() << ":" - << std::hex << std::setw(4) << std::setfill('0') + << std::hex << std::setfill('0') << std::setw(4) << _client << ") Invalid clientID"; } } else { - VSOMEIP_WARNING << "Client " << std::hex << std::setw(4) << std::setfill('0') + VSOMEIP_WARNING << "Client " << std::hex << std::setfill('0') << std::setw(4) << get_client() << " received another client identifier (" << _client << "). Ignoring it. (" << static_cast(state_.load()) << ")"; } @@ -3003,7 +3005,7 @@ void routing_manager_client::on_client_assign_ack(const client_t &_client) { void routing_manager_client::on_suspend() { VSOMEIP_INFO << __func__ << ": Application " - << std::hex << std::setw(4) << std::setfill('0') + << std::hex << std::setfill('0') << std::setw(4) << host_->get_client(); std::lock_guard its_lock(remote_subscriber_count_mutex_); diff --git a/implementation/routing/src/routing_manager_impl.cpp b/implementation/routing/src/routing_manager_impl.cpp index 9d45c656a..32c2b2061 100644 --- a/implementation/routing/src/routing_manager_impl.cpp +++ b/implementation/routing/src/routing_manager_impl.cpp @@ -222,7 +222,7 @@ void routing_manager_impl::start() { its_netmask_or_prefix << "prefix:" << configuration_->get_prefix(); VSOMEIP_INFO << "Client [" - << std::hex << std::setw(4) << std::setfill('0') + << std::hex << std::setfill('0') << std::setw(4) << get_client() << "] routes unicast:" << its_unicast.to_string() << ", " @@ -409,11 +409,11 @@ bool routing_manager_impl::offer_service(client_t _client, if (!insert_offer_command(_service, _instance, uint8_t(protocol::id_e::OFFER_SERVICE_ID), _client, _major, _minor)) { - VSOMEIP_INFO << "rmi::" << __func__ << " (" - << std::hex << std::setw(4) << std::setfill('0') << _client <<"): [" - << std::hex << std::setw(4) << std::setfill('0') << _service << "." - << std::hex << std::setw(4) << std::setfill('0') << _instance - << ":" << std::dec << int(_major) << "." << std::dec << _minor << "]" + VSOMEIP_INFO << "rmi::" << __func__ << std::hex << std::setfill('0') << " (" + << std::setw(4) << _client <<"): [" + << std::setw(4) << _service << "." + << std::setw(4) << _instance + << ":" << std::dec << int(_major) << "." << _minor << "]" << " (" << std::boolalpha << _must_queue << ")" << " not offering service, because insert_offer_command returned false!"; return false; @@ -437,12 +437,12 @@ bool routing_manager_impl::offer_service(client_t _client, if (!handle_local_offer_service(_client, _service, _instance, _major, _minor)) { erase_offer_command(_service, _instance); - VSOMEIP_INFO << __func__ << " (" - << std::hex << std::setw(4) << std::setfill('0') << _client <<"): [" - << std::hex << std::setw(4) << std::setfill('0') << _service << "." - << std::hex << std::setw(4) << std::setfill('0') << _instance - << ":" << std::dec << int(_major) << "." << std::dec << _minor << "]" - << " (" << std::boolalpha << _must_queue << ")" + VSOMEIP_INFO << "rmi::" << __func__ << std::hex << std::setfill('0') << " (" + << std::setw(4) << _client <<"): [" + << std::setw(4) << _service << "." + << std::setw(4) << _instance + << ":" << std::dec << int(_major) << "." << _minor << "]" + << " (" << std::boolalpha << _must_queue << ")" << " not offering, returned from handle_local_offer_service!"; return false; } @@ -491,12 +491,12 @@ bool routing_manager_impl::offer_service(client_t _client, erase_offer_command(_service, _instance); VSOMEIP_INFO << "OFFER(" - << std::hex << std::setw(4) << std::setfill('0') << _client <<"): [" - << std::hex << std::setw(4) << std::setfill('0') << _service << "." - << std::hex << std::setw(4) << std::setfill('0') << _instance - << ":" << std::dec << int(_major) << "." << std::dec << _minor << "]" - << " (" << std::boolalpha << _must_queue << ")"; - + << std::hex << std::setfill('0') + << std::setw(4) << _client << "): [" + << std::setw(4) << _service << "." + << std::setw(4) << _instance + << ":" << std::dec << int(_major) << "." << _minor << "]" + << " (" << std::boolalpha << _must_queue << ")"; return true; } @@ -525,9 +525,10 @@ void routing_manager_impl::stop_offer_service(client_t _client, uint8_t(protocol::id_e::STOP_OFFER_SERVICE_ID), _client, _major, _minor)) { VSOMEIP_INFO << "rmi::" << __func__ << " (" - << std::hex << std::setw(4) << std::setfill('0') << _client <<"): [" - << std::hex << std::setw(4) << std::setfill('0') << _service << "." - << std::hex << std::setw(4) << std::setfill('0') << _instance + << std::hex << std::setfill('0') + << std::setw(4) << _client <<"): [" + << std::setw(4) << _service << "." + << std::setw(4) << _instance << ":" << std::dec << int(_major) << "." << _minor << "]" << " (" << std::boolalpha << _must_queue << ")" << " STOP-OFFER NOT INSERTED!"; @@ -1464,9 +1465,10 @@ bool routing_manager_impl::stop_offer_service_remotely(service_t _service, // still offered its_copied_info->set_endpoint(std::shared_ptr(), !_reliable); discovery_->stop_offer_service(its_copied_info, true); - VSOMEIP_INFO << __func__ << " only sending the StopOffer to [" - << std::hex << std::setw(4) << std::setfill('0') << _service << '.' - << std::hex << std::setw(4) << std::setfill('0') << _instance << ']' + VSOMEIP_INFO << __func__ << std::hex << std::setfill('0') + << " only sending the StopOffer to [" + << std::setw(4) << _service << '.' + << std::setw(4) << _instance << ']' << " with reliability (" << std::boolalpha << !_reliable << ')' << " as the service is still partly offered!"; } @@ -1485,7 +1487,7 @@ void routing_manager_impl::on_message(const byte_t *_data, length_t _size, std::stringstream msg; msg << "rmi::on_message: "; for (uint32_t i = 0; i < _size; ++i) - msg << std::hex << std::setw(2) << std::setfill('0') << (int)_data[i] << " "; + msg << std::hex << std::setfill('0') << std::setw(2) << static_cast(_data[i]) << " "; VSOMEIP_INFO << msg.str(); #endif (void)_bound_client; @@ -1641,10 +1643,10 @@ bool routing_manager_impl::on_message(service_t _service, instance_t _instance, #if 0 std::stringstream msg; msg << "rmi::on_message(" - << std::hex << std::setw(4) << std::setfill('0') + << std::hex << std::setfill('0') << std::setw(4) << _service << ", " << _instance << "): "; for (uint32_t i = 0; i < _size; ++i) - msg << std::hex << std::setw(2) << std::setfill('0') << (int)_data[i] << " "; + msg << std::hex << std::setfill('0') << std::setw(2) << static_cast(_data[i]) << " "; VSOMEIP_INFO << msg.str(); #endif client_t its_client; @@ -2109,9 +2111,10 @@ bool routing_manager_impl::deliver_notification( if (has_subscribed_eventgroup(_service, _instance)) { if (!is_suppress_event(_service, _instance, its_event_id)) { VSOMEIP_WARNING << __func__ << ": Caching unregistered event [" - << std::hex << std::setw(4) << std::setfill('0') << _service << "." - << std::hex << std::setw(4) << std::setfill('0') << _instance << "." - << std::hex << std::setw(4) << std::setfill('0') << its_event_id << "]"; + << std::hex << std::setfill('0') + << std::setw(4) << _service << "." + << std::setw(4) << _instance << "." + << std::setw(4) << its_event_id << "]"; } routing_manager_base::register_event(host_->get_client(), @@ -2130,22 +2133,25 @@ bool routing_manager_impl::deliver_notification( its_event->set_payload(its_payload, true); } else VSOMEIP_ERROR << __func__ << ": Event registration failed [" - << std::hex << std::setw(4) << std::setfill('0') << _service << "." - << std::hex << std::setw(4) << std::setfill('0') << _instance << "." - << std::hex << std::setw(4) << std::setfill('0') << its_event_id << "]"; + << std::hex << std::setfill('0') + << std::setw(4) << _service << "." + << std::setw(4) << _instance << "." + << std::setw(4) << its_event_id << "]"; } else if (!is_suppress_event(_service, _instance, its_event_id)) { VSOMEIP_WARNING << __func__ << ": Dropping unregistered event [" - << std::hex << std::setw(4) << std::setfill('0') << _service << "." - << std::hex << std::setw(4) << std::setfill('0') << _instance << "." - << std::hex << std::setw(4) << std::setfill('0') << its_event_id << "] " + << std::hex << std::setfill('0') + << std::setw(4) << _service << "." + << std::setw(4) << _instance << "." + << std::setw(4) << its_event_id << "] " << "Service has no subscribed eventgroup."; } #else if (!is_suppress_event(_service, _instance, its_event_id)) { VSOMEIP_WARNING << __func__ << ": Event [" - << std::hex << std::setw(4) << std::setfill('0') << _service << "." - << std::hex << std::setw(4) << std::setfill('0') << _instance << "." - << std::hex << std::setw(4) << std::setfill('0') << its_event_id << "]" + << std::hex << std::setfill('0') + << std::setw(4) << _service << "." + << std::setw(4) << _instance << "." + << std::setw(4) << its_event_id << "]" << " is not registered. The message is dropped."; } #endif // VSOMEIP_ENABLE_DEFAULT_EVENT_CACHING @@ -2222,7 +2228,7 @@ services_t routing_manager_impl::get_offered_services() const { } } else { VSOMEIP_ERROR << __func__ << "Found instance with NULL ServiceInfo [" - << std::hex << std::setw(4) << std::setfill('0') << s.first + << std::hex << std::setfill('0') << std::setw(4) << s.first << ":" << i.first <<"]"; } } @@ -2804,9 +2810,10 @@ routing_manager_impl::expire_subscriptions( : its_info->get_remote_subscriptions()) { if (its_subscription->is_forwarded()) { VSOMEIP_WARNING << __func__ << ": New remote subscription replaced expired [" - << std::hex << std::setw(4) << std::setfill('0') << its_service.first << "." - << std::hex << std::setw(4) << std::setfill('0') << its_instance.first << "." - << std::hex << std::setw(4) << std::setfill('0') << its_eventgroup.first << "]"; + << std::hex << std::setfill('0') + << std::setw(4) << its_service.first << "." + << std::setw(4) << its_instance.first << "." + << std::setw(4) << its_eventgroup.first << "]"; continue; } @@ -3350,9 +3357,10 @@ routing_manager_impl::expire_subscriptions(bool _force) { continue; } else if (s->is_forwarded()) { VSOMEIP_WARNING << __func__ << ": New remote subscription replaced expired [" - << std::hex << std::setw(4) << std::setfill('0') << its_service.first << "." - << std::hex << std::setw(4) << std::setfill('0') << its_instance.first << "." - << std::hex << std::setw(4) << std::setfill('0') << its_eventgroup.first << "]"; + << std::hex << std::setfill('0') + << std::setw(4) << its_service.first << "." + << std::setw(4) << its_instance.first << "." + << std::setw(4) << its_eventgroup.first << "]"; continue; } for (auto its_client : s->get_clients()) { @@ -3590,9 +3598,10 @@ bool routing_manager_impl::handle_local_offer_service(client_t _client, service_ } } else { VSOMEIP_INFO << __func__ - << std::hex << std::setw(4) << std::setfill('0') << _client <<"): [" - << std::hex << std::setw(4) << std::setfill('0') << _service << "." - << std::hex << std::setw(4) << std::setfill('0') << _instance + << std::hex << std::setfill('0') + << std::setw(4) << _client <<"): [" + << std::setw(4) << _service << "." + << std::setw(4) << _instance << ":" << std::dec << int(_major) << "." << std::dec << _minor << "]" << " client already pinged!"; return false; @@ -3804,8 +3813,9 @@ void routing_manager_impl::set_routing_state(routing_state_e _routing_state) { // Inconsistency between services_ and local_services_ table detected // --> cleanup. VSOMEIP_WARNING << "rmi::" << __func__ << " Found table inconsistency for [" - << std::hex << std::setw(4) << std::setfill('0') << its_service.first << "." - << std::hex << std::setw(4) << std::setfill('0') << its_instance.first << "]"; + << std::hex << std::setfill('0') + << std::setw(4) << its_service.first << "." + << std::setw(4) << its_instance.first << "]"; // Remove the service from the offer_commands_ and prepare_stop_handlers_ to force the next offer to be processed offer_commands_.erase(std::make_pair(its_service.first, its_instance.first)); diff --git a/implementation/routing/src/routing_manager_stub.cpp b/implementation/routing/src/routing_manager_stub.cpp index a5c7ece86..d30607811 100644 --- a/implementation/routing/src/routing_manager_stub.cpp +++ b/implementation/routing/src/routing_manager_stub.cpp @@ -233,7 +233,7 @@ void routing_manager_stub::on_message(const byte_t *_data, length_t _size, std::stringstream msg; msg << "rms::on_message: "; for (length_t i = 0; i < _size; ++i) - msg << std::hex << std::setw(2) << std::setfill('0') << (int)_data[i] << " "; + msg << std::hex << std::setfill('0') << std::setw(2) << static_cast(_data[i] << " "; VSOMEIP_INFO << msg.str(); #endif @@ -277,10 +277,10 @@ void routing_manager_stub::on_message(const byte_t *_data, length_t _size, && _bound_client != its_client) { VSOMEIP_WARNING << "vSomeIP Security: routing_manager_stub::on_message: " << "Routing Manager received a message from client " - << std::hex << std::setw(4) << std::setfill('0') + << std::hex << std::setfill('0') << std::setw(4) << its_client << " with command " << (uint32_t)its_id << " which doesn't match the bound client " - << std::setw(4) << std::setfill('0') << _bound_client + << std::setw(4) << _bound_client << " ~> skip message!"; return; } @@ -326,7 +326,7 @@ void routing_manager_stub::on_message(const byte_t *_data, length_t _size, if (its_error == protocol::error_e::ERROR_OK) { on_pong(its_client); VSOMEIP_TRACE << "PONG(" - << std::hex << std::setw(4) << std::setfill('0') + << std::hex << std::setfill('0') << std::setw(4) << its_client << ")"; } else VSOMEIP_ERROR << __func__ @@ -694,9 +694,9 @@ void routing_manager_stub::on_message(const byte_t *_data, length_t _size, << std::setw(4) << its_service << "." << std::setw(4) << its_instance << "." << std::setw(4) << register_event.get_event() - << ":eventtype=" << std::dec << (int)register_event.get_event_type() + << ":eventtype=" << std::dec << static_cast(register_event.get_event_type()) << ":is_provided=" << std::boolalpha << register_event.is_provided() - << ":reliable=" << (int)register_event.get_reliability() << "]"; + << ":reliable=" << static_cast(register_event.get_reliability()) << "]"; } @@ -736,7 +736,7 @@ void routing_manager_stub::on_message(const byte_t *_data, length_t _size, if (its_error == protocol::error_e::ERROR_OK) { VSOMEIP_INFO << "REGISTERED_ACK(" - << std::hex << std::setw(4) << std::setfill('0') + << std::hex << std::setfill('0') << std::setw(4) << its_command.get_client() << ")"; } else VSOMEIP_ERROR << __func__ << ": registered ack deserialization failed (" @@ -764,7 +764,7 @@ void routing_manager_stub::on_message(const byte_t *_data, length_t _size, if (its_error == protocol::error_e::ERROR_OK) { host_->on_resend_provided_events_response(its_command.get_remote_offer_id()); VSOMEIP_INFO << "RESEND_PROVIDED_EVENTS(" - << std::hex << std::setw(4) << std::setfill('0') << its_client << ")"; + << std::hex << std::setfill('0') << std::setw(4) << its_client << ")"; } else VSOMEIP_ERROR << __func__ << ": resend provided events deserialization failed (" << std::dec << static_cast(its_error) << ")"; @@ -930,7 +930,7 @@ void routing_manager_stub::client_registration_func(void) { #if defined(__linux__) || defined(ANDROID) { std::stringstream s; - s << std::hex << std::setw(4) << std::setfill('0') + s << std::hex << std::setfill('0') << std::setw(4) << host_->get_client() << "_client_reg"; pthread_setname_np(pthread_self(),s.str().c_str()); } @@ -1142,7 +1142,7 @@ void routing_manager_stub::send_client_credentials(const client_t _target, std::stringstream msg; msg << "rms::send_credentials_info to (" << std::hex << _target << "): "; for (uint32_t i = 0; i < its_size; ++i) - msg << std::hex << std::setw(2) << std::setfill('0') << (int)its_command[i] << " "; + msg << std::hex << std::setfill('0') << std::setw(2) << static_cast(its_command[i] << " "; VSOMEIP_INFO << msg.str(); #endif @@ -1166,7 +1166,7 @@ void routing_manager_stub::send_client_credentials(const client_t _target, } else VSOMEIP_ERROR << __func__ << ": Sending credentials to client [" - << std::hex << std::setw(4) << std::setfill('0') + << std::hex << std::setfill('0') << std::setw(4) << _target << "] failed"; } @@ -1203,7 +1203,7 @@ void routing_manager_stub::send_client_routing_info(const client_t _target, } else VSOMEIP_ERROR << __func__ << ": Sending routing info to client [" - << std::hex << std::setw(4) << std::setfill('0') + << std::hex << std::setfill('0') << std::setw(4) << _target << "] failed"; } @@ -1530,7 +1530,7 @@ void routing_manager_stub::on_pong(client_t _client) { found_info->second.first = 0; } else { VSOMEIP_ERROR << "Received PONG from unregistered application: " - << std::hex << std::setw(4) << std::setfill('0') << _client; + << std::hex << std::setfill('0') << std::setw(4) << _client; } } remove_from_pinged_clients(_client); @@ -1573,7 +1573,7 @@ void routing_manager_stub::check_watchdog() { for (const auto& i : routing_info_) { if (i.first > 0 && i.first != host_->get_client()) { if (i.second.first > configuration_->get_allowed_missing_pongs()) { - VSOMEIP_WARNING << "Lost contact to application " << std::hex << (int)i.first; + VSOMEIP_WARNING << "Lost contact to application " << std::hex << static_cast(i.first); lost.push_back(i.first); } } @@ -2011,7 +2011,7 @@ void routing_manager_stub::on_client_id_timer_expired(boost::system::error_code } for (auto client : erroneous_clients) { VSOMEIP_WARNING << "Releasing client identifier " - << std::hex << std::setw(4) << std::setfill('0') << client << ". " + << std::hex << std::setfill('0') << std::setw(4) << client << ". " << "Its corresponding application went offline while no " << "routing manager was running."; host_->handle_client_error(client); @@ -2046,7 +2046,7 @@ bool routing_manager_stub::send_provided_event_resend_request( } else { VSOMEIP_WARNING << __func__ << " Couldn't send provided event resend " "request to local client: 0x" - << std::hex << std::setw(4) << std::setfill('0') << _client; + << std::hex << std::setfill('0') << std::setw(4) << _client; } return false; @@ -2156,7 +2156,7 @@ bool routing_manager_stub::send_cached_security_policies(client_t _client) { } else VSOMEIP_WARNING << __func__ << ": could not send cached security policies to registering client: 0x" - << std::hex << std::setw(4) << std::setfill('0') << _client; + << std::hex << std::setfill('0') << std::setw(4) << _client; return false; } @@ -2182,7 +2182,7 @@ bool routing_manager_stub::send_remove_security_policy_request( else VSOMEIP_ERROR << __func__ << ": cannot find local client endpoint for client " - << std::hex << std::setw(4) << std::setfill('0') + << std::hex << std::setfill('0') << std::setw(4) << _client; } else VSOMEIP_ERROR << __func__ diff --git a/implementation/runtime/src/application_impl.cpp b/implementation/runtime/src/application_impl.cpp index e632770ab..6a3627a84 100644 --- a/implementation/runtime/src/application_impl.cpp +++ b/implementation/runtime/src/application_impl.cpp @@ -237,7 +237,8 @@ bool application_impl::init() { } else { VSOMEIP_INFO << "+filter " << std::hex << std::setfill('0') - << std::setw(4) << prev_val << "." << std::setw(4) << val; + << std::setw(4) << prev_val << "." + << std::setw(4) << val; client_side_logging_filter_.insert(std::make_tuple(prev_val, val)); } val = 0xffffu; @@ -413,7 +414,7 @@ void application_impl::start() { stopped_ = false; stopped_called_ = false; VSOMEIP_INFO << "Starting vsomeip application \"" << name_ << "\" (" - << std::hex << std::setw(4) << std::setfill('0') << client_ + << std::hex << std::setfill('0') << std::setw(4) << client_ << ") using " << std::dec << io_thread_count << " threads" #if defined(__linux__) || defined(ANDROID) || defined(__QNX__) << " I/O nice " << io_thread_nice_level @@ -452,7 +453,7 @@ void application_impl::start() { for (size_t i = 0; i < io_thread_count - 1; i++) { auto its_thread = std::make_shared([this, i, io_thread_nice_level] { VSOMEIP_INFO << "io thread id from application: " - << std::hex << std::setw(4) << std::setfill('0') + << std::hex << std::setfill('0') << std::setw(4) << client_ << " (" << name_ << ") is: " << std::hex << std::this_thread::get_id() #if defined(__linux__) || defined(ANDROID) @@ -462,7 +463,7 @@ void application_impl::start() { #if defined(__linux__) || defined(ANDROID) { std::stringstream s; - s << std::hex << std::setw(4) << std::setfill('0') + s << std::hex << std::setfill('0') << std::setw(4) << client_ << "_io" << std::setw(2) << i+1; pthread_setname_np(pthread_self(),s.str().c_str()); } @@ -499,7 +500,7 @@ void application_impl::start() { app_counter__++; } VSOMEIP_INFO << "io thread id from application: " - << std::hex << std::setw(4) << std::setfill('0') << client_ << " (" + << std::hex << std::setfill('0') << std::setw(4) << client_ << " (" << name_ << ") is: " << std::this_thread::get_id() #if defined(__linux__) || defined(ANDROID) << " TID: " << std::dec << static_cast(syscall(SYS_gettid)) @@ -536,7 +537,7 @@ void application_impl::start() { void application_impl::stop() { VSOMEIP_INFO << "Stopping vsomeip application \"" << name_ << "\" (" - << std::hex << std::setw(4) << std::setfill('0') << client_ << ")."; + << std::hex << std::setfill('0') << std::setw(4) << client_ << ")."; bool block = true; { @@ -882,7 +883,7 @@ void application_impl::send(std::shared_ptr _message) { || (1 == client_side_logging_filter_.count(std::make_tuple(_message->get_service(), _message->get_instance()))))) { VSOMEIP_INFO << "application_impl::send: (" << std::hex << std::setfill('0') - << std::setw(4) << client_ << "): [" + << std::setw(4) << client_ <<"): [" << std::setw(4) << _message->get_service() << "." << std::setw(4) << _message->get_instance() << "." << std::setw(4) << _message->get_method() << ":" @@ -1825,14 +1826,14 @@ void application_impl::main_dispatch() { #if defined(__linux__) || defined(ANDROID) || defined(__QNX__) { std::stringstream s; - s << std::hex << std::setw(4) << std::setfill('0') + s << std::hex << std::setfill('0') << std::setw(4) << client_ << "_m_dispatch"; pthread_setname_np(pthread_self(),s.str().c_str()); } #endif const std::thread::id its_id = std::this_thread::get_id(); VSOMEIP_INFO << "main dispatch thread id from application: " - << std::hex << std::setw(4) << std::setfill('0') << client_ << " (" + << std::hex << std::setfill('0') << std::setw(4) << client_ << " (" << name_ << ") is: " << std::hex << its_id #if defined(__linux__) || defined(ANDROID) << " TID: " << std::dec << static_cast(syscall(SYS_gettid)) @@ -1878,14 +1879,14 @@ void application_impl::dispatch() { #if defined(__linux__) || defined(ANDROID) { std::stringstream s; - s << std::hex << std::setw(4) << std::setfill('0') + s << std::hex << std::setfill('0') << std::setw(4) << client_ << "_dispatch"; pthread_setname_np(pthread_self(),s.str().c_str()); } #endif const std::thread::id its_id = std::this_thread::get_id(); VSOMEIP_INFO << "dispatch thread id from application: " - << std::hex << std::setw(4) << std::setfill('0') << client_ << " (" + << std::hex << std::setfill('0') << std::setw(4) << client_ << " (" << name_ << ") is: " << std::hex << its_id #if defined(__linux__) || defined(ANDROID) << " TID: " << std::dec << static_cast(syscall(SYS_gettid)) @@ -2188,7 +2189,7 @@ void application_impl::clear_all_handler() { void application_impl::shutdown() { VSOMEIP_INFO << "shutdown thread id from application: " - << std::hex << std::setw(4) << std::setfill('0') << client_ << " (" + << std::hex << std::setfill('0') << std::setw(4) << client_ << " (" << name_ << ") is: " << std::hex << std::this_thread::get_id() #if defined(__linux__) || defined(ANDROID) << " TID: " << std::dec << static_cast(syscall(SYS_gettid)) @@ -2198,7 +2199,7 @@ void application_impl::shutdown() { boost::asio::detail::posix_signal_blocker blocker; { std::stringstream s; - s << std::hex << std::setw(4) << std::setfill('0') + s << std::hex << std::setfill('0') << std::setw(4) << client_ << "_shutdown"; pthread_setname_np(pthread_self(),s.str().c_str()); } @@ -2603,7 +2604,7 @@ void application_impl::print_blocking_call(const std::shared_ptr& break; case handler_type_e::STATE: VSOMEIP_WARNING << "BLOCKING CALL STATE(" - << std::hex << std::setw(4) << std::setfill('0') << get_client() << ")"; + << std::hex << std::setfill('0') << std::setw(4) << get_client() << ")"; break; case handler_type_e::SUBSCRIPTION: VSOMEIP_WARNING << "BLOCKING CALL SUBSCRIPTION(" @@ -2616,15 +2617,15 @@ void application_impl::print_blocking_call(const std::shared_ptr& break; case handler_type_e::OFFERED_SERVICES_INFO: VSOMEIP_WARNING << "BLOCKING CALL OFFERED_SERVICES_INFO(" - << std::hex << std::setw(4) << std::setfill('0') << get_client() << ")"; + << std::hex << std::setfill('0') << std::setw(4) << get_client() << ")"; break; case handler_type_e::WATCHDOG: VSOMEIP_WARNING << "BLOCKING CALL WATCHDOG(" - << std::hex << std::setw(4) << std::setfill('0') << get_client() << ")"; + << std::hex << std::setfill('0') << std::setw(4) << get_client() << ")"; break; case handler_type_e::UNKNOWN: VSOMEIP_WARNING << "BLOCKING CALL UNKNOWN(" - << std::hex << std::setw(4) << std::setfill('0') << get_client() << ")"; + << std::hex << std::setfill('0') << std::setw(4) << get_client() << ")"; break; } } diff --git a/implementation/service_discovery/src/service_discovery_impl.cpp b/implementation/service_discovery/src/service_discovery_impl.cpp index 768384b21..ae33b7506 100644 --- a/implementation/service_discovery/src/service_discovery_impl.cpp +++ b/implementation/service_discovery/src/service_discovery_impl.cpp @@ -1121,7 +1121,7 @@ service_discovery_impl::on_message( std::stringstream msg; msg << "sdi::on_message: "; for (length_t i = 0; i < _length; ++i) - msg << std::hex << std::setw(2) << std::setfill('0') << (int)_data[i] << " "; + msg << std::hex << std::setfill('0') << std::setw(2) << static_cast(_data[i]) << " "; VSOMEIP_INFO << msg.str(); #endif std::lock_guard its_lock(check_ttl_mutex_); @@ -1558,10 +1558,10 @@ void service_discovery_impl::process_offerservice_serviceentry( if (update_remote_offer_type(_service, _instance, offer_type, _reliable_address, _reliable_port, _unreliable_address, _unreliable_port, _received_via_multicast)) { - VSOMEIP_WARNING << __func__ << ": Remote offer type changed [" << std::hex << std::setw(4) - << std::setfill('0') << _service << "." << std::hex << std::setw(4) - << std::setfill('0') << _instance << "]"; - + VSOMEIP_WARNING << __func__ << ": Remote offer type changed [" + << std::hex << std::setfill('0') + << std::setw(4) << _service << "." + << std::setw(4) << _instance << "]"; // Only update eventgroup reliability type if it was initially unknown auto its_eventgroups = host_->get_subscribed_eventgroups(_service, _instance); for (auto eg : its_eventgroups) { @@ -1921,7 +1921,7 @@ service_discovery_impl::process_eventgroupentry( boost::system::error_code ec; VSOMEIP_ERROR << __func__ << ": Invalid return code in SOMEIP/SD header " << its_sender.to_string(ec) << " session: " - << std::hex << std::setw(4) << std::setfill('0') << its_session; + << std::hex << std::setfill('0') << std::setw(4) << its_session; if (its_ttl > 0) { insert_subscription_ack(_acknowledgement, its_info, 0, nullptr, its_clients); } @@ -1934,7 +1934,7 @@ service_discovery_impl::process_eventgroupentry( VSOMEIP_ERROR << __func__ << ": Received a SubscribeEventGroup entry on multicast address " << its_sender.to_string(ec) << " session: " - << std::hex << std::setw(4) << std::setfill('0') << its_session; + << std::hex << std::setfill('0') << std::setw(4) << its_session; if (its_ttl > 0) { insert_subscription_ack(_acknowledgement, its_info, 0, nullptr, its_clients); } @@ -1946,7 +1946,7 @@ service_discovery_impl::process_eventgroupentry( VSOMEIP_ERROR << __func__ << ": Invalid number of options in SubscribeEventGroup entry " << its_sender.to_string(ec) << " session: " - << std::hex << std::setw(4) << std::setfill('0') << its_session; + << std::hex << std::setfill('0') << std::setw(4) << its_session; if (its_ttl > 0) { // increase number of required acks by one as number required acks // is calculated based on the number of referenced options @@ -1959,7 +1959,7 @@ service_discovery_impl::process_eventgroupentry( VSOMEIP_ERROR << __func__ << ": Invalid options length in SOMEIP/SD message " << its_sender.to_string(ec) << " session: " - << std::hex << std::setw(4) << std::setfill('0') << its_session; + << std::hex << std::setfill('0') << std::setw(4) << its_session; if (its_ttl > 0) { insert_subscription_ack(_acknowledgement, its_info, 0, nullptr, its_clients); } @@ -1975,7 +1975,7 @@ service_discovery_impl::process_eventgroupentry( << "Fewer options in SOMEIP/SD message than " "referenced in EventGroup entry or malformed option received " << its_sender.to_string(ec) << " session: " - << std::hex << std::setw(4) << std::setfill('0') << its_session; + << std::hex << std::setfill('0') << std::setw(4) << its_session; if (its_ttl > 0) { // set to 0 to ensure an answer containing at least this subscribe_nack is sent out insert_subscription_ack(_acknowledgement, its_info, 0, nullptr, its_clients); @@ -1992,7 +1992,7 @@ service_discovery_impl::process_eventgroupentry( << "] bytes, is shorter than length of deserialized message: [" << static_cast(_entry->get_owning_message()->get_length()) << "] bytes. " << its_sender.to_string(ec) << " session: " - << std::hex << std::setw(4) << std::setfill('0') << its_session; + << std::hex << std::setfill('0') << std::setw(4) << its_session; return; } } @@ -2017,7 +2017,7 @@ service_discovery_impl::process_eventgroupentry( "option run number: " << i << " " << its_sender.to_string(ec) << " session: " - << std::hex << std::setw(4) << std::setfill('0') + << std::hex << std::setfill('0') << std::setw(4) << its_session; if (entry_type_e::SUBSCRIBE_EVENTGROUP == its_type && its_ttl > 0) { insert_subscription_ack(_acknowledgement, its_info, 0, nullptr, its_clients); @@ -2057,7 +2057,7 @@ service_discovery_impl::process_eventgroupentry( VSOMEIP_ERROR << __func__ << ": Multiple IPv4 endpoint options of same kind referenced! " << its_sender.to_string(ec) << " session: " - << std::hex << std::setw(4) << std::setfill('0') << its_session + << std::hex << std::setfill('0') << std::setw(4) << its_session << " is_first_reliable: " << is_first_reliable; return; } @@ -2071,7 +2071,7 @@ service_discovery_impl::process_eventgroupentry( VSOMEIP_ERROR << __func__ << ": Invalid port or IP address in first IPv4 endpoint option specified! " << its_sender.to_string(ec) << " session: " - << std::hex << std::setw(4) << std::setfill('0') << its_session; + << std::hex << std::setfill('0') << std::setw(4) << its_session; return; } } else @@ -2092,7 +2092,7 @@ service_discovery_impl::process_eventgroupentry( VSOMEIP_ERROR << __func__ << ": Multiple IPv4 endpoint options of same kind referenced! " << its_sender.to_string(ec) << " session: " - << std::hex << std::setw(4) << std::setfill('0') << its_session + << std::hex << std::setfill('0') << std::setw(4) << its_session << " is_second_reliable: " << is_second_reliable; return; } @@ -2106,7 +2106,7 @@ service_discovery_impl::process_eventgroupentry( VSOMEIP_ERROR << __func__ << ": Invalid port or IP address in second IPv4 endpoint option specified! " << its_sender.to_string(ec) << " session: " - << std::hex << std::setw(4) << std::setfill('0') << its_session; + << std::hex << std::setfill('0') << std::setw(4) << its_session; return; } } else { @@ -2117,7 +2117,7 @@ service_discovery_impl::process_eventgroupentry( VSOMEIP_ERROR << __func__ << ": Invalid eventgroup option (IPv4 Endpoint)" << its_sender.to_string(ec) << " session: " - << std::hex << std::setw(4) << std::setfill('0') << its_session; + << std::hex << std::setfill('0') << std::setw(4) << its_session; } break; } @@ -2136,7 +2136,7 @@ service_discovery_impl::process_eventgroupentry( boost::system::error_code ec; VSOMEIP_ERROR << "Invalid layer 4 protocol type in IPv6 endpoint option specified! " << its_sender.to_string(ec) << " session: " - << std::hex << std::setw(4) << std::setfill('0') << its_session; + << std::hex << std::setfill('0') << std::setw(4) << its_session; return; } @@ -2155,7 +2155,7 @@ service_discovery_impl::process_eventgroupentry( VSOMEIP_ERROR << __func__ << ": Multiple IPv6 endpoint options of same kind referenced! " << its_sender.to_string(ec) << " session: " - << std::hex << std::setw(4) << std::setfill('0') << its_session + << std::hex << std::setfill('0') << std::setw(4) << its_session << " is_first_reliable: " << is_first_reliable; return; } @@ -2187,7 +2187,7 @@ service_discovery_impl::process_eventgroupentry( VSOMEIP_ERROR << __func__ << ": Invalid eventgroup option (IPv6 Endpoint) " << its_sender.to_string(ec) << " session: " - << std::hex << std::setw(4) << std::setfill('0') << its_session; + << std::hex << std::setfill('0') << std::setw(4) << its_session; } break; } @@ -2217,7 +2217,7 @@ service_discovery_impl::process_eventgroupentry( VSOMEIP_ERROR << __func__ << ": Multiple IPv4 multicast options referenced! " << its_sender.to_string(ec) << " session: " - << std::hex << std::setw(4) << std::setfill('0') << its_session; + << std::hex << std::setfill('0') << std::setw(4) << its_session; return; } } else { @@ -2225,7 +2225,7 @@ service_discovery_impl::process_eventgroupentry( VSOMEIP_ERROR << __func__ << ": Invalid eventgroup option (IPv4 Multicast) " << its_sender.to_string(ec) << " session: " - << std::hex << std::setw(4) << std::setfill('0') << its_session; + << std::hex << std::setfill('0') << std::setw(4) << its_session; } break; case option_type_e::IP6_MULTICAST: @@ -2254,7 +2254,7 @@ service_discovery_impl::process_eventgroupentry( VSOMEIP_ERROR << __func__ << "Multiple IPv6 multicast options referenced! " << its_sender.to_string(ec) << " session: " - << std::hex << std::setw(4) << std::setfill('0') << its_session; + << std::hex << std::setfill('0') << std::setw(4) << its_session; return; } } else { @@ -2262,7 +2262,7 @@ service_discovery_impl::process_eventgroupentry( VSOMEIP_ERROR << __func__ << ": Invalid eventgroup option (IPv6 Multicast) " << its_sender.to_string(ec) << " session: " - << std::hex << std::setw(4) << std::setfill('0') << its_session; + << std::hex << std::setfill('0') << std::setw(4) << its_session; } break; case option_type_e::CONFIGURATION: { @@ -2283,7 +2283,7 @@ service_discovery_impl::process_eventgroupentry( << ": Unsupported eventgroup option [" << std::hex << static_cast(its_option->get_type()) << "] " << its_sender.to_string(ec) << " session: " - << std::hex << std::setw(4) << std::setfill('0') << its_session; + << std::hex << std::setfill('0') << std::setw(4) << its_session; if (its_ttl > 0) { insert_subscription_ack(_acknowledgement, its_info, 0, nullptr, its_clients); return; @@ -3651,9 +3651,11 @@ bool service_discovery_impl::update_remote_offer_type( break; case reliability_type_e::RT_UNKNOWN: default: - VSOMEIP_WARNING << __func__ << ": unknown offer type [" << std::hex << std::setw(4) - << std::setfill('0') << _service << "." << std::hex << std::setw(4) - << std::setfill('0') << _instance << "]" << static_cast(_offer_type); + VSOMEIP_WARNING << __func__ << ": unknown offer type [" + << std::hex << std::setfill('0') + << std::setw(4) << _service << "." + << std::setw(4) << _instance << "]" + << static_cast(_offer_type); break; } return ret; @@ -3770,9 +3772,11 @@ bool service_discovery_impl::set_offer_multicast_state( break; case reliability_type_e::RT_UNKNOWN: default: - VSOMEIP_WARNING << __func__ << ": unknown offer type [" << std::hex << std::setw(4) - << std::setfill('0') << _service << "." << std::hex << std::setw(4) - << std::setfill('0') << _instance << "]" << static_cast(_offer_type); + VSOMEIP_WARNING << __func__ << ": unknown offer type [" + << std::hex << std::setfill('0') + << std::setw(4) << _service << "." + << std::setw(4) << _instance << "]" + << static_cast(_offer_type); break; } diff --git a/implementation/utility/src/utility.cpp b/implementation/utility/src/utility.cpp index a274a4ce6..baa805a30 100644 --- a/implementation/utility/src/utility.cpp +++ b/implementation/utility/src/utility.cpp @@ -225,8 +225,8 @@ utility::request_client_id( } VSOMEIP_WARNING << "Requested client identifier " - << std::setw(4) << std::setfill('0') - << std::hex << _client + << std::hex << std::setfill('0') + << std::setw(4) << _client << " is already used by application \"" << its_iterator->second << "\"."; diff --git a/test/network_tests/application_tests/application_test_client.cpp b/test/network_tests/application_tests/application_test_client.cpp index ba05511a4..4f742af02 100644 --- a/test/network_tests/application_tests/application_test_client.cpp +++ b/test/network_tests/application_tests/application_test_client.cpp @@ -87,7 +87,7 @@ class application_test_client : public vsomeip_utilities::base_logger { void on_availability(vsomeip::service_t _service, vsomeip::instance_t _instance, bool _is_available) { - VSOMEIP_INFO << "[Client] Service [" << std::setw(4) << std::setfill('0') << std::hex + VSOMEIP_INFO << "[Client] Service [" << std::hex << std::setfill('0') << std::setw(4) << _service << "." << _instance << "] is " << (_is_available ? "available" : "not available") << "."; std::scoped_lock its_lock {mutex_}; @@ -105,9 +105,10 @@ class application_test_client : public vsomeip_utilities::base_logger { EXPECT_EQ(service_info_.service_id, _message->get_service()); EXPECT_EQ(service_info_.method_id, _message->get_method()); EXPECT_EQ(service_info_.instance_id, _message->get_instance()); - VSOMEIP_INFO << "[Client] Received a response with Client/Session [" << std::setfill('0') - << std::hex << std::setw(4) << _message->get_client() << "/" << std::setw(4) - << _message->get_session() << "]"; + VSOMEIP_INFO << "Received a response with Client/Session [" + << std::hex << std::setfill('0') + << std::setw(4) << _message->get_client() << "/" + << std::setw(4) << _message->get_session() << "]"; } void send() { diff --git a/test/network_tests/application_tests/application_test_client_availability.cpp b/test/network_tests/application_tests/application_test_client_availability.cpp index 96aa40521..1024c14de 100644 --- a/test/network_tests/application_tests/application_test_client_availability.cpp +++ b/test/network_tests/application_tests/application_test_client_availability.cpp @@ -69,10 +69,11 @@ class application_test_client_availability : public vsomeip_utilities::base_logg std::placeholders::_3, 16), service_info_.major_version, vsomeip::DEFAULT_MINOR); VSOMEIP_DEBUG << "Registering: " - << std::setw(4) << std::setfill('0') << std::hex << service_info_.service_id << "." - << std::setw(4) << std::setfill('0') << std::hex << service_info_.instance_id << "." - << std::setw(2) << std::setfill('0') << std::hex << (std::uint32_t)service_info_.service_id << "." - << std::setw(4) << std::setfill('0') << std::hex << vsomeip::DEFAULT_MINOR << "." + << std::hex << std::setfill('0') + << std::setw(4) << service_info_.service_id << "." + << std::setw(4) << service_info_.instance_id << "." + << std::setw(2) << (std::uint32_t)service_info_.service_id << "." + << std::setw(4) << vsomeip::DEFAULT_MINOR << "." << 16; app_->request_service(service_info_.service_id, service_info_.instance_id); @@ -105,8 +106,10 @@ class application_test_client_availability : public vsomeip_utilities::base_logg vsomeip::instance_t _instance, bool _is_available, std::uint32_t _handler_index) { - VSOMEIP_DEBUG<< "Service [" << std::setw(4) << std::setfill('0') << std::hex - << _service << "." << std::setw(4) << std::setfill('0') << _instance << "] is " + VSOMEIP_DEBUG<< "Service [" + << std::hex << std::setfill('0') + << std::setw(4) << _service << "." + << std::setw(4) << _instance << "] is " << (_is_available ? "available." : "NOT available.") << ". " << _handler_index; if(service_info_.service_id == _service @@ -136,17 +139,19 @@ class application_test_client_availability : public vsomeip_utilities::base_logg vsomeip::minor_version_t its_minor = (i & 0x1) ? service_info_.minor_version : vsomeip::ANY_MINOR; VSOMEIP_DEBUG << "Calling is_available: " - << std::setw(4) << std::setfill('0') << std::hex << its_service << "." - << std::setw(4) << std::setfill('0') << std::hex << its_instance << "." - << std::setw(2) << std::setfill('0') << std::hex << (std::uint32_t)its_major << "." - << std::setw(4) << std::setfill('0') << std::hex << its_minor; + << std::hex << std::setfill('0') + << std::setw(4) << its_service << "." + << std::setw(4) << its_instance << "." + << std::setw(2) << static_cast(its_major) << "." + << std::setw(4) << its_minor; EXPECT_TRUE(app_->is_available(its_service, its_instance, its_major, its_minor)); VSOMEIP_DEBUG << "Calling are_available: " - << std::setw(4) << std::setfill('0') << std::hex << its_service << "." - << std::setw(4) << std::setfill('0') << std::hex << its_instance << "." - << std::setw(2) << std::setfill('0') << std::hex << (std::uint32_t)its_major << "." - << std::setw(4) << std::setfill('0') << std::hex << its_minor; + << std::hex << std::setfill('0') + << std::setw(4) << its_service << "." + << std::setw(4) << its_instance << "." + << std::setw(2) << static_cast(its_major) << "." + << std::setw(4) << its_minor; vsomeip::application::available_t are_available; EXPECT_TRUE(app_->are_available(are_available, its_service, its_instance, its_major, its_minor)); bool found(false); diff --git a/test/network_tests/application_tests/application_test_service.cpp b/test/network_tests/application_tests/application_test_service.cpp index 873dc25fd..e93bb7348 100644 --- a/test/network_tests/application_tests/application_test_service.cpp +++ b/test/network_tests/application_tests/application_test_service.cpp @@ -86,10 +86,10 @@ class application_test_service : public vsomeip_utilities::base_logger { void on_request(const std::shared_ptr &_message) { app_->send(vsomeip::runtime::get()->create_response(_message)); - VSOMEIP_INFO << "[Service] Received a request with Client/Session [" << std::setw(4) - << std::setfill('0') << std::hex << _message->get_client() << "/" - << std::setw(4) << std::setfill('0') << std::hex << _message->get_session() - << "]"; + VSOMEIP_INFO << "[Service] Received a request with Client/Session [" + << std::hex << std::setfill('0') + << std::setw(4) << _message->get_client() << "/" + << std::setw(4) << _message->get_session() << "]"; } void on_shutdown_method_called(const std::shared_ptr &_message) { @@ -106,14 +106,14 @@ class application_test_service : public vsomeip_utilities::base_logger { } void run() { - VSOMEIP_DEBUG << "[Service] [" << std::setw(4) << std::setfill('0') << std::hex + VSOMEIP_DEBUG << "[Service] [" << std::hex << std::setfill('0') << std::setw(4) << service_info_.service_id << "] is running"; std::unique_lock its_lock(mutex_); while (wait_until_registered_ && !stop_called_) { condition_.wait_for(its_lock, std::chrono::milliseconds(100)); } - VSOMEIP_DEBUG << "[Service] [" << std::setw(4) << std::setfill('0') << std::hex + VSOMEIP_DEBUG << "[Service] [" << std::hex << std::setfill('0') << std::setw(4) << service_info_.service_id << "] is offering"; offer(); } diff --git a/test/network_tests/big_payload_tests/big_payload_test_client.cpp b/test/network_tests/big_payload_tests/big_payload_test_client.cpp index 396dae49f..792efb986 100644 --- a/test/network_tests/big_payload_tests/big_payload_test_client.cpp +++ b/test/network_tests/big_payload_tests/big_payload_test_client.cpp @@ -118,7 +118,7 @@ void big_payload_test_client::on_state(vsomeip::state_type_e _state) void big_payload_test_client::on_availability(vsomeip::service_t _service, vsomeip::instance_t _instance, bool _is_available) { - VSOMEIP_INFO << "Service [" << std::setw(4) << std::setfill('0') << std::hex + VSOMEIP_INFO << "Service [" << std::hex << std::setfill('0') << std::setw(4) << _service << "." << _instance << "] is " << (_is_available ? "available." : "NOT available."); @@ -139,14 +139,15 @@ void big_payload_test_client::on_availability(vsomeip::service_t _service, void big_payload_test_client::on_message(const std::shared_ptr& _response) { - VSOMEIP_INFO << "Received a response from Service [" << std::setw(4) - << std::setfill('0') << std::hex << _response->get_service() << "." - << std::setw(4) << std::setfill('0') << std::hex - << _response->get_instance() << "] to Client/Session [" - << std::setw(4) << std::setfill('0') << std::hex - << _response->get_client() << "/" << std::setw(4) - << std::setfill('0') << std::hex << _response->get_session() - << "] size: " << std::dec << _response->get_payload()->get_length(); + VSOMEIP_INFO << "Received a response from Service [" + << std::hex << std::setfill('0') + << std::setw(4) << _response->get_service() << "." + << std::setw(4) << _response->get_instance() + << "] to Client/Session [" + << std::setw(4) << _response->get_client() << "/" + << std::setw(4) << _response->get_session() + << "] size: " + << std::dec << _response->get_payload()->get_length(); static vsomeip::session_t last_session(0); ASSERT_GT(_response->get_session(), last_session); last_session = _response->get_session(); @@ -233,12 +234,13 @@ void big_payload_test_client::run() } its_payload->set_data(its_payload_data); request_->set_payload(its_payload); - VSOMEIP_INFO << "Client/Session [" << std::setw(4) << std::setfill('0') << std::hex - << request_->get_client() << "/" << std::setw(4) << std::setfill('0') - << std::hex << request_->get_session() - << "] is going to send a request to Service [" << std::setw(4) - << std::setfill('0') << std::hex << request_->get_service() << "." - << std::setw(4) << std::setfill('0') << std::hex << request_->get_instance() + VSOMEIP_INFO << "Client/Session [" + << std::hex << std::setfill('0') + << std::setw(4) << request_->get_client() << "/" + << std::setw(4) << request_->get_session() + << "] is going to send a request to Service [" + << std::setw(4) << request_->get_service() << "." + << std::setw(4) << request_->get_instance() << "] size: " << std::dec << request_->get_payload()->get_length() << ". Sent Messages: " << number_of_sent_messages_ + 1; app_->send(request_); diff --git a/test/network_tests/big_payload_tests/big_payload_test_service.cpp b/test/network_tests/big_payload_tests/big_payload_test_service.cpp index 31f1a0391..9ce1ca0a7 100644 --- a/test/network_tests/big_payload_tests/big_payload_test_service.cpp +++ b/test/network_tests/big_payload_tests/big_payload_test_service.cpp @@ -128,10 +128,9 @@ void big_payload_test_service::on_state(vsomeip::state_type_e _state) void big_payload_test_service::on_message(const std::shared_ptr& _request) { - VSOMEIP_INFO << "Received a message with Client/Session [" << std::setw(4) - << std::setfill('0') << std::hex << _request->get_client() << "/" - << std::setw(4) << std::setfill('0') << std::hex - << _request->get_session() << "] size: " << std::dec + VSOMEIP_INFO << "Received a message with Client/Session [" << std::hex + << std::setfill('0') << std::setw(4) << _request->get_client() << "/" + << std::setw(4) << _request->get_session() << "] size: " << std::dec << _request->get_payload()->get_length(); { std::lock_guard its_lock(mutex_); diff --git a/test/network_tests/client_id_tests/client_id_test_service.cpp b/test/network_tests/client_id_tests/client_id_test_service.cpp index 4eeb344e7..931bc6fbb 100644 --- a/test/network_tests/client_id_tests/client_id_test_service.cpp +++ b/test/network_tests/client_id_tests/client_id_test_service.cpp @@ -103,10 +103,9 @@ class client_id_test_service : public vsomeip_utilities::base_logger { vsomeip::instance_t _instance, bool _is_available) { if(_is_available) { VSOMEIP_INFO - << "[" << std::setw(4) << std::setfill('0') << std::hex - << service_info_.service_id << "] Service [" - << std::setw(4) << std::setfill('0') << std::hex << _service << "." << _instance - << "] is " + << std::hex << std::setfill('0') << "[" + << std::setw(4) << service_info_.service_id << "] Service [" + << std::setw(4) << _service << "." << _instance << "] is " << (_is_available ? "available." : "NOT available."); auto its_service = other_services_available_.find(std::make_pair(_service, _instance)); @@ -129,12 +128,11 @@ class client_id_test_service : public vsomeip_utilities::base_logger { void on_request(const std::shared_ptr &_message) { if(_message->get_message_type() == vsomeip::message_type_e::MT_REQUEST) { VSOMEIP_DEBUG - << "[" << std::setw(4) << std::setfill('0') << std::hex - << service_info_.service_id - << "] Received a request with Client/Session [" << std::setw(4) - << std::setfill('0') << std::hex << _message->get_client() << "/" - << std::setw(4) << std::setfill('0') << std::hex - << _message->get_session() << "]"; + << std::hex << std::setfill('0') << "[" + << std::setw(4) << service_info_.service_id + << "] Received a request with Client/Session [" + << std::setw(4) << _message->get_client() << "/" + << std::setw(4) << _message->get_session() << "]"; std::shared_ptr its_response = vsomeip::runtime::get() ->create_response(_message); app_->send(its_response); @@ -151,15 +149,13 @@ class client_id_test_service : public vsomeip_utilities::base_logger { void on_response(const std::shared_ptr &_message) { if(_message->get_message_type() == vsomeip::message_type_e::MT_RESPONSE) { VSOMEIP_DEBUG - << "[" << std::setw(4) << std::setfill('0') << std::hex - << service_info_.service_id - << "] Received a response with Client/Session [" << std::setw(4) - << std::setfill('0') << std::hex << _message->get_client() << "/" - << std::setw(4) << std::setfill('0') << std::hex - << _message->get_session() << "] from Service/Method [" - << std::setw(4) << std::setfill('0') << std::hex - << _message->get_service() << "/" << std::setw(4) << std::setfill('0') - << std::hex << _message->get_method() << "]"; + << std::hex << std::setfill('0') << "[" + << std::setw(4) << service_info_.service_id + << "] Received a response with Client/Session [" + << std::setw(4) << _message->get_client() << "/" + << std::setw(4) << _message->get_session() << "] from Service/Method [" + << std::setw(4) << _message->get_service() << "/" + << std::setw(4) << _message->get_method() << "]"; other_services_received_response_[std::make_pair(_message->get_service(), _message->get_method())]++; @@ -193,7 +189,7 @@ class client_id_test_service : public vsomeip_utilities::base_logger { } blocked_ = false; - VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex + VSOMEIP_DEBUG << "[" << std::hex << std::setfill('0') << std::setw(4) << service_info_.service_id << "] Offering"; offer(); @@ -203,7 +199,7 @@ class client_id_test_service : public vsomeip_utilities::base_logger { } blocked_ = false; - VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex + VSOMEIP_DEBUG << "[" << std::hex << std::setfill('0') << std::setw(4) << service_info_.service_id << "] Sending"; // send a message to all other services for (int var = 0; var < client_id_test::messages_to_send; ++var) { @@ -218,12 +214,12 @@ class client_id_test_service : public vsomeip_utilities::base_logger { msg->set_instance(i.instance_id); msg->set_method(i.method_id); app_->send(msg); - VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') - << std::hex << service_info_.service_id + VSOMEIP_DEBUG << "[" + << std::hex << std::setfill('0') + << std::setw(4) << service_info_.service_id << "] Sending a request to Service/Method [" - << std::setw(4) << std::setfill('0') << std::hex - << i.service_id << "/" << std::setw(4) << std::setfill('0') - << std::hex << i.instance_id << "]"; + << std::setw(4) << i.service_id << "/" + << std::setw(4) << i.instance_id << "]"; } } @@ -238,7 +234,7 @@ class client_id_test_service : public vsomeip_utilities::base_logger { while (!stopped_) { stop_condition_.wait(its_lock); } - VSOMEIP_INFO << "[" << std::setw(4) << std::setfill('0') << std::hex + VSOMEIP_INFO << "[" << std::hex << std::setfill('0') << std::setw(4) << service_info_.service_id << "] Received responses and requests from all other services, going down"; diff --git a/test/network_tests/cpu_load_tests/cpu_load_test_client.cpp b/test/network_tests/cpu_load_tests/cpu_load_test_client.cpp index 0730d37e1..a62af98c1 100644 --- a/test/network_tests/cpu_load_tests/cpu_load_test_client.cpp +++ b/test/network_tests/cpu_load_tests/cpu_load_test_client.cpp @@ -112,8 +112,8 @@ class cpu_load_test_client void on_availability(vsomeip::service_t _service, vsomeip::instance_t _instance, bool _is_available) { - VSOMEIP_INFO << "Service [" << std::setw(4) << std::setfill('0') - << std::hex << _service << "." << _instance << "] is " + VSOMEIP_INFO << "Service [" << std::hex << std::setfill('0') + << std::setw(4) << _service << "." << _instance << "] is " << (_is_available ? "available." : "NOT available."); if (cpu_load_test::service_id == _service @@ -228,7 +228,7 @@ class cpu_load_test_client } c.stop(); send_service_start_measuring(false); - VSOMEIP_DEBUG << "Synchronously sent " << std::setw(4) << std::setfill('0') + VSOMEIP_DEBUG << "Synchronously sent " << std::setfill('0') << std::setw(4) << number_of_sent_messages_ << " messages. CPU load [%]: " << std::fixed << std::setprecision(2) << (std::isfinite(c.get_cpu_load()) ? c.get_cpu_load() : 0.0); diff --git a/test/network_tests/debounce_callback_tests/debounce_callback_test_client.cpp b/test/network_tests/debounce_callback_tests/debounce_callback_test_client.cpp index 8ba0df5df..7bae85f12 100644 --- a/test/network_tests/debounce_callback_tests/debounce_callback_test_client.cpp +++ b/test/network_tests/debounce_callback_tests/debounce_callback_test_client.cpp @@ -117,7 +117,7 @@ void debounce_test_client::on_message(const std::shared_ptr& _ std::stringstream s; s << "RECV: "; for (uint32_t i = 0; i < _message->get_payload()->get_length(); i++) { - s << std::hex << std::setw(2) << std::setfill('0') + s << std::hex << std::setfill('0') << std::setw(2) << static_cast(_message->get_payload()->get_data()[i]) << ' '; } VSOMEIP_DEBUG << s.str(); diff --git a/test/network_tests/debounce_filter_tests/debounce_filter_test_client.cpp b/test/network_tests/debounce_filter_tests/debounce_filter_test_client.cpp index 4cc33a412..ea08b2677 100644 --- a/test/network_tests/debounce_filter_tests/debounce_filter_test_client.cpp +++ b/test/network_tests/debounce_filter_tests/debounce_filter_test_client.cpp @@ -114,7 +114,7 @@ void debounce_test_client::on_message(const std::shared_ptr& _ std::stringstream s; s << "RECV: "; for (uint32_t i = 0; i < _message->get_payload()->get_length(); i++) { - s << std::hex << std::setw(3) << std::setfill('0') + s << std::hex << std::setfill('0') << std::setw(3) << static_cast(_message->get_payload()->get_data()[i]) << " "; } diff --git a/test/network_tests/debounce_frequency_tests/debounce_frequency_test_client.cpp b/test/network_tests/debounce_frequency_tests/debounce_frequency_test_client.cpp index 4467b10fe..28617d170 100644 --- a/test/network_tests/debounce_frequency_tests/debounce_frequency_test_client.cpp +++ b/test/network_tests/debounce_frequency_tests/debounce_frequency_test_client.cpp @@ -25,7 +25,7 @@ void test_client::on_message(const std::shared_ptr& _message) std::stringstream s; s << "RECV: "; for (uint32_t i = 0; i < _message->get_payload()->get_length(); i++) { - s << std::hex << std::setw(2) << std::setfill('0') + s << std::hex << std::setfill('0') << std::setw(2) << static_cast(_message->get_payload()->get_data()[i]) << " "; } VSOMEIP_DEBUG << s.str(); diff --git a/test/network_tests/debounce_tests/debounce_test_client.cpp b/test/network_tests/debounce_tests/debounce_test_client.cpp index 7ad2b6067..c10354557 100644 --- a/test/network_tests/debounce_tests/debounce_test_client.cpp +++ b/test/network_tests/debounce_tests/debounce_test_client.cpp @@ -122,7 +122,7 @@ void debounce_test_client::on_message(const std::shared_ptr& _ std::stringstream s; s << "RECV: "; for (uint32_t i = 0; i < _message->get_payload()->get_length(); i++) { - s << std::hex << std::setw(2) << std::setfill('0') + s << std::hex << std::setfill('0') << std::setw(2) << static_cast(_message->get_payload()->get_data()[i]) << " "; } VSOMEIP_DEBUG << s.str(); diff --git a/test/network_tests/e2e_tests/e2e_profile_04_test_client.cpp b/test/network_tests/e2e_tests/e2e_profile_04_test_client.cpp index f97f038ab..c708af726 100644 --- a/test/network_tests/e2e_tests/e2e_profile_04_test_client.cpp +++ b/test/network_tests/e2e_tests/e2e_profile_04_test_client.cpp @@ -86,7 +86,7 @@ e2e_profile_04_test_client::on_availability( bool _is_available) { VSOMEIP_INFO << __func__ << ": Client " - << std::hex << std::setw(4) << std::setfill('0') + << std::hex << std::setfill('0') << std::setw(4) << app_->get_client() << " : Service [" << _service << "." << _instance << "] is " << (_is_available ? "available." : "NOT available."); @@ -117,7 +117,7 @@ void e2e_profile_04_test_client::on_message(const std::shared_ptr &_message) { VSOMEIP_INFO << __func__ << ": Received a message from Service [" - << std::setw(4) << std::setfill('0') << std::hex + << std::hex << std::setfill('0') << std::setw(4) << _message->get_service() << "." << _message->get_instance() << "] to Client/Session [" << _message->get_client() << "/" << _message->get_session() @@ -165,7 +165,7 @@ e2e_profile_04_test_client::on_message(const std::shared_ptr & received_++; if (received_ == PROFILE_O4_NUM_MESSAGES * 2) { VSOMEIP_WARNING << __func__ << ": Client" - << std::setw(4) << std::setfill('0') << std::hex + << std::hex << std::setfill('0') << std::setw(4) << app_->get_client() << " received all messages ~> going down!"; } diff --git a/test/network_tests/e2e_tests/e2e_profile_04_test_service.cpp b/test/network_tests/e2e_tests/e2e_profile_04_test_service.cpp index acf34779b..f02f51745 100644 --- a/test/network_tests/e2e_tests/e2e_profile_04_test_service.cpp +++ b/test/network_tests/e2e_tests/e2e_profile_04_test_service.cpp @@ -143,7 +143,7 @@ e2e_profile_04_test_service::on_message( ASSERT_EQ(PROFILE_04_INSTANCE, _request->get_instance()); VSOMEIP_INFO << "Received a message with Client/Session [" - << std::setw(4) << std::setfill('0') << std::hex + << std::hex << std::setfill('0') << std::setw(4) << _request->get_client() << "/" << _request->get_session() << "] method: " << _request->get_method() ; diff --git a/test/network_tests/e2e_tests/e2e_profile_07_test_client.cpp b/test/network_tests/e2e_tests/e2e_profile_07_test_client.cpp index 58faa3ec6..2781d557b 100644 --- a/test/network_tests/e2e_tests/e2e_profile_07_test_client.cpp +++ b/test/network_tests/e2e_tests/e2e_profile_07_test_client.cpp @@ -86,7 +86,7 @@ e2e_profile_07_test_client::on_availability( bool _is_available) { VSOMEIP_INFO << __func__ << ": Client " - << std::hex << std::setw(4) << std::setfill('0') + << std::hex << std::setfill('0') << std::setw(4) << app_->get_client() << " : Service [" << _service << "." << _instance << "] is " << (_is_available ? "available." : "NOT available."); @@ -117,7 +117,7 @@ void e2e_profile_07_test_client::on_message(const std::shared_ptr &_message) { VSOMEIP_INFO << __func__ << ": Received a message from Service [" - << std::setw(4) << std::setfill('0') << std::hex + << std::hex << std::setfill('0') << std::setw(4) << _message->get_service() << "." << _message->get_instance() << "] to Client/Session [" << _message->get_client() << "/" << _message->get_session() @@ -165,7 +165,7 @@ e2e_profile_07_test_client::on_message(const std::shared_ptr & received_++; if (received_ == PROFILE_07_NUM_MESSAGES * 2) { VSOMEIP_WARNING << __func__ << ": Client" - << std::setw(4) << std::setfill('0') << std::hex + << std::hex << std::setfill('0') << std::setw(4) << app_->get_client() << " received all messages ~> going down!"; } diff --git a/test/network_tests/e2e_tests/e2e_profile_07_test_service.cpp b/test/network_tests/e2e_tests/e2e_profile_07_test_service.cpp index 5e2a09293..b43b2830d 100644 --- a/test/network_tests/e2e_tests/e2e_profile_07_test_service.cpp +++ b/test/network_tests/e2e_tests/e2e_profile_07_test_service.cpp @@ -143,7 +143,7 @@ e2e_profile_07_test_service::on_message( ASSERT_EQ(PROFILE_07_INSTANCE, _request->get_instance()); VSOMEIP_INFO << "Received a message with Client/Session [" - << std::setw(4) << std::setfill('0') << std::hex + << std::hex << std::setfill('0') << std::setw(4) << _request->get_client() << "/" << _request->get_session() << "] method: " << _request->get_method() ; diff --git a/test/network_tests/e2e_tests/e2e_test_client.cpp b/test/network_tests/e2e_tests/e2e_test_client.cpp index 9e270cca2..9bc3c4482 100644 --- a/test/network_tests/e2e_tests/e2e_test_client.cpp +++ b/test/network_tests/e2e_tests/e2e_test_client.cpp @@ -93,7 +93,7 @@ void e2e_test_client::on_availability(vsomeip::service_t _service, vsomeip::instance_t _instance, bool _is_available) { VSOMEIP_INFO << std::hex << "Client 0x" << app_->get_client() - << " : Service [" << std::setw(4) << std::setfill('0') << std::hex + << " : Service [" << std::setfill('0') << std::setw(4) << _service << "." << _instance << "] is " << (_is_available ? "available." : "NOT available."); @@ -122,13 +122,11 @@ void e2e_test_client::on_availability(vsomeip::service_t _service, void e2e_test_client::on_message(const std::shared_ptr &_response) { VSOMEIP_INFO << "Received a response from Service [" - << std::setw(4) << std::setfill('0') << std::hex << _response->get_service() - << "." - << std::setw(4) << std::setfill('0') << std::hex << _response->get_instance() - << "] to Client/Session [" - << std::setw(4) << std::setfill('0') << std::hex << _response->get_client() - << "/" - << std::setw(4) << std::setfill('0') << std::hex << _response->get_session() + << std::hex << std::setfill('0') + << std::setw(4) << _response->get_service() << "." + << std::setw(4) << _response->get_instance() << "] to Client/Session [" + << std::setw(4) << _response->get_client() << "/" + << std::setw(4) << _response->get_session() << "]"; EXPECT_EQ(vsomeip_test::TEST_SERVICE_SERVICE_ID, _response->get_service()); EXPECT_EQ(vsomeip_test::TEST_SERVICE_INSTANCE_ID, _response->get_instance()); diff --git a/test/network_tests/e2e_tests/e2e_test_service.cpp b/test/network_tests/e2e_tests/e2e_test_service.cpp index 164716700..6d8b5df56 100644 --- a/test/network_tests/e2e_tests/e2e_test_service.cpp +++ b/test/network_tests/e2e_tests/e2e_test_service.cpp @@ -144,10 +144,11 @@ void e2e_test_service::on_message(const std::shared_ptr& _requ ASSERT_EQ(vsomeip_test::TEST_SERVICE_SERVICE_ID, _request->get_service()); ASSERT_EQ(vsomeip_test::TEST_SERVICE_INSTANCE_ID, _request->get_instance()); - VSOMEIP_INFO << "Received a message with Client/Session [" << std::setw(4) - << std::setfill('0') << std::hex << _request->get_client() << "/" - << std::setw(4) << std::setfill('0') << std::hex - << _request->get_session() << "] method: " << _request->get_method() ; + VSOMEIP_INFO << "Received a message with Client/Session [" + << std::hex << std::setfill('0') + << std::setw(4) << _request->get_client() << "/" + << std::setw(4) << _request->get_session() << "] method: " + << std::setw(4) << _request->get_method() ; std::shared_ptr its_response = vsomeip::runtime::get()->create_response(_request); diff --git a/test/network_tests/event_tests/event_test_client.cpp b/test/network_tests/event_tests/event_test_client.cpp index 9feb68684..7ad9f5ad7 100644 --- a/test/network_tests/event_tests/event_test_client.cpp +++ b/test/network_tests/event_tests/event_test_client.cpp @@ -99,8 +99,8 @@ class event_test_client : public vsomeip_utilities::base_logger { void on_availability(vsomeip::service_t _service, vsomeip::instance_t _instance, bool _is_available) { - VSOMEIP_INFO << "Service [" << std::setw(4) - << std::setfill('0') << std::hex << _service << "." << _instance + VSOMEIP_INFO << "Service [" << std::hex << std::setfill('0') + << std::setw(4) << _service << "." << _instance << "] is " << (_is_available ? "available":"not available") << "."; if (_is_available) { std::lock_guard its_lock(mutex_); @@ -136,13 +136,12 @@ class event_test_client : public vsomeip_utilities::base_logger { } VSOMEIP_DEBUG - << "Received a notification with Client/Session [" << std::setw(4) - << std::setfill('0') << std::hex << _message->get_client() << "/" - << std::setw(4) << std::setfill('0') << std::hex - << _message->get_session() << "] from Service/Method [" - << std::setw(4) << std::setfill('0') << std::hex - << _message->get_service() << "/" << std::setw(4) << std::setfill('0') - << std::hex << _message->get_method() << "]"; + << "Received a notification with Client/Session [" + << std::hex << std::setfill('0') + << std::setw(4) << _message->get_client() << "/" + << std::setw(4) << _message->get_session() << "] from Service/Method [" + << std::setw(4) << _message->get_service() << "/" + << std::setw(4) << _message->get_method() << "]"; } diff --git a/test/network_tests/event_tests/event_test_service.cpp b/test/network_tests/event_tests/event_test_service.cpp index 5f7099ffb..3ab77f1ff 100644 --- a/test/network_tests/event_tests/event_test_service.cpp +++ b/test/network_tests/event_tests/event_test_service.cpp @@ -117,14 +117,14 @@ class event_test_service : public vsomeip_utilities::base_logger { } void run() { - VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex + VSOMEIP_DEBUG << "[" << std::hex << std::setfill('0') << std::setw(4) << service_info_.service_id << "] Running"; std::unique_lock its_lock(mutex_); while (wait_until_registered_) { condition_.wait(its_lock); } - VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex + VSOMEIP_DEBUG << "[" << std::hex << std::setfill('0') << std::setw(4) << service_info_.service_id << "] Offering"; offer(); diff --git a/test/network_tests/header_factory_tests/header_factory_test_client.cpp b/test/network_tests/header_factory_tests/header_factory_test_client.cpp index 59395ee66..aacac130d 100644 --- a/test/network_tests/header_factory_tests/header_factory_test_client.cpp +++ b/test/network_tests/header_factory_tests/header_factory_test_client.cpp @@ -74,7 +74,7 @@ void header_factory_test_client::on_state(vsomeip::state_type_e _state) void header_factory_test_client::on_availability(vsomeip::service_t _service, vsomeip::instance_t _instance, bool _is_available) { - VSOMEIP_INFO << "Service [" << std::setw(4) << std::setfill('0') << std::hex + VSOMEIP_INFO << "Service [" << std::hex << std::setfill('0') << std::setw(4) << _service << "." << _instance << "] is " << (_is_available ? "available." : "NOT available."); @@ -95,13 +95,12 @@ void header_factory_test_client::on_availability(vsomeip::service_t _service, void header_factory_test_client::on_message(const std::shared_ptr& _response) { - VSOMEIP_INFO << "Received a response from Service [" << std::setw(4) - << std::setfill('0') << std::hex << _response->get_service() << "." - << std::setw(4) << std::setfill('0') << std::hex - << _response->get_instance() << "] to Client/Session [" - << std::setw(4) << std::setfill('0') << std::hex - << _response->get_client() << "/" << std::setw(4) - << std::setfill('0') << std::hex << _response->get_session() << "]"; + VSOMEIP_INFO << "Received a response from Service [" + << std::hex << std::setfill('0') + << std::setw(4) << _response->get_service() << "." + << std::setw(4) << _response->get_instance() << "] to Client/Session [" + << std::setw(4) << _response->get_client() << "/" + << std::setw(4) << _response->get_session() << "]"; number_of_acknowledged_messages_++; ASSERT_EQ(_response->get_service(), vsomeip_test::TEST_SERVICE_SERVICE_ID); ASSERT_EQ(_response->get_instance(), vsomeip_test::TEST_SERVICE_INSTANCE_ID); @@ -136,13 +135,13 @@ void header_factory_test_client::run() for (uint32_t i = 0; i < number_of_messages_to_send_; i++) { app_->send(request_); - VSOMEIP_INFO << "Client/Session [" << std::setw(4) << std::setfill('0') - << std::hex << request_->get_client() << "/" << std::setw(4) - << std::setfill('0') << std::hex << request_->get_session() - << "] sent a request to Service [" << std::setw(4) - << std::setfill('0') << std::hex << request_->get_service() - << "." << std::setw(4) << std::setfill('0') << std::hex - << request_->get_instance() << "]"; + VSOMEIP_INFO << "Client/Session [" + << std::hex << std::setfill('0') + << std::setw(4) << request_->get_client() << "/" + << std::setw(4) << request_->get_session() + << "] sent a request to Service [" + << std::setw(4) << request_->get_service()<< "." + << std::setw(4) << request_->get_instance() << "]"; number_of_sent_messages_++; } // wait until all messages have been acknowledged diff --git a/test/network_tests/header_factory_tests/header_factory_test_service.cpp b/test/network_tests/header_factory_tests/header_factory_test_service.cpp index 8f7255fe8..11eae29b7 100644 --- a/test/network_tests/header_factory_tests/header_factory_test_service.cpp +++ b/test/network_tests/header_factory_tests/header_factory_test_service.cpp @@ -96,10 +96,10 @@ void header_factory_test_service::on_state(vsomeip::state_type_e _state) void header_factory_test_service::on_message(const std::shared_ptr& _request) { - VSOMEIP_INFO << "Received a message with Client/Session [" << std::setw(4) - << std::setfill('0') << std::hex << _request->get_client() << "/" - << std::setw(4) << std::setfill('0') << std::hex - << _request->get_session() << "]"; + VSOMEIP_INFO << "Received a message with Client/Session [" + << std::hex << std::setfill('0') + << std::setw(4) << _request->get_client() << "/" + << std::setw(4) << _request->get_session() << "]"; number_of_received_messages_++; diff --git a/test/network_tests/initial_event_tests/initial_event_test_availability_checker.cpp b/test/network_tests/initial_event_tests/initial_event_test_availability_checker.cpp index cbe76c2f7..03444c2fd 100644 --- a/test/network_tests/initial_event_tests/initial_event_test_availability_checker.cpp +++ b/test/network_tests/initial_event_tests/initial_event_test_availability_checker.cpp @@ -79,10 +79,11 @@ class initial_event_test_availability_checker : public vsomeip_utilities::base_l if(its_service != other_services_available_.end()) { if(its_service->second != _is_available) { its_service->second = true; - VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex - << client_number_ << "] Service [" - << std::setw(4) << std::setfill('0') << std::hex << _service << "." << _instance - << "] is available."; + VSOMEIP_DEBUG << "[" + << std::hex << std::setfill('0') + << std::setw(4) << client_number_ << "] Service [" + << std::setw(4) << _service << "." << _instance + << "] is available."; } } @@ -105,7 +106,7 @@ class initial_event_test_availability_checker : public vsomeip_utilities::base_l while (wait_for_stop_) { stop_condition_.wait(its_lock); } - VSOMEIP_INFO << "[" << std::setw(4) << std::setfill('0') << std::hex + VSOMEIP_INFO << "[" << std::hex << std::setfill('0') << std::setw(4) << client_number_ << "] all services are available. Going down"; app_->clear_all_handler(); app_->stop(); diff --git a/test/network_tests/initial_event_tests/initial_event_test_service.cpp b/test/network_tests/initial_event_tests/initial_event_test_service.cpp index a1cd03e78..22ec9791e 100644 --- a/test/network_tests/initial_event_tests/initial_event_test_service.cpp +++ b/test/network_tests/initial_event_tests/initial_event_test_service.cpp @@ -94,14 +94,14 @@ class initial_event_test_service : public vsomeip_utilities::base_logger { } void run() { - VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex + VSOMEIP_DEBUG << "[" << std::hex << std::setfill('0') << std::setw(4) << service_info_.service_id << "] Running"; std::unique_lock its_lock(mutex_); while (wait_until_registered_) { condition_.wait(its_lock); } - VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex + VSOMEIP_DEBUG << "[" << std::hex << std::setfill('0') << std::setw(4) << service_info_.service_id << "] Offering"; offer(); } diff --git a/test/network_tests/initial_event_tests/initial_event_test_stop_service.cpp b/test/network_tests/initial_event_tests/initial_event_test_stop_service.cpp index 3e5bfd222..0696a75f9 100644 --- a/test/network_tests/initial_event_tests/initial_event_test_stop_service.cpp +++ b/test/network_tests/initial_event_tests/initial_event_test_stop_service.cpp @@ -124,9 +124,9 @@ class initial_event_test_stop_service : public vsomeip_utilities::base_logger { vsomeip::instance_t _instance, bool _is_available) { bool notify(false); if(_is_available) { - VSOMEIP_INFO << "[" << std::setw(4) << std::setfill('0') << std::hex - << service_info_.service_id << "] Service [" - << std::setw(4) << std::setfill('0') << std::hex << _service + VSOMEIP_INFO << "[" << std::hex << std::setfill('0') + << std::setw(4) << service_info_.service_id << "] Service [" + << std::setw(4) << _service << "." << _instance << "] is available."; if(is_master_) { if(_service == initial_event_test::stop_service_slave.service_id @@ -149,10 +149,10 @@ class initial_event_test_stop_service : public vsomeip_utilities::base_logger { void on_shutdown_method_called(const std::shared_ptr &_message) { if(_message->get_message_type() == vsomeip::message_type_e::MT_REQUEST_NO_RETURN) { - VSOMEIP_DEBUG << "Received a request with Client/Session [" << std::setw(4) - << std::setfill('0') << std::hex << _message->get_client() << "/" - << std::setw(4) << std::setfill('0') << std::hex - << _message->get_session() << "] shutdown method called"; + VSOMEIP_DEBUG << "Received a request with Client/Session [" + << std::hex << std::setfill('0') + << std::setw(4) << _message->get_client() << "/" + << std::setw(4) << _message->get_session() << "] shutdown method called"; std::lock_guard its_lock(stop_mutex_); wait_for_stop_ = false; @@ -168,7 +168,7 @@ class initial_event_test_stop_service : public vsomeip_utilities::base_logger { } } - VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex + VSOMEIP_DEBUG << "[" << std::hex << std::setfill('0') << std::setw(4) << service_info_.service_id << "] Offering"; offer(); @@ -179,7 +179,7 @@ class initial_event_test_stop_service : public vsomeip_utilities::base_logger { } } - VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex + VSOMEIP_DEBUG << "[" << std::hex << std::setfill('0') << std::setw(4) << service_info_.service_id << "] Calling shutdown method on remote side"; std::shared_ptr msg(vsomeip::runtime::get()->create_request()); @@ -220,7 +220,8 @@ class initial_event_test_stop_service : public vsomeip_utilities::base_logger { stop_condition_.wait(its_lock); } } - VSOMEIP_INFO << "(" << std::dec << its_call_number << ") [" << std::setw(4) << std::setfill('0') << std::hex + VSOMEIP_INFO << "(" << std::dec << its_call_number << ") [" + << std::hex << std::setfill('0') << std::setw(4) << service_info_.service_id << "] shutdown method was called, going down"; while(!called_other_node_) { diff --git a/test/network_tests/lazy_load_tests/lazy_load_test_client.cpp b/test/network_tests/lazy_load_tests/lazy_load_test_client.cpp index e078374d7..e2dc47b06 100644 --- a/test/network_tests/lazy_load_tests/lazy_load_test_client.cpp +++ b/test/network_tests/lazy_load_tests/lazy_load_test_client.cpp @@ -110,8 +110,8 @@ void lazy_load_test_client::on_availability(vsomeip::service_t _service, VSOMEIP_INFO << "CLIENT ON_AVAILABILITY..."; VSOMEIP_INFO << std::hex << "Client 0x" << app_->get_client() - << " : Service [" << std::setw(4) << std::setfill('0') << std::hex - << _service << '.' << _instance << "] is " + << " : Service [" << std::hex << std::setfill('0') + << std::setw(4) << _service << '.' << _instance << "] is " << (_is_service_available ? "available." : "NOT available."); // Check that only the allowed service is available diff --git a/test/network_tests/lazy_load_tests/lazy_load_test_lazy_client.cpp b/test/network_tests/lazy_load_tests/lazy_load_test_lazy_client.cpp index 8e9a68a60..bc5e6908f 100644 --- a/test/network_tests/lazy_load_tests/lazy_load_test_lazy_client.cpp +++ b/test/network_tests/lazy_load_tests/lazy_load_test_lazy_client.cpp @@ -110,7 +110,7 @@ void lazy_load_lazy_client::on_availability(vsomeip::service_t _service, VSOMEIP_INFO << "CLIENT ON_AVAILABILITY..."; VSOMEIP_INFO << std::hex << "Client 0x" << app_->get_client() - << " : Service [" << std::setw(4) << std::setfill('0') << std::hex + << " : Service [" << std::hex << std::setfill('0') << std::setw(4) << _service << '.' << _instance << "] is " << (_is_service_available ? "available." : "NOT available."); diff --git a/test/network_tests/lazy_load_tests/lazy_load_test_service.cpp b/test/network_tests/lazy_load_tests/lazy_load_test_service.cpp index 001bff656..66b54d782 100644 --- a/test/network_tests/lazy_load_tests/lazy_load_test_service.cpp +++ b/test/network_tests/lazy_load_tests/lazy_load_test_service.cpp @@ -148,10 +148,11 @@ void lazy_load_test_service::on_message(const std::shared_ptr& ASSERT_EQ(vsomeip_test::TEST_SERVICE_SERVICE_ID, _request->get_service()); ASSERT_EQ(vsomeip_test::TEST_SERVICE_METHOD_ID, _request->get_method()); - VSOMEIP_INFO << "Received a message with Client/Session [" << std::setw(4) - << std::setfill('0') << std::hex << _request->get_client() << '/' - << std::setw(4) << std::setfill('0') << std::hex - << _request->get_session() << "] method: " << _request->get_method() + VSOMEIP_INFO << "Received a message with Client/Session [" + << std::hex << std::setfill('0') + << std::setw(4) << _request->get_client() << '/' + << std::setw(4) << _request->get_session() + << "] method: " << _request->get_method() << " Instance ID: " << _request->get_instance(); // send response diff --git a/test/network_tests/magic_cookies_tests/magic_cookies_test_client.cpp b/test/network_tests/magic_cookies_tests/magic_cookies_test_client.cpp index f7887367e..9b5a7625c 100644 --- a/test/network_tests/magic_cookies_tests/magic_cookies_test_client.cpp +++ b/test/network_tests/magic_cookies_tests/magic_cookies_test_client.cpp @@ -80,7 +80,7 @@ class magic_cookies_test_client : public vsomeip_utilities::base_logger { void on_availability(vsomeip::service_t _service, vsomeip::instance_t _instance, bool _is_available) { VSOMEIP_INFO << "Service [" - << std::setw(4) << std::setfill('0') << std::hex << _service << "." << _instance + << std::hex << std::setfill('0') << std::setw(4) << _service << "." << _instance << "] is " << (_is_available ? "available." : "NOT available."); @@ -99,25 +99,23 @@ class magic_cookies_test_client : public vsomeip_utilities::base_logger { void on_message(const std::shared_ptr< vsomeip::message > &_response) { if (_response->get_return_code() == vsomeip::return_code_e::E_OK) { VSOMEIP_INFO << "Received a response from Service [" - << std::setw(4) << std::setfill('0') << std::hex << _response->get_service() - << "." - << std::setw(4) << std::setfill('0') << std::hex << _response->get_instance() + << std::hex << std::setfill('0') + << std::setw(4) << _response->get_service() << '.' + << std::setw(4) << _response->get_instance() << "] to Client/Session [" - << std::setw(4) << std::setfill('0') << std::hex << _response->get_client() - << "/" - << std::setw(4) << std::setfill('0') << std::hex << _response->get_session() - << "]"; + << std::setw(4) << _response->get_client() << '/' + << std::setw(4) << _response->get_session() + << ']'; received_responses_++; } else if (_response->get_return_code() == vsomeip::return_code_e::E_MALFORMED_MESSAGE) { VSOMEIP_INFO << "Received an error message from Service [" - << std::setw(4) << std::setfill('0') << std::hex << _response->get_service() - << "." - << std::setw(4) << std::setfill('0') << std::hex << _response->get_instance() + << std::hex << std::setfill('0') + << std::setw(4) << _response->get_service() << '.' + << std::setw(4) << _response->get_instance() << "] to Client/Session [" - << std::setw(4) << std::setfill('0') << std::hex << _response->get_client() - << "/" - << std::setw(4) << std::setfill('0') << std::hex << _response->get_session() - << "]"; + << std::setw(4) << _response->get_client() << '/' + << std::setw(4) << _response->get_session() + << ']'; received_errors_++; } if (received_errors_ == sent_messages_bad_ diff --git a/test/network_tests/magic_cookies_tests/magic_cookies_test_service.cpp b/test/network_tests/magic_cookies_tests/magic_cookies_test_service.cpp index 49cda1e1c..21a350caa 100644 --- a/test/network_tests/magic_cookies_tests/magic_cookies_test_service.cpp +++ b/test/network_tests/magic_cookies_tests/magic_cookies_test_service.cpp @@ -82,10 +82,10 @@ class magic_cookies_test_service : public vsomeip_utilities::base_logger { } void on_message(const std::shared_ptr &_request) { - VSOMEIP_INFO << "Received a message with Client/Session [" << std::setw(4) - << std::setfill('0') << std::hex << _request->get_client() << "/" - << std::setw(4) << std::setfill('0') << std::hex - << _request->get_session() << "]"; + VSOMEIP_INFO << "Received a message with Client/Session [" + << std::hex << std::setfill('0') + << std::setw(4) << _request->get_client() << "/" + << std::setw(4) << _request->get_session() << "]"; std::shared_ptr its_response = vsomeip::runtime::get() ->create_response(_request); diff --git a/test/network_tests/malicious_data_tests/malicious_data_test_msg_sender.cpp b/test/network_tests/malicious_data_tests/malicious_data_test_msg_sender.cpp index f5f15927e..d1d5a20eb 100644 --- a/test/network_tests/malicious_data_tests/malicious_data_test_msg_sender.cpp +++ b/test/network_tests/malicious_data_tests/malicious_data_test_msg_sender.cpp @@ -77,8 +77,9 @@ TEST_F(malicious_data, send_malicious_events) } #if 0 std::stringstream str; + str << std::hex << std::setfill('0'); for (size_t i = 0; i < bytes_transferred; i++) { - str << std::hex << std::setw(2) << std::setfill('0') << std::uint32_t(receive_buffer[i]) << " "; + str << std::setw(2) << std::uint32_t(receive_buffer[i]) << " "; } std::cout << __func__ << " received: " << std::dec << bytes_transferred << " bytes: " << str.str() << std::endl; #endif @@ -543,8 +544,9 @@ TEST_F(malicious_data, send_wrong_protocol_version) if (!error) { #if 0 std::stringstream str; + str << std::hex << std::setfill('0'); for (size_t i = 0; i < bytes_transferred; i++) { - str << std::hex << std::setw(2) << std::setfill('0') << std::uint32_t(receive_buffer[i]) << " "; + str << std::setw(2) << std::uint32_t(receive_buffer[i]) << " "; } std::cout << __func__ << " received: " << std::dec << bytes_transferred << " bytes: " << str.str() << std::endl; #endif diff --git a/test/network_tests/malicious_data_tests/malicious_data_test_service.cpp b/test/network_tests/malicious_data_tests/malicious_data_test_service.cpp index 56538aec1..36d640fa5 100644 --- a/test/network_tests/malicious_data_tests/malicious_data_test_service.cpp +++ b/test/network_tests/malicious_data_tests/malicious_data_test_service.cpp @@ -128,14 +128,14 @@ class malicious_data_test_service : public vsomeip_utilities::base_logger { } void run() { - VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex + VSOMEIP_DEBUG << "[" << std::hex << std::setfill('0') << std::setw(4) << service_info_.service_id << "] Running"; std::unique_lock its_lock(mutex_); while (wait_until_registered_) { condition_.wait(its_lock); } - VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex + VSOMEIP_DEBUG << "[" << std::hex << std::setfill('0') << std::setw(4) << service_info_.service_id << "] Offering"; offer(); diff --git a/test/network_tests/npdu_tests/npdu_test_client.cpp b/test/network_tests/npdu_tests/npdu_test_client.cpp index cba54f281..79bc23239 100644 --- a/test/network_tests/npdu_tests/npdu_test_client.cpp +++ b/test/network_tests/npdu_tests/npdu_test_client.cpp @@ -169,8 +169,9 @@ template void npdu_test_client::on_availability(vsomeip::service_t _service, vsomeip::instance_t _instance, bool _is_available) { - VSOMEIP_INFO<< "Service [" << std::setw(4) << std::setfill('0') << std::hex - << _service << "." << std::setw(4) << std::setfill('0') << _instance << "] is " + VSOMEIP_INFO<< "Service [" << std::hex << std::setfill('0') + << std::setw(4) << _service << "." + << std::setw(4) << _instance << "] is " << (_is_available ? "available." : "NOT available."); if(npdu_test::service_ids[service_idx] == _service && npdu_test::instance_ids[service_idx] == _instance) { @@ -190,12 +191,11 @@ template void npdu_test_client::on_message(const std::shared_ptr& _response) { (void)_response; //TODO make sure the replies were sent within demanded debounce times - VSOMEIP_DEBUG << "Received reply from:" << std::setw(4) << std::setfill('0') - << std::hex << npdu_test::service_ids[service_idx] << ":" - << std::setw(4) << std::setfill('0') << std::hex - << npdu_test::instance_ids[service_idx] << ":" << std::setw(4) - << std::setfill('0') << std::hex - << npdu_test::method_ids[service_idx][method_idx]; + VSOMEIP_DEBUG << "Received reply from:" + << std::setfill('0') << std::hex + << std::setw(4) << npdu_test::service_ids[service_idx] << ":" + << std::setw(4) << npdu_test::instance_ids[service_idx] << ":" + << std::setw(4) << npdu_test::method_ids[service_idx][method_idx]; if(call_service_sync_) { diff --git a/test/network_tests/npdu_tests/npdu_test_service.cpp b/test/network_tests/npdu_tests/npdu_test_service.cpp index 3b13802a5..24bf756c0 100644 --- a/test/network_tests/npdu_tests/npdu_test_service.cpp +++ b/test/network_tests/npdu_tests/npdu_test_service.cpp @@ -99,10 +99,14 @@ void npdu_test_service::stop() } double average = static_cast(sum.count())/static_cast(undershot_debounce_times_.size()); VSOMEIP_INFO << "[" - << std::setw(4) << std::setfill('0') << std::hex << service_id_ << "." - << std::setw(4) << std::setfill('0') << std::hex << instance_id_ << "]: " - << " Debounce time was undershot " << std::dec << undershot_debounce_times_.size() << "/" << number_of_received_messages_ - << "(" << std::setprecision(2) << (static_cast(undershot_debounce_times_.size()) / static_cast(number_of_received_messages_)) * 100.00 + << std::hex << std::setfill('0') + << std::setw(4) << service_id_ << "." + << std::setw(4) << instance_id_ << "]: " + << " Debounce time was undershot " + << std::dec << undershot_debounce_times_.size() << "/" + << number_of_received_messages_ + << "(" << std::setprecision(2) + << (static_cast(undershot_debounce_times_.size()) / static_cast(number_of_received_messages_)) * 100.00 << "%) on average: " << std::setprecision(4) << average << "µs"; } app_->unregister_message_handler(service_id_, instance_id_, method_ids_[0]); @@ -178,12 +182,12 @@ void npdu_test_service::check_times() { // message leaves the client endpoint. #if 0 if(time_since_last_message > max_retention_times_[method_idx]) { - VSOMEIP_ERROR << std::setw(4) << std::setfill('0') << std::hex - << service_id_ << ":" << std::setw(4) << std::setfill('0') - << std::hex << instance_id_ << ":" << std::setw(4) << std::setfill('0') - << std::hex << npdu_test::method_ids[SERVICE_NUMBER][method_idx] - << ": max_retention_time exceeded by: " << std::dec - << std::chrono::duration_cast( + VSOMEIP_ERROR << std::hex << std::setfill('0') + << std::setw(4) << service_id_ << ":" + << std::setw(4) << instance_id_ << ":" + << std::setw(4) << npdu_test::method_ids[SERVICE_NUMBER][method_idx] + << ": max_retention_time exceeded by: " + << std::dec << std::chrono::duration_cast( time_since_last_message - max_retention_times_[method_idx]).count() << "ms"; GTEST_FATAL_FAILURE_("Max retention time was exceeded"); @@ -196,8 +200,9 @@ void npdu_test_service::on_message(const std::shared_ptr& _req { number_of_received_messages_++; check_times(); - VSOMEIP_DEBUG << __func__ << " 0x" << std::setw(4) << std::setfill('0') << std::hex - << method_ids_[method_idx] << " payload size: " + VSOMEIP_DEBUG << __func__ << " 0x" + << std::hex << std::setfill('0') + << std::setw(4) << method_ids_[method_idx] << " payload size: " << std::dec << _request->get_payload()->get_length(); if(_request->get_message_type() != vsomeip::message_type_e::MT_REQUEST_NO_RETURN) { std::shared_ptr its_response = diff --git a/test/network_tests/offer_stop_offer_test/applications/client.cpp b/test/network_tests/offer_stop_offer_test/applications/client.cpp index d31f067c2..7f0762fd9 100644 --- a/test/network_tests/offer_stop_offer_test/applications/client.cpp +++ b/test/network_tests/offer_stop_offer_test/applications/client.cpp @@ -100,10 +100,10 @@ void client_t::on_message(const std::shared_ptr& message) { if (message->get_payload()->get_data()) { VSOMEIP_INFO << "client_t::" << __func__ << ": " << static_cast(message->get_payload()->get_data()[0]) << " from 0x" - << std::setw(4) << std::setfill('0') << std::hex << message->get_service(); + << std::hex << std::setfill('0') << std::setw(4) << message->get_service(); } else { VSOMEIP_WARNING << "client_t::" << __func__ << ": Empty payload for service " - << " from 0x" << std::setw(4) << std::setfill('0') << std::hex + << " from 0x" << std::hex << std::setfill('0') << std::setw(4) << message->get_service(); } diff --git a/test/network_tests/offer_tests/offer_test_big_sd_msg_client.cpp b/test/network_tests/offer_tests/offer_test_big_sd_msg_client.cpp index 91a5b1f12..b025726f2 100644 --- a/test/network_tests/offer_tests/offer_test_big_sd_msg_client.cpp +++ b/test/network_tests/offer_tests/offer_test_big_sd_msg_client.cpp @@ -92,8 +92,8 @@ class offer_test_big_sd_msg_client : public vsomeip_utilities::base_logger { void on_availability(vsomeip::service_t _service, vsomeip::instance_t _instance, bool _is_available) { - VSOMEIP_DEBUG << "Service [" << std::setw(4) - << std::setfill('0') << std::hex << _service << "." << _instance + VSOMEIP_DEBUG << "Service [" << std::hex + << std::setfill('0') << std::setw(4) << _service << "." << _instance << "] is " << (_is_available ? "available":"not available") << "."; std::lock_guard its_lock(mutex_); @@ -125,9 +125,10 @@ class offer_test_big_sd_msg_client : public vsomeip_utilities::base_logger { EXPECT_EQ(0x1, _instance); EXPECT_EQ(offer_test::big_msg_eventgroup_id, _eventgroup); EXPECT_EQ(offer_test::big_msg_event_id, _event); - VSOMEIP_DEBUG << "Service [" << std::setw(4) - << std::setfill('0') << std::hex << _service << "." << _instance - << "] has " << (!_error ? "sent subscribe ack":" sent subscribe_nack") << "."; + VSOMEIP_DEBUG << "Service [" + << std::hex << std::setfill('0') + << std::setw(4) << _service << "." << _instance + << "] has " << (!_error ? "sent subscribe ack":" sent subscribe_nack") << "."; if (_error == 0x0 /*OK*/) { std::lock_guard its_lock(mutex_); diff --git a/test/network_tests/offer_tests/offer_test_big_sd_msg_service.cpp b/test/network_tests/offer_tests/offer_test_big_sd_msg_service.cpp index b83870ba9..1333e3dc5 100644 --- a/test/network_tests/offer_tests/offer_test_big_sd_msg_service.cpp +++ b/test/network_tests/offer_tests/offer_test_big_sd_msg_service.cpp @@ -130,14 +130,14 @@ class offer_test_big_sd_msg_service : public vsomeip_utilities::base_logger { } void run() { - VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex + VSOMEIP_DEBUG << "[" << std::hex << std::setfill('0') << std::setw(4) << service_info_.service_id << "] Running"; std::unique_lock its_lock(mutex_); while (wait_until_registered_) { condition_.wait(its_lock); } - VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex + VSOMEIP_DEBUG << "[" << std::hex << std::setfill('0') << std::setw(4) << service_info_.service_id << "] Offering"; offer(); diff --git a/test/network_tests/offer_tests/offer_test_client.cpp b/test/network_tests/offer_tests/offer_test_client.cpp index e5697cb2f..e88b6c8d1 100644 --- a/test/network_tests/offer_tests/offer_test_client.cpp +++ b/test/network_tests/offer_tests/offer_test_client.cpp @@ -104,8 +104,8 @@ class offer_test_client : public vsomeip_utilities::base_logger { void on_availability(vsomeip::service_t _service, vsomeip::instance_t _instance, bool _is_available) { - VSOMEIP_INFO << "Service [" << std::setw(4) - << std::setfill('0') << std::hex << _service << "." << _instance + VSOMEIP_INFO << "Service ["<< std::hex << std::setfill('0') + << std::setw(4) << _service << "." << _instance << "] is " << (_is_available ? "available":"not available") << "."; std::lock_guard its_lock(mutex_); if(_is_available) { diff --git a/test/network_tests/offer_tests/offer_test_multiple_offerings.cpp b/test/network_tests/offer_tests/offer_test_multiple_offerings.cpp index c25e5233b..15b087b9b 100644 --- a/test/network_tests/offer_tests/offer_test_multiple_offerings.cpp +++ b/test/network_tests/offer_tests/offer_test_multiple_offerings.cpp @@ -131,13 +131,16 @@ class client : common { received_payload_.clear(); for (uint32_t i = 0; i < len; ++i) { received_payload_.push_back(*(its_payload->get_data() + i)); - msg << std::hex << std::setw(2) << std::setfill('0') << (int)(*(its_payload->get_data() + i)) << " "; + msg << std::hex << std::setfill('0') + << std::setw(2) << static_cast((*(its_payload->get_data() + i))) + << " "; } } VSOMEIP_INFO << "[TEST] Got message from " - << std::hex << std::setw(4) << std::setfill('0') << _message->get_service() << "." - << std::hex << std::setw(4) << std::setfill('0') << _message->get_instance() + << std::hex << std::setfill('0') + << std::setw(4) << _message->get_service() << "." + << std::setw(4) << _message->get_instance() << " length " << std::dec << len << " and payload " << msg.str(); { std::lock_guard its_lock(mutex_); @@ -210,9 +213,10 @@ class server : common { const vsomeip::length_t len = _message->get_payload()->get_length(); std::vector out_payload; std::stringstream msg; + msg << std::hex << std::setfill('0'); for (uint32_t i = 0; i < len; ++i) { out_payload.push_back(*(_message->get_payload()->get_data() + i)); - msg << std::hex << std::setw(2) << std::setfill('0') << (int)(*(_message->get_payload()->get_data() + i)) << " "; + msg << std::setw(2) << static_cast((*(_message->get_payload()->get_data() + i))) << " "; } std::shared_ptr response = runtime::get()->create_response(_message); response->set_payload(vsomeip::runtime::get()->create_payload(out_payload)); diff --git a/test/network_tests/offer_tests/offer_test_service.cpp b/test/network_tests/offer_tests/offer_test_service.cpp index 5fa5c1234..b2e898386 100644 --- a/test/network_tests/offer_tests/offer_test_service.cpp +++ b/test/network_tests/offer_tests/offer_test_service.cpp @@ -108,18 +108,18 @@ class offer_test_service : public vsomeip_utilities::base_logger { } void run() { - VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex + VSOMEIP_DEBUG << "[" << std::hex << std::setfill('0') << std::setw(4) << service_info_.service_id << "] Running"; std::unique_lock its_lock(mutex_); while (wait_until_registered_) { condition_.wait(its_lock); } - VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex + VSOMEIP_DEBUG << "[" << std::hex << std::setfill('0') << std::setw(4) << service_info_.service_id << "] Offering"; offer(); - VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex + VSOMEIP_DEBUG << "[" << std::hex << std::setfill('0') << std::setw(4) << service_info_.service_id << "] Notifying"; while(!shutdown_method_called_) { std::this_thread::sleep_for(std::chrono::milliseconds(10)); diff --git a/test/network_tests/offer_tests/offer_test_service_external.cpp b/test/network_tests/offer_tests/offer_test_service_external.cpp index d4c8c1d1f..c050e694f 100644 --- a/test/network_tests/offer_tests/offer_test_service_external.cpp +++ b/test/network_tests/offer_tests/offer_test_service_external.cpp @@ -81,8 +81,8 @@ class offer_test_service : public vsomeip_utilities::base_logger { void on_availability(vsomeip::service_t _service, vsomeip::instance_t _instance, bool _is_available) { - VSOMEIP_INFO << "Service [" << std::setw(4) - << std::setfill('0') << std::hex << _service << "." << _instance + VSOMEIP_INFO << "Service [" << std::hex << std::setfill('0') + << std::setw(4) << _service << "." << _instance << "] is " << (_is_available ? "available":"not available") << "."; std::lock_guard its_lock(mutex_); if(_is_available) { @@ -95,7 +95,7 @@ class offer_test_service : public vsomeip_utilities::base_logger { } void run() { - VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex + VSOMEIP_DEBUG << "[" << std::hex << std::setfill('0') << std::setw(4) << service_info_.service_id << "] Running"; { std::unique_lock its_lock(mutex_); @@ -103,7 +103,7 @@ class offer_test_service : public vsomeip_utilities::base_logger { condition_.wait(its_lock); } - VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex + VSOMEIP_DEBUG << "[" << std::hex << std::setfill('0') << std::setw(4) << service_info_.service_id << "] Offering"; offer(); @@ -113,7 +113,7 @@ class offer_test_service : public vsomeip_utilities::base_logger { } std::this_thread::sleep_for(std::chrono::seconds(1)); - VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex + VSOMEIP_DEBUG << "[" << std::hex << std::setfill('0') << std::setw(4) << service_info_.service_id << "] Calling stop method"; std::shared_ptr msg(vsomeip::runtime::get()->create_request()); msg->set_service(service_info_.service_id); diff --git a/test/network_tests/offered_services_info_tests/offered_services_info_test_client.cpp b/test/network_tests/offered_services_info_tests/offered_services_info_test_client.cpp index 081da5659..6fce0156a 100644 --- a/test/network_tests/offered_services_info_tests/offered_services_info_test_client.cpp +++ b/test/network_tests/offered_services_info_tests/offered_services_info_test_client.cpp @@ -117,8 +117,9 @@ class offered_services_info_test_client : public vsomeip_utilities::base_logger void on_availability(vsomeip::service_t _service, vsomeip::instance_t _instance, bool _is_available) { - VSOMEIP_INFO << "Service [" << std::setw(4) - << std::setfill('0') << std::hex << _service << "." << _instance + VSOMEIP_INFO << "Service [" + << std::hex << std::setfill('0') + << std::setw(4) << _service << "." << _instance << "] is " << (_is_available ? "available":"not available") << "."; static int services_available =0; std::lock_guard its_lock(mutex_); diff --git a/test/network_tests/offered_services_info_tests/offered_services_info_test_service.cpp b/test/network_tests/offered_services_info_tests/offered_services_info_test_service.cpp index d1f9726d7..459455f9f 100644 --- a/test/network_tests/offered_services_info_tests/offered_services_info_test_service.cpp +++ b/test/network_tests/offered_services_info_tests/offered_services_info_test_service.cpp @@ -132,15 +132,15 @@ class offer_test_service : public vsomeip_utilities::base_logger { } void run() { - VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex - << service_info_.service_id << "] Running"; + VSOMEIP_DEBUG << "[" << std::hex << std::setfill('0') + << std::setw(4) << service_info_.service_id << "] Running"; std::unique_lock its_lock(mutex_); while (wait_until_registered_) { condition_.wait(its_lock); } - VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex - << service_info_.service_id << "] Offering"; + VSOMEIP_DEBUG << "[" << std::hex << std::setfill('0') + << std::setw(4) << service_info_.service_id << "] Offering"; offer(); std::this_thread::sleep_for(std::chrono::milliseconds(100)); diff --git a/test/network_tests/payload_tests/payload_test_client.cpp b/test/network_tests/payload_tests/payload_test_client.cpp index ef5ba631f..4b0c0232e 100644 --- a/test/network_tests/payload_tests/payload_test_client.cpp +++ b/test/network_tests/payload_tests/payload_test_client.cpp @@ -108,8 +108,8 @@ void payload_test_client::on_state(vsomeip::state_type_e _state) void payload_test_client::on_availability(vsomeip::service_t _service, vsomeip::instance_t _instance, bool _is_available) { - VSOMEIP_INFO << "Service [" << std::setw(4) << std::setfill('0') << std::hex - << _service << "." << _instance << "] is " + VSOMEIP_INFO << "Service [" << std::hex << std::setfill('0') + << std::setw(4) << _service << "." << _instance << "] is " << (_is_available ? "available." : "NOT available."); if(vsomeip_test::TEST_SERVICE_SERVICE_ID == _service @@ -304,12 +304,18 @@ void payload_test_client::print_throughput() / (static_cast(time_needed) / usec_per_sec)) / (1024*1024); VSOMEIP_INFO<< "[ Payload Test ] : :" - << "Payload size [byte]: " << std::dec << std::setw(8) << std::setfill('0') << current_payload_size_ - << " Messages sent: " << std::dec << std::setw(8) << std::setfill('0') << number_of_sent_messages_ - << " Meantime/message [usec]: " << std::dec << std::setw(8) << std::setfill('0') << time_per_message - << " Calls/sec: " << std::dec << std::setw(8) << std::setfill('0') << calls_per_sec - << " MiB/sec: " << std::dec << std::setw(8) << std::setfill('0') << mbyte_per_sec; -} + << std::dec << std::setfill('0') + << "Payload size [byte]: " + << std::setw(8) << current_payload_size_ + << " Messages sent: " + << std::setw(8) << number_of_sent_messages_ + << " Meantime/message [usec]: " + << std::setw(8) << time_per_message + << " Calls/sec: " + << std::setw(8) << calls_per_sec + << " MiB/sec: " + << std::setw(8) << mbyte_per_sec; + } TEST(someip_payload_test, send_different_payloads) { diff --git a/test/network_tests/payload_tests/payload_test_service.cpp b/test/network_tests/payload_tests/payload_test_service.cpp index 7d4c9243a..c43bb12de 100644 --- a/test/network_tests/payload_tests/payload_test_service.cpp +++ b/test/network_tests/payload_tests/payload_test_service.cpp @@ -101,10 +101,10 @@ void payload_test_service::on_message(const std::shared_ptr& _ number_of_received_messages_++; if(number_of_received_messages_ % vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND_PAYLOAD_TESTS == 0) { - VSOMEIP_INFO << "Received a message with Client/Session [" << std::setw(4) - << std::setfill('0') << std::hex << _request->get_client() << "/" - << std::setw(4) << std::setfill('0') << std::hex - << _request->get_session() << "] payload size [byte]:" + VSOMEIP_INFO << "Received a message with Client/Session [" + << std::hex << std::setfill('0') + << std::setw(4) << _request->get_client() << "/" + << std::setw(4) << _request->get_session() << "] payload size [byte]:" << std::dec << _request->get_payload()->get_length(); } diff --git a/test/network_tests/pending_subscription_tests/pending_subscription_test_sd_msg_sender.cpp b/test/network_tests/pending_subscription_tests/pending_subscription_test_sd_msg_sender.cpp index ce05f66c3..ddd645543 100644 --- a/test/network_tests/pending_subscription_tests/pending_subscription_test_sd_msg_sender.cpp +++ b/test/network_tests/pending_subscription_tests/pending_subscription_test_sd_msg_sender.cpp @@ -266,8 +266,9 @@ TEST_F(pending_subscription, send_alternating_subscribe_unsubscribe) } else { #if 0 std::stringstream str; + str << std::hex << std::setfill('0'); for (size_t i = 0; i < bytes_transferred; i++) { - str << std::hex << std::setw(2) << std::setfill('0') << std::uint32_t(receive_buffer[i]) << " "; + str << std::setw(2) << std::uint32_t(receive_buffer[i]) << " "; } std::cout << __func__ << " received: " << std::dec << bytes_transferred << " bytes: " << str.str() << std::endl; #endif @@ -471,8 +472,9 @@ TEST_F(pending_subscription, send_multiple_unsubscriptions) } else { #if 0 std::stringstream str; + str << std::hex << std::setfill('0'); for (size_t i = 0; i < bytes_transferred; i++) { - str << std::hex << std::setw(2) << std::setfill('0') << std::uint32_t(receive_buffer[i]) << " "; + str << std::setw(2) << std::uint32_t(receive_buffer[i]) << " "; } std::cout << __func__ << " received: " << std::dec << bytes_transferred << " bytes: " << str.str() << std::endl; #endif @@ -675,8 +677,9 @@ TEST_F(pending_subscription, send_alternating_subscribe_nack_unsubscribe) } else { #if 0 std::stringstream str; + str << std::hex << std::setfill('0'); for (size_t i = 0; i < bytes_transferred; i++) { - str << std::hex << std::setw(2) << std::setfill('0') << std::uint32_t(receive_buffer[i]) << " "; + str << std::setw(2) << std::uint32_t(receive_buffer[i]) << " "; } std::cout << __func__ << " received: " << std::dec << bytes_transferred << " bytes: " << str.str() << std::endl; #endif @@ -1332,8 +1335,9 @@ TEST_F(pending_subscription, send_subscribe_stop_subscribe_subscribe) while (bytes_transferred > 0) { #if 0 std::stringstream str; + str << std::hex << std::setfill('0'); for (size_t i = 0; i < bytes_transferred; i++) { - str << std::hex << std::setw(2) << std::setfill('0') << std::uint32_t(receive_buffer[i]) << " "; + str << std::setw(2) << std::uint32_t(receive_buffer[i]) << " "; } std::cout << __func__ << " received: " << std::dec << bytes_transferred << " bytes: " << str.str() << std::endl; #endif diff --git a/test/network_tests/pending_subscription_tests/pending_subscription_test_service.cpp b/test/network_tests/pending_subscription_tests/pending_subscription_test_service.cpp index 1a206b34b..792073aa1 100644 --- a/test/network_tests/pending_subscription_tests/pending_subscription_test_service.cpp +++ b/test/network_tests/pending_subscription_tests/pending_subscription_test_service.cpp @@ -132,14 +132,14 @@ class pending_subscription_test_service : public vsomeip_utilities::base_logger } void run() { - VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex + VSOMEIP_DEBUG << "[" << std::hex << std::setfill('0') << std::setw(4) << service_info_.service_id << "] Running"; std::unique_lock its_lock(mutex_); while (wait_until_registered_) { condition_.wait(its_lock); } - VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex + VSOMEIP_DEBUG << "[" << std::hex << std::setfill('0') << std::setw(4) << service_info_.service_id << "] Offering"; offer(); diff --git a/test/network_tests/regression_tests/climate_test_client.cpp b/test/network_tests/regression_tests/climate_test_client.cpp index 6674907aa..4e9af48fd 100644 --- a/test/network_tests/regression_tests/climate_test_client.cpp +++ b/test/network_tests/regression_tests/climate_test_client.cpp @@ -80,7 +80,8 @@ class client_sample { void on_availability(vsomeip::service_t _service, vsomeip::instance_t _instance, bool _is_available) { VSOMEIP_INFO << "Service [" - << std::setw(4) << std::setfill('0') << std::hex << _service << "." << _instance + << std::hex << std::setfill('0') + << std::setw(4) << _service << "." << _instance << "] is " << (_is_available ? "available." : "NOT available.") << std::endl; @@ -91,24 +92,22 @@ class client_sample { void on_message(const std::shared_ptr &_response) { std::stringstream its_message; its_message << "Received a notification for Event [" - << std::setw(4) << std::setfill('0') << std::hex - << _response->get_service() << "." - << std::setw(4) << std::setfill('0') << std::hex - << _response->get_instance() << "." - << std::setw(4) << std::setfill('0') << std::hex - << _response->get_method() << "] to Client/Session [" - << std::setw(4) << std::setfill('0') << std::hex - << _response->get_client() << "/" - << std::setw(4) << std::setfill('0') << std::hex - << _response->get_session() + << std::hex << std::setfill('0') + << std::setw(4) << _response->get_service() << "." + << std::setw(4) << _response->get_instance() << "." + << std::setw(4) << _response->get_method() + << "] to Client/Session [" + << std::setw(4) << _response->get_client() << "/" + << std::setw(4) << _response->get_session() << "] = "; std::shared_ptr its_payload = _response->get_payload(); EXPECT_EQ(its_payload->get_length(), 5); its_message << "(" << std::dec << its_payload->get_length() << ") "; + its_message << std::hex << std::setfill('0'); for (uint32_t i = 0; i < its_payload->get_length(); ++i) { - its_message << std::hex << std::setw(2) << std::setfill('0') - << (int) its_payload->get_data()[i] << " "; + its_message << std::setw(2) + << static_cast(its_payload->get_data()[i]) << " "; } if ((its_payload->get_length() % 5) == 0) { diff --git a/test/network_tests/restart_routing_tests/restart_routing_test_client.cpp b/test/network_tests/restart_routing_tests/restart_routing_test_client.cpp index 7d6a001a4..50ed4af56 100644 --- a/test/network_tests/restart_routing_tests/restart_routing_test_client.cpp +++ b/test/network_tests/restart_routing_tests/restart_routing_test_client.cpp @@ -66,7 +66,7 @@ void routing_restart_test_client::on_availability(vsomeip::service_t _service, vsomeip::instance_t _instance, bool _is_available) { VSOMEIP_INFO << std::hex << "Client 0x" << app_->get_client() - << " : Service [" << std::setw(4) << std::setfill('0') << std::hex + << " : Service [" << std::hex << std::setfill('0') << std::setw(4) << _service << "." << _instance << "] is " << (_is_available ? "available." : "NOT available."); @@ -85,14 +85,12 @@ void routing_restart_test_client::on_availability(vsomeip::service_t _service, void routing_restart_test_client::on_message(const std::shared_ptr &_response) { VSOMEIP_INFO << "Received a response from Service [" - << std::setw(4) << std::setfill('0') << std::hex << _response->get_service() - << "." - << std::setw(4) << std::setfill('0') << std::hex << _response->get_instance() + << std::hex << std::setfill('0') + << std::setw(4) << _response->get_service() << "." + << std::setw(4) << _response->get_instance() << "] to Client/Session [" - << std::setw(4) << std::setfill('0') << std::hex << _response->get_client() - << "/" - << std::setw(4) << std::setfill('0') << std::hex << _response->get_session() - << "]"; + << std::setw(4) << _response->get_client() << "/" + << std::setw(4) << _response->get_session() << "]"; if (_response->get_service() == vsomeip_test::TEST_SERVICE_SERVICE_ID && _response->get_instance() == vsomeip_test::TEST_SERVICE_INSTANCE_ID) { diff --git a/test/network_tests/restart_routing_tests/restart_routing_test_service.cpp b/test/network_tests/restart_routing_tests/restart_routing_test_service.cpp index c8b192712..5a3b3205a 100644 --- a/test/network_tests/restart_routing_tests/restart_routing_test_service.cpp +++ b/test/network_tests/restart_routing_tests/restart_routing_test_service.cpp @@ -84,10 +84,11 @@ void routing_restart_test_service::on_message(const std::shared_ptrget_service()); ASSERT_EQ(vsomeip_test::TEST_SERVICE_METHOD_ID, _request->get_method()); received_counter_[_request->get_client()]++; - VSOMEIP_INFO << "Received a message with Client/Session [" << std::setw(4) << std::setfill('0') - << std::hex << _request->get_client() << "/" << std::setw(4) << std::setfill('0') - << std::hex << _request->get_session() << "] : " << std::dec - << received_counter_[_request->get_client()]; + VSOMEIP_INFO << "Received a message with Client/Session [" + << std::hex << std::setfill('0') + << std::setw(4) << _request->get_client() << "/" + << std::setw(4) << _request->get_session() << "] : " + << std::dec << received_counter_[_request->get_client()]; // send response std::shared_ptr its_response = diff --git a/test/network_tests/routing_tests/external_local_routing_test_service.cpp b/test/network_tests/routing_tests/external_local_routing_test_service.cpp index c90f17b12..72f7ca568 100644 --- a/test/network_tests/routing_tests/external_local_routing_test_service.cpp +++ b/test/network_tests/routing_tests/external_local_routing_test_service.cpp @@ -98,10 +98,10 @@ void external_local_routing_test_service::on_state(vsomeip::state_type_e _state) void external_local_routing_test_service::on_message( const std::shared_ptr& _request) { - VSOMEIP_INFO << "Received a message with Client/Session [" << std::setw(4) - << std::setfill('0') << std::hex << _request->get_client() << "/" - << std::setw(4) << std::setfill('0') << std::hex - << _request->get_session() << "]"; + VSOMEIP_INFO << "Received a message with Client/Session [" + << std::hex << std::setfill('0') + << std::setw(4) << _request->get_client() << "/" + << std::setw(4) << _request->get_session() << "]"; ASSERT_EQ(_request->get_service(), vsomeip_test::TEST_SERVICE_SERVICE_ID); ASSERT_EQ(_request->get_method(), vsomeip_test::TEST_SERVICE_METHOD_ID); diff --git a/test/network_tests/routing_tests/local_routing_test_client.cpp b/test/network_tests/routing_tests/local_routing_test_client.cpp index f7f83c324..2e8896c77 100644 --- a/test/network_tests/routing_tests/local_routing_test_client.cpp +++ b/test/network_tests/routing_tests/local_routing_test_client.cpp @@ -65,7 +65,7 @@ void local_routing_test_client::join_sender_thread(){ void local_routing_test_client::on_availability(vsomeip::service_t _service, vsomeip::instance_t _instance, bool _is_available) { - VSOMEIP_INFO << "Service [" << std::setw(4) << std::setfill('0') << std::hex + VSOMEIP_INFO << "Service [" << std::hex << std::setfill('0') << std::setw(4) << _service << "." << _instance << "] is " << (_is_available ? "available." : "NOT available."); @@ -86,13 +86,13 @@ void local_routing_test_client::on_availability(vsomeip::service_t _service, void local_routing_test_client::on_message(const std::shared_ptr& _response) { - VSOMEIP_INFO << "Received a response from Service [" << std::setw(4) - << std::setfill('0') << std::hex << _response->get_service() << "." - << std::setw(4) << std::setfill('0') << std::hex - << _response->get_instance() << "] to Client/Session [" - << std::setw(4) << std::setfill('0') << std::hex - << _response->get_client() << "/" << std::setw(4) - << std::setfill('0') << std::hex << _response->get_session() << "]"; + VSOMEIP_INFO << "Received a response from Service [" + << std::hex << std::setfill('0') + << std::setw(4) << _response->get_service() << "." + << std::setw(4) << _response->get_instance() + << "] to Client/Session [" + << std::setw(4) << _response->get_client() << "/" + << std::setw(4) << _response->get_session() << "]"; number_of_acknowledged_messages_++; if(number_of_acknowledged_messages_ == number_of_messages_to_send_) { std::lock_guard its_lock(mutex_); @@ -123,13 +123,12 @@ void local_routing_test_client::run() for (uint32_t i = 0; i < number_of_messages_to_send_; i++) { app_->send(request_); - VSOMEIP_INFO << "Client/Session [" << std::setw(4) << std::setfill('0') - << std::hex << request_->get_client() << "/" << std::setw(4) - << std::setfill('0') << std::hex << request_->get_session() - << "] sent a request to Service [" << std::setw(4) - << std::setfill('0') << std::hex << request_->get_service() - << "." << std::setw(4) << std::setfill('0') << std::hex - << request_->get_instance() << "]"; + VSOMEIP_INFO << "Client/Session [" << std::hex << std::setfill('0') + << std::setw(4) << request_->get_client() << "/" + << std::setw(4) << request_->get_session() + << "] sent a request to Service [" + << std::setw(4) << request_->get_service() << "." + << std::setw(4) << request_->get_instance() << "]"; number_of_sent_messages_++; } blocked_ = false; diff --git a/test/network_tests/routing_tests/local_routing_test_service.cpp b/test/network_tests/routing_tests/local_routing_test_service.cpp index 5d659e264..cc601c716 100644 --- a/test/network_tests/routing_tests/local_routing_test_service.cpp +++ b/test/network_tests/routing_tests/local_routing_test_service.cpp @@ -91,10 +91,10 @@ void local_routing_test_service::on_state(vsomeip::state_type_e _state) void local_routing_test_service::on_message(const std::shared_ptr& _request) { - VSOMEIP_INFO << "Received a message with Client/Session [" << std::setw(4) - << std::setfill('0') << std::hex << _request->get_client() << "/" - << std::setw(4) << std::setfill('0') << std::hex - << _request->get_session() << "]"; + VSOMEIP_INFO << "Received a message with Client/Session [" + << std::hex << std::setfill('0') + << std::setw(4) << _request->get_client() << "/" + << std::setw(4) << _request->get_session() << "]"; number_of_received_messages_++; diff --git a/test/network_tests/second_address_tests/second_address_test_client.cpp b/test/network_tests/second_address_tests/second_address_test_client.cpp index 72aae04ad..c80cc0918 100644 --- a/test/network_tests/second_address_tests/second_address_test_client.cpp +++ b/test/network_tests/second_address_tests/second_address_test_client.cpp @@ -130,8 +130,8 @@ class second_address_test_client : public vsomeip_utilities::base_logger { void on_availability(vsomeip::service_t _service, vsomeip::instance_t _instance, bool _is_available) { - VSOMEIP_DEBUG << "Service [" << std::setw(4) - << std::setfill('0') << std::hex << _service << "." << _instance + VSOMEIP_DEBUG << "Service [" << std::hex + << std::setfill('0') << std::setw(4) << _service << "." << _instance << "] is " << (_is_available ? "available":"not available") << " on client."; if (_is_available) { diff --git a/test/network_tests/second_address_tests/second_address_test_service.cpp b/test/network_tests/second_address_tests/second_address_test_service.cpp index e6346b704..38bf5efc2 100644 --- a/test/network_tests/second_address_tests/second_address_test_service.cpp +++ b/test/network_tests/second_address_tests/second_address_test_service.cpp @@ -173,7 +173,7 @@ class second_address_test_service : public vsomeip_utilities::base_logger { } void run() { - VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex + VSOMEIP_DEBUG << "[" << std::hex << std::setfill('0') << std::setw(4) << service_info_.service_id << "] Running"; std::unique_lock its_lock(mutex_); @@ -181,7 +181,7 @@ class second_address_test_service : public vsomeip_utilities::base_logger { condition_.wait(its_lock); } - VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex + VSOMEIP_DEBUG << "[" << std::hex << std::setfill('0') << std::setw(4) << service_info_.service_id << "] Offering"; offer(); @@ -208,7 +208,7 @@ class second_address_test_service : public vsomeip_utilities::base_logger { bool subscription_handler(vsomeip::client_t _client, std::uint32_t _uid, std::uint32_t _gid, bool _subscribed) { (void)_uid; (void)_gid; - VSOMEIP_DEBUG << __func__ << ": client 0x" << std::hex << std::setw(4) << std::setfill('0') << _client + VSOMEIP_DEBUG << __func__ << ": client 0x" << std::hex << std::setfill('0') << std::setw(4) << _client << ((_subscribed) ? " subscribed" : "unsubscribed") << " on service."; client_subscribed_ = _subscribed; return true; @@ -217,7 +217,7 @@ class second_address_test_service : public vsomeip_utilities::base_logger { bool selective_subscription_handler(vsomeip::client_t _client, std::uint32_t _uid, std::uint32_t _gid, bool _subscribed) { (void)_uid; (void)_gid; - VSOMEIP_DEBUG << __func__ << ": client 0x" << std::hex << std::setw(4) << std::setfill('0') << _client + VSOMEIP_DEBUG << __func__ << ": client 0x" << std::hex << std::setfill('0') << std::setw(4) << _client << ((_subscribed) ? " subscribed" : "unsubscribed") << " on service."; client_subscribed_selective_ = _subscribed; client_id_ = _client; diff --git a/test/network_tests/security_tests/security_test_client.cpp b/test/network_tests/security_tests/security_test_client.cpp index 9c3c3dd63..f4f8411e6 100644 --- a/test/network_tests/security_tests/security_test_client.cpp +++ b/test/network_tests/security_tests/security_test_client.cpp @@ -113,7 +113,7 @@ void security_test_client::on_availability(vsomeip::service_t _service, vsomeip::instance_t _instance, bool _is_available) { VSOMEIP_INFO << std::hex << "Client 0x" << app_->get_client() - << " : Service [" << std::setw(4) << std::setfill('0') << std::hex + << " : Service [" << std::hex << std::setfill('0') << std::setw(4) << _service << "." << _instance << "] is " << (_is_available ? "available." : "NOT available."); @@ -138,14 +138,12 @@ void security_test_client::on_availability(vsomeip::service_t _service, void security_test_client::on_message(const std::shared_ptr &_response) { VSOMEIP_INFO << "Received a response from Service [" - << std::setw(4) << std::setfill('0') << std::hex << _response->get_service() - << "." - << std::setw(4) << std::setfill('0') << std::hex << _response->get_instance() + << std::hex << std::setfill('0') + << std::setw(4) << _response->get_service() << "." + << std::setw(4) << _response->get_instance() << "] to Client/Session [" - << std::setw(4) << std::setfill('0') << std::hex << _response->get_client() - << "/" - << std::setw(4) << std::setfill('0') << std::hex << _response->get_session() - << "]"; + << std::setw(4) << _response->get_client() << "/" + << std::setw(4) << _response->get_session() << "]"; if(_response->get_message_type() == vsomeip::message_type_e::MT_RESPONSE) { EXPECT_EQ(vsomeip_test::TEST_SERVICE_SERVICE_ID, _response->get_service()); diff --git a/test/network_tests/security_tests/security_test_service.cpp b/test/network_tests/security_tests/security_test_service.cpp index 7843504b8..70342113d 100644 --- a/test/network_tests/security_tests/security_test_service.cpp +++ b/test/network_tests/security_tests/security_test_service.cpp @@ -125,10 +125,10 @@ void security_test_service::on_message(const std::shared_ptr& ASSERT_EQ(vsomeip_test::TEST_SERVICE_SERVICE_ID, _request->get_service()); ASSERT_EQ(vsomeip_test::TEST_SERVICE_INSTANCE_ID, _request->get_instance()); - VSOMEIP_INFO << "Received a message with Client/Session [" << std::setw(4) - << std::setfill('0') << std::hex << _request->get_client() << "/" - << std::setw(4) << std::setfill('0') << std::hex - << _request->get_session() << "] method: " << _request->get_method() ; + VSOMEIP_INFO << "Received a message with Client/Session [" + << std::hex << std::setfill('0') + << std::setw(4) << _request->get_client() << "/" + << std::setw(4) << _request->get_session() << "] method: " << _request->get_method() ; // send response std::shared_ptr its_response = diff --git a/test/network_tests/someip_tp_tests/someip_tp_test_service.cpp b/test/network_tests/someip_tp_tests/someip_tp_test_service.cpp index 01a2c973d..6c38f8705 100644 --- a/test/network_tests/someip_tp_tests/someip_tp_test_service.cpp +++ b/test/network_tests/someip_tp_tests/someip_tp_test_service.cpp @@ -150,15 +150,17 @@ class someip_tp_test_service : public vsomeip_utilities::base_logger { wait_for_slave_service_available_ = false; condition_.notify_one(); VSOMEIP_INFO << "Service available Service/Instance [" - << std::setw(4) << std::setfill('0') << std::hex << _service << "/" - << std::setw(4) << std::setfill('0') << std::hex << _instance << "]"; + << std::hex << std::setfill('0') + << std::setw(4) << _service << "/" + << std::setw(4) << _instance << "]"; } } void on_message(const std::shared_ptr& _message) { VSOMEIP_INFO << "Received a message with Client/Session [" - << std::setw(4) << std::setfill('0') << std::hex << _message->get_client() << "/" - << std::setw(4) << std::setfill('0') << std::hex << _message->get_session() + << std::hex << std::setfill('0') + << std::setw(4) << _message->get_client() << "/" + << std::setw(4) << _message->get_session() << "] size: " << std::dec << _message->get_payload()->get_length(); auto response = vsomeip::runtime::get()->create_response(_message); auto payload = vsomeip::runtime::get()->create_payload(_message->get_payload()->get_data(), _message->get_payload()->get_length()); @@ -173,8 +175,9 @@ class someip_tp_test_service : public vsomeip_utilities::base_logger { void on_notification(const std::shared_ptr& _message) { VSOMEIP_INFO << "Received a notification with Client/Session [" - << std::setw(4) << std::setfill('0') << std::hex << _message->get_client() << "/" - << std::setw(4) << std::setfill('0') << std::hex << _message->get_session() + << std::hex << std::setfill('0') + << std::setw(4) << _message->get_client() << "/" + << std::setw(4) << _message->get_session() << "] size: " << std::dec << _message->get_payload()->get_length(); EXPECT_EQ(someip_tp_test::service_slave.service_id, _message->get_service()); EXPECT_EQ(someip_tp_test::service_slave.event_id, _message->get_method()); @@ -253,8 +256,9 @@ class someip_tp_test_service : public vsomeip_utilities::base_logger { void on_response_from_slave(const std::shared_ptr &_message) { VSOMEIP_INFO << "Received a response from the slave with Client/Session [" - << std::setw(4) << std::setfill('0') << std::hex << _message->get_client() << "/" - << std::setw(4) << std::setfill('0') << std::hex << _message->get_session() + << std::hex << std::setfill('0') + << std::setw(4) << _message->get_client() << "/" + << std::setw(4) << _message->get_session() << "] size: " << std::dec << _message->get_payload()->get_length(); EXPECT_EQ(someip_tp_test::service_slave.service_id, _message->get_service()); EXPECT_EQ(someip_tp_test::service_slave.instance_id, _message->get_instance()); @@ -301,14 +305,14 @@ class someip_tp_test_service : public vsomeip_utilities::base_logger { } void run() { - VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex + VSOMEIP_DEBUG << "[" << std::hex << std::setfill('0') << std::setw(4) << service_info_.service_id << "] Running"; std::unique_lock its_lock(mutex_); while (wait_until_registered_) { condition_.wait(its_lock); } - VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex + VSOMEIP_DEBUG << "[" << std::hex << std::setfill('0') << std::setw(4) << service_info_.service_id << "] Offering"; offer(); diff --git a/test/network_tests/subscribe_notify_one_tests/subscribe_notify_one_test_service.cpp b/test/network_tests/subscribe_notify_one_tests/subscribe_notify_one_test_service.cpp index 62742ecdf..04db64b86 100644 --- a/test/network_tests/subscribe_notify_one_tests/subscribe_notify_one_test_service.cpp +++ b/test/network_tests/subscribe_notify_one_tests/subscribe_notify_one_test_service.cpp @@ -139,10 +139,11 @@ class subscribe_notify_one_test_service : public vsomeip_utilities::base_logger if(its_service != other_services_available_.end()) { if(its_service->second != _is_available) { its_service->second = true; - VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex - << service_info_.service_id << "] Service [" - << std::setw(4) << std::setfill('0') << std::hex << _service << "." << _instance - << "] is available."; + VSOMEIP_DEBUG << "[" + << std::hex << std::setfill('0') + << std::setw(4) << service_info_.service_id + << "] Service [" << std::setw(4) << _service << "." << _instance + << "] is available."; } } @@ -193,10 +194,11 @@ class subscribe_notify_one_test_service : public vsomeip_utilities::base_logger subscribers_.erase(_client); } - VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex - << service_info_.service_id << "] " << "Client: " << _client + VSOMEIP_DEBUG << "[" << std::hex << std::setfill('0') + << std::setw(4) << service_info_.service_id << "] " + << "Client: " << _client << " subscribed, now have " << std::dec << subscribers_.size() - << " subscribers. Expecting " << std::dec + << " subscribers. Expecting " << subscribe_notify_one_test::service_infos.size() - 2; if (subscribers_.size() == subscribe_notify_one_test::service_infos.size() - 2) @@ -211,10 +213,10 @@ class subscribe_notify_one_test_service : public vsomeip_utilities::base_logger void on_request(const std::shared_ptr &_message) { if(_message->get_message_type() == vsomeip::message_type_e::MT_REQUEST) { - VSOMEIP_DEBUG << "Received a request with Client/Session [" << std::setw(4) - << std::setfill('0') << std::hex << _message->get_client() << "/" - << std::setw(4) << std::setfill('0') << std::hex - << _message->get_session() << "]"; + VSOMEIP_DEBUG << "Received a request with Client/Session [" + << std::hex << std::setfill('0') + << std::setw(4) << _message->get_client() << "/" + << std::setw(4) << _message->get_session() << "]"; std::shared_ptr its_response = vsomeip::runtime::get() ->create_response(_message); app_->send(its_response); @@ -227,15 +229,15 @@ class subscribe_notify_one_test_service : public vsomeip_utilities::base_logger other_services_received_notification_[std::make_pair(_message->get_service(), _message->get_method())]++; - VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex - << service_info_.service_id << "] " - << "Received a notification with Client/Session [" << std::setw(4) - << std::setfill('0') << std::hex << _message->get_client() << "/" - << std::setw(4) << std::setfill('0') << std::hex - << _message->get_session() << "] from Service/Method [" - << std::setw(4) << std::setfill('0') << std::hex - << _message->get_service() << "/" << std::setw(4) << std::setfill('0') - << std::hex << _message->get_method() << "] (now have: " + VSOMEIP_DEBUG << "[" << std::hex << std::setfill('0') + << std::setw(4) << service_info_.service_id << "] " + << "Received a notification with Client/Session [" + << std::setw(4) << _message->get_client() << "/" + << std::setw(4) << _message->get_session() + << "] from Service/Method [" + << std::setw(4) << _message->get_service() << "/" + << std::setw(4) << _message->get_method() + << "] (now have: " << std::dec << other_services_received_notification_[std::make_pair(_message->get_service(), _message->get_method())] << ")"; @@ -275,7 +277,7 @@ class subscribe_notify_one_test_service : public vsomeip_utilities::base_logger // routing manager stub receives the notification // - twice from external nodes // - and normal from all internal nodes - VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex + VSOMEIP_DEBUG << "[" << std::hex << std::setfill('0') << std::setw(4) << service_info_.service_id << "] " << "Received notifications:" << " Normal: " << received_normal @@ -286,14 +288,14 @@ class subscribe_notify_one_test_service : public vsomeip_utilities::base_logger } void run() { - VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex + VSOMEIP_DEBUG << "[" << std::hex << std::setfill('0') << std::setw(4) << service_info_.service_id << "] Running"; std::unique_lock its_lock(mutex_); while (wait_until_registered_) { condition_.wait(its_lock); } - VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex + VSOMEIP_DEBUG << "[" << std::hex << std::setfill('0') << std::setw(4) << service_info_.service_id << "] Offering"; offer(); @@ -302,7 +304,7 @@ class subscribe_notify_one_test_service : public vsomeip_utilities::base_logger condition_.wait(its_lock); } - VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex + VSOMEIP_DEBUG << "[" << std::hex << std::setfill('0') << std::setw(4) << service_info_.service_id << "] Subscribing"; // subscribe to events of other services uint32_t subscribe_count = 0; @@ -319,9 +321,10 @@ class subscribe_notify_one_test_service : public vsomeip_utilities::base_logger VSOMEIP_DEBUG << "[" << std::hex << service_info_.service_id << "] subscribing to Service/Instance/Eventgroup [" - << std::setw(4) << std::setfill('0') << std::hex << i.service_id << "/" - << std::setw(4) << std::setfill('0') << std::hex << i.instance_id - << "/" << std::setw(4) << std::setfill('0') << std::hex << i.eventgroup_id << "]"; + << std::hex << std::setfill('0') + << std::setw(4) << i.service_id << "/" + << std::setw(4) << i.instance_id << "/" + << std::setw(4) << i.eventgroup_id << "]"; } @@ -367,7 +370,7 @@ class subscribe_notify_one_test_service : public vsomeip_utilities::base_logger its_payload->set_data(its_data, i+1); for (vsomeip::client_t client : subscribers_) { - VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex + VSOMEIP_DEBUG << "[" << std::hex << std::setfill('0') << std::setw(4) << service_info_.service_id << "] Notifying client: " << client << " : " << i+1; app_->notify_one(service_info_.service_id, service_info_.instance_id, @@ -382,7 +385,7 @@ class subscribe_notify_one_test_service : public vsomeip_utilities::base_logger while (wait_for_stop_) { stop_condition_.wait(its_lock); } - VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex + VSOMEIP_DEBUG << "[" << std::hex << std::setfill('0') << std::setw(4) << service_info_.service_id << "] Received notifications from all other services, going down"; diff --git a/test/network_tests/subscribe_notify_tests/subscribe_notify_test_one_event_two_eventgroups_client.cpp b/test/network_tests/subscribe_notify_tests/subscribe_notify_test_one_event_two_eventgroups_client.cpp index 6b3ae2940..b3b043454 100644 --- a/test/network_tests/subscribe_notify_tests/subscribe_notify_test_one_event_two_eventgroups_client.cpp +++ b/test/network_tests/subscribe_notify_tests/subscribe_notify_test_one_event_two_eventgroups_client.cpp @@ -115,7 +115,8 @@ class subscribe_notify_test_one_event_two_eventgroups_client : public vsomeip_ut vsomeip::instance_t _instance, bool _is_available) { VSOMEIP_DEBUG << "Service [" - << std::setw(4) << std::setfill('0') << std::hex << _service + << std::hex << std::setfill('0') + << std::setw(4) << _service << "." << _instance << "] is " << (_is_available ? "available." : "NOT available."); if (_service == info_.service_id && _instance == info_.instance_id && _is_available) { @@ -128,23 +129,20 @@ class subscribe_notify_test_one_event_two_eventgroups_client : public vsomeip_ut void on_message(const std::shared_ptr &_response) { std::stringstream its_message; its_message << "Received a message [" - << std::setw(4) << std::setfill('0') << std::hex - << _response->get_service() << "." - << std::setw(4) << std::setfill('0') << std::hex - << _response->get_instance() << "." - << std::setw(4) << std::setfill('0') << std::hex - << _response->get_method() << "] from Client/Session [" - << std::setw(4) << std::setfill('0') << std::hex - << _response->get_client() << "/" - << std::setw(4) << std::setfill('0') << std::hex - << _response->get_session() + << std::hex << std::setfill('0') + << std::setw(4) << _response->get_service() << "." + << std::setw(4) << _response->get_instance() << "." + << std::setw(4) << _response->get_method() << "] from Client/Session [" + << std::setw(4) << _response->get_client() << "/" + << std::setw(4) << _response->get_session() << "] = "; std::shared_ptr its_payload = _response->get_payload(); - its_message << "(" << std::dec << its_payload->get_length() << ") "; + its_message << "(" << std::dec << its_payload->get_length() << ") " + << std::hex << std::setfill('0'); for (uint32_t i = 0; i < its_payload->get_length(); ++i) - its_message << std::hex << std::setw(2) << std::setfill('0') - << (int) its_payload->get_data()[i] << " "; + its_message << std::setw(2) + << static_cast(its_payload->get_data()[i]) << " "; VSOMEIP_DEBUG << its_message.str(); ASSERT_EQ(info_.service_id, _response->get_service()); @@ -171,8 +169,9 @@ class subscribe_notify_test_one_event_two_eventgroups_client : public vsomeip_ut number_received_events_[_response->get_method()]++; events_condition_.notify_one(); } else { - ADD_FAILURE() << "Received unknown method id: " << std::setw(4) - << std::setfill('0') << std::hex << _response->get_method(); + ADD_FAILURE() << "Received unknown method id: " + << std::hex << std::setfill('0') + << std::setw(4) << _response->get_method(); } } diff --git a/test/network_tests/subscribe_notify_tests/subscribe_notify_test_service.cpp b/test/network_tests/subscribe_notify_tests/subscribe_notify_test_service.cpp index c08d46f9a..f74bb40cb 100644 --- a/test/network_tests/subscribe_notify_tests/subscribe_notify_test_service.cpp +++ b/test/network_tests/subscribe_notify_tests/subscribe_notify_test_service.cpp @@ -140,10 +140,12 @@ class subscribe_notify_test_service : public vsomeip_utilities::base_logger { if(its_service != other_services_available_.end()) { if(its_service->second != _is_available) { its_service->second = true; - VSOMEIP_INFO << "[" << std::setw(4) << std::setfill('0') << std::hex - << service_info_.service_id << "] Service [" - << std::setw(4) << std::setfill('0') << std::hex << _service << "." << _instance - << "] is available."; + VSOMEIP_INFO << "[" + << std::hex << std::setfill('0') + << std::setw(4) << service_info_.service_id + << "] Service [" + << std::setw(4) << _service << "." << _instance + << "] is available."; } } diff --git a/test/network_tests/suspend_resume_tests/suspend_resume_test_service.cpp b/test/network_tests/suspend_resume_tests/suspend_resume_test_service.cpp index 68a1c829c..e97b0d06a 100644 --- a/test/network_tests/suspend_resume_tests/suspend_resume_test_service.cpp +++ b/test/network_tests/suspend_resume_tests/suspend_resume_test_service.cpp @@ -143,12 +143,10 @@ class suspend_resume_test_service : public vsomeip_utilities::base_logger { void on_message(const std::shared_ptr &_message) { VSOMEIP_DEBUG << __func__ << "[TEST-srv]: Received " - << std::hex << std::setw(4) << std::setfill('0') - << _message->get_service() - << std::hex << std::setw(4) << std::setfill('0') - << _message->get_instance() - << std::hex << std::setw(4) << std::setfill('0') - << _message->get_method(); + << std::hex << std::setfill('0') + << std::setw(4) << _message->get_service() + << std::setw(4) << _message->get_instance() + << std::setw(4) << _message->get_method(); if (_message->get_service() == TEST_SERVICE && _message->get_instance() == TEST_INSTANCE diff --git a/tools/vsomeip_ctrl/vsomeip_ctrl.cpp b/tools/vsomeip_ctrl/vsomeip_ctrl.cpp index 9051fdc2c..82eb09448 100644 --- a/tools/vsomeip_ctrl/vsomeip_ctrl.cpp +++ b/tools/vsomeip_ctrl/vsomeip_ctrl.cpp @@ -99,8 +99,10 @@ class vsomeip_sender { void on_availability(vsomeip::service_t _service, vsomeip::instance_t _instance, bool _is_available) { if(_is_available) { - VSOMEIP_INFO << "Service [" << std::setw(4) << std::setfill('0') - << std::hex << _service << "." << _instance << "] is available."; + VSOMEIP_INFO << "Service [" + << std::hex << std::setfill('0') + << std::setw(4) << _service << "." << _instance + << "] is available."; std::lock_guard its_lock(mutex_); wait_service_available_ = false; condition_.notify_one(); @@ -109,29 +111,28 @@ class vsomeip_sender { void on_message(const std::shared_ptr &_response) { VSOMEIP_INFO << "Received a response from Service [" - << std::setfill('0') << std::hex + << std::hex << std::setfill('0') << std::setw(4) << _response->get_service() << "." << std::setw(4) << _response->get_instance() << "]:"; VSOMEIP_INFO << "########## begin message"; - VSOMEIP_INFO << std::hex << std::setw(4) << std::setfill('0') - << _response->get_service() - << std::hex << std::setw(4) << std::setfill('0') - << _response->get_method() + VSOMEIP_INFO << std::hex << std::setfill('0') + << std::setw(4) << _response->get_service() + << std::setw(4) << _response->get_method() << " # service id / instance id"; - VSOMEIP_INFO << std::hex << std::setw(8) << std::setfill('0') - << _response->get_length() << " # length"; - VSOMEIP_INFO << std::hex << std::setw(4) << std::setfill('0') - << _response->get_client() - << std::hex << std::setw(4) << std::setfill('0') - << _response->get_session() + VSOMEIP_INFO << std::hex << std::setfill('0') + << std::setw(8) << _response->get_length() << " # length"; + VSOMEIP_INFO << std::hex << std::setfill('0') + << std::setw(4) << _response->get_client() + << std::setw(4) << _response->get_session() << " # client id / session id"; - VSOMEIP_INFO << std::hex << std::setw(2) << std::setfill('0') + VSOMEIP_INFO << std::hex << std::setfill('0') + << std::setw(2) << static_cast(_response->get_protocol_version()) - << std::hex << std::setw(2) << std::setfill('0') + << std::setw(2) << static_cast(_response->get_interface_version()) - << std::hex << std::setw(2) << std::setfill('0') + << std::setw(2) << static_cast(_response->get_message_type()) - << std::hex << std::setw(2) << std::setfill('0') + << std::setw(2) << static_cast(_response->get_return_code()) << " # protocol version / interface version / " << "message type / return code"; @@ -139,9 +140,10 @@ class vsomeip_sender { std::stringstream stream; std::string str; + stream << std::hex << std::setfill('0'); for(unsigned int i = 0; i < _response->get_payload()->get_length(); i++) { - stream << std::hex << std::setw(2) << std::setfill('0') - << static_cast((_response->get_payload()->get_data())[i]); + stream << std::setw(2) + << static_cast((_response->get_payload()->get_data())[i]); str.append(stream.str()); stream.str(""); stream.clear(); @@ -210,14 +212,14 @@ class vsomeip_sender { bool validate_message() { if (!check_message_type()) { VSOMEIP_ERROR << "Invalid message type 0x" << std::setw(2) - << std::setfill('0') << std::hex + << std::hex << std::setfill('0') << static_cast(message_type_) << ", exiting."; stop(EXIT_FAILURE); } if(!check_return_code()) { VSOMEIP_ERROR << "Invalid return code 0x" << std::setw(2) - << std::setfill('0') << std::hex + << std::hex << std::setfill('0') << static_cast(return_code_) << ", exiting."; stop(EXIT_FAILURE); } @@ -231,7 +233,7 @@ class vsomeip_sender { if (user_message_.size() != length_ + 8) { VSOMEIP_ERROR << "Provided length 0x" << std::setw(8) - << std::setfill('0') << std::hex << length_ + << std::hex << std::setfill('0') << length_ << " doesn't match message size."; VSOMEIP_ERROR << "Assuming the same payload the length field should" " be set to 0x" << std::setw(8) << std::setfill('0') @@ -276,16 +278,15 @@ class vsomeip_sender { bool check_return_code() { if (static_cast(return_code_) > 0x3F) { VSOMEIP_ERROR << "Provided return code 0x" << std::setw(2) - << std::setfill('0') << std::hex + << std::hex << std::setfill('0') << static_cast(return_code_) << " is out of range."; return false; } if (static_cast(return_code_) > static_cast(vsomeip::return_code_e::E_WRONG_MESSAGE_TYPE) && static_cast(return_code_) <= 0x3f) { - VSOMEIP_ERROR << "Provided return code 0x" << std::setw(2) - << std::setfill('0') << std::hex << - static_cast(return_code_) << "is reserved."; + VSOMEIP_ERROR << "Provided return code 0x" << std::hex << std::setfill('0') + << std::setw(2) << static_cast(return_code_) << "is reserved."; return false; } switch (message_type_) { @@ -293,12 +294,11 @@ class vsomeip_sender { case vsomeip::message_type_e::MT_REQUEST_NO_RETURN: case vsomeip::message_type_e::MT_NOTIFICATION: if(return_code_ != vsomeip::return_code_e::E_OK) { - VSOMEIP_ERROR << "Provided return code 0x" << std::setw(2) - << std::setfill('0') << std::hex - << static_cast(return_code_) + VSOMEIP_ERROR << "Provided return code 0x" + << std::hex << std::setfill('0') + << std::setw(2) << static_cast(return_code_) << "is invalid in combination with message type 0x" - << std::setw(2) << std::setfill('0') << std::hex - << static_cast(message_type_) + << std::setw(2) << static_cast(message_type_) << " use 0x00 (E_OK)."; return false; }