| 126 | } |
| 127 | |
| 128 | void routing_manager_impl::init() { |
| 129 | |
| 130 | stub_ = std::make_shared<routing_manager_stub>(this, configuration_); |
| 131 | stub_->init(); |
| 132 | |
| 133 | if (configuration_->is_sd_enabled()) { |
| 134 | VSOMEIP_INFO << "Service Discovery enabled. Trying to load module."; |
| 135 | auto its_plugin = plugin_manager::get()->get_plugin(plugin_type_e::SD_RUNTIME_PLUGIN, VSOMEIP_SD_LIBRARY); |
| 136 | if (its_plugin) { |
| 137 | VSOMEIP_INFO << "Service Discovery module loaded."; |
| 138 | discovery_ = std::dynamic_pointer_cast<sd::runtime>(its_plugin)->create_service_discovery(this, configuration_); |
| 139 | discovery_->init(); |
| 140 | // Only enable stop offer graceful timer if SD is enabled. |
| 141 | stop_offer_graceful_timer_.expires_after(std::chrono::milliseconds(configuration_->get_sd_cyclic_offer_delay())); |
| 142 | stop_offer_graceful_timer_.async_wait( |
| 143 | std::bind(&routing_manager_impl::stop_offer_graceful_timeout, shared_from_this(), std::placeholders::_1)); |
| 144 | } else { |
| 145 | VSOMEIP_ERROR << "Service Discovery module could not be loaded!"; |
| 146 | std::exit(EXIT_FAILURE); |
| 147 | } |
| 148 | } |
| 149 | |
| 150 | #ifndef ANDROID |
| 151 | if (configuration_->is_e2e_enabled()) { |
| 152 | VSOMEIP_INFO << "E2E protection enabled."; |
| 153 | |
| 154 | const char* its_e2e_module = VSOMEIP_GETENV(VSOMEIP_ENV_E2E_PROTECTION_MODULE); |
| 155 | std::string plugin_name = its_e2e_module != nullptr ? its_e2e_module : VSOMEIP_E2E_LIBRARY; |
| 156 | |
| 157 | auto its_plugin = plugin_manager::get()->get_plugin(plugin_type_e::APPLICATION_PLUGIN, plugin_name); |
| 158 | if (its_plugin) { |
| 159 | VSOMEIP_INFO << "E2E module loaded."; |
| 160 | e2e_provider_ = std::dynamic_pointer_cast<e2e::e2e_provider>(its_plugin); |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | if (e2e_provider_) { |
| 165 | std::map<e2exf::data_identifier_t, std::shared_ptr<cfg::e2e>> its_e2e_configuration = configuration_->get_e2e_configuration(); |
| 166 | for (auto& identifier : its_e2e_configuration) { |
| 167 | if (!e2e_provider_->add_configuration(identifier.second)) { |
| 168 | VSOMEIP_INFO << "Unknown E2E profile: " << identifier.second->profile << ", skipping ..."; |
| 169 | } |
| 170 | } |
| 171 | } |
| 172 | #endif |
| 173 | } |
| 174 | |
| 175 | void routing_manager_impl::start() { |
| 176 | ep_mgr_impl_->start(); |
nothing calls this directly
no test coverage detected