| 173 | } |
| 174 | |
| 175 | void routing_manager_impl::start() { |
| 176 | ep_mgr_impl_->start(); |
| 177 | |
| 178 | #if defined(__linux__) |
| 179 | boost::asio::ip::address its_multicast; |
| 180 | try { |
| 181 | its_multicast = boost::asio::ip::make_address(configuration_->get_sd_multicast()); |
| 182 | } catch (...) { |
| 183 | VSOMEIP_ERROR << "Illegal multicast address \"" << configuration_->get_sd_multicast() << "\". Please check your configuration."; |
| 184 | } |
| 185 | |
| 186 | std::stringstream its_netmask_or_prefix; |
| 187 | auto its_unicast = configuration_->get_unicast_address(); |
| 188 | if (its_unicast.is_v4()) |
| 189 | its_netmask_or_prefix << "netmask:" << configuration_->get_netmask().to_string(); |
| 190 | else |
| 191 | its_netmask_or_prefix << "prefix:" << configuration_->get_prefix(); |
| 192 | |
| 193 | VSOMEIP_INFO << "Client [" << hex4(get_client()) << "] routes unicast:" << its_unicast.to_string() << ", " |
| 194 | << its_netmask_or_prefix.str(); |
| 195 | |
| 196 | netlink_connector_ = |
| 197 | abstract_socket_factory::get()->create_netlink_connector(host_->get_io(), configuration_->get_unicast_address(), its_multicast); |
| 198 | netlink_connector_->register_net_if_changes_handler(std::bind(&routing_manager_impl::on_net_interface_or_route_state_changed, this, |
| 199 | std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); |
| 200 | netlink_connector_->start(); |
| 201 | #else |
| 202 | start_ip_routing(); |
| 203 | #endif |
| 204 | |
| 205 | stub_->start(); |
| 206 | |
| 207 | #if defined(__linux__) || defined(__QNX__) |
| 208 | if (configuration_->log_memory()) { |
| 209 | std::scoped_lock its_lock{memory_log_timer_mutex_}; |
| 210 | memory_log_timer_.expires_after(std::chrono::seconds(0)); |
| 211 | memory_log_timer_.async_wait(std::bind(&routing_manager_impl::memory_log_timer_cbk, this, std::placeholders::_1)); |
| 212 | } |
| 213 | #endif |
| 214 | { |
| 215 | std::scoped_lock its_lock{log_timer_mutex_}; |
| 216 | if (configuration_->get_version_log_interval(host_->get_name(), true) > 0) { |
| 217 | version_log_timer_.expires_after(std::chrono::seconds(0)); |
| 218 | version_log_timer_.async_wait([this](boost::system::error_code const& ec) { this->version_log_timer_cbk(ec, 0); }); |
| 219 | } |
| 220 | |
| 221 | if (configuration_->get_status_log_interval(host_->get_name(), true) > 0) { |
| 222 | status_log_timer_.expires_after(std::chrono::seconds(0)); |
| 223 | status_log_timer_.async_wait([this](boost::system::error_code const& ec) { this->status_log_timer_cbk(ec); }); |
| 224 | } |
| 225 | |
| 226 | if (configuration_->log_statistics()) { |
| 227 | statistics_log_timer_.expires_after(std::chrono::seconds(0)); |
| 228 | statistics_log_timer_.async_wait(std::bind(&routing_manager_impl::statistics_log_timer_cbk, this, std::placeholders::_1)); |
| 229 | } |
| 230 | } |
| 231 | |
| 232 | VSOMEIP_INFO << VSOMEIP_INTERNAL_ROUTING_READY_MESSAGE; |
no test coverage detected