First set of changes to make IP routing work.
diff --git a/config/vsomeip-client.xml b/config/vsomeip-client.xml
new file mode 100644
index 0000000..c4fc3b0
--- /dev/null
+++ b/config/vsomeip-client.xml
@@ -0,0 +1,46 @@
+<!-- vsomeip test configuration file -->
+<someip>
+ <address>192.168.56.101</address>
+ <logging>
+ <level>trace</level>
+ <console>true</console>
+ <file>
+ <enable>false</enable>
+ <path>/tmp/vsomeip.log</path>
+ </file>
+ <dlt>false</dlt>
+ </logging>
+ <services>
+ <servicegroup>
+ <name>remote</name>
+ <address>192.168.56.102</address>
+ <service>
+ <service-id>0x1234</service-id>
+ <instance-id>0x5678</instance-id>
+ <ports>
+ <reliable>30507</reliable>
+ </ports>
+ </service>
+ </servicegroup>
+ </services>
+ <routing>
+ <host>client-sample</host>
+ </routing>
+ <service-discovery>
+ <enabled>false</enabled>
+ <host>client-sample</host>
+ <protocol>udp</protocol>
+ <address>224.244.224.245</address>
+ <port>30490</port>
+ </service-discovery>
+ <applications>
+ <application>
+ <name>client-sample</name>
+ <id>0x1343</id>
+ </application>
+ <application>
+ <name>other-client-sample</name>
+ <id>0x1344</id>
+ </application>
+ </applications>
+</someip>
diff --git a/config/vsomeip-service.xml b/config/vsomeip-service.xml
new file mode 100644
index 0000000..e0f53c1
--- /dev/null
+++ b/config/vsomeip-service.xml
@@ -0,0 +1,51 @@
+<!-- vsomeip test configuration file -->
+<someip>
+ <address>192.168.56.102</address>
+ <logging>
+ <level>trace</level>
+ <console>true</console>
+ <file>
+ <enable>false</enable>
+ <path>/tmp/vsomeip.log</path>
+ </file>
+ <dlt>false</dlt>
+ </logging>
+ <services>
+ <servicegroup>
+ <name>default</name>
+ <delays>
+ <initial>
+ <min>10</min>
+ <max>100</max>
+ </initial>
+ <repetition-base>200</repetition-base>
+ <repetition-max>3</repetition-max>
+ <cyclic-offer>2000</cyclic-offer>
+ <cyclic-request>2001</cyclic-request>
+ </delays>
+ <service>
+ <service-id>0x1234</service-id>
+ <instance-id>0x5678</instance-id>
+ <ports>
+ <reliable>30507</reliable>
+ </ports>
+ </service>
+ </servicegroup>
+ </services>
+ <routing>
+ <host>service-sample</host>
+ </routing>
+ <service-discovery>
+ <enabled>false</enabled>
+ <host>client-sample</host>
+ <protocol>udp</protocol>
+ <address>224.244.224.245</address>
+ <port>30490</port>
+ </service-discovery>
+ <applications>
+ <application>
+ <name>service-sample</name>
+ <id>0x1277</id>
+ </application>
+ </applications>
+</someip>
diff --git a/config/vsomeip.xml b/config/vsomeip.xml
index 1221f55..adac510 100644
--- a/config/vsomeip.xml
+++ b/config/vsomeip.xml
@@ -57,9 +57,10 @@
<host>client-sample</host>
</routing>
<service-discovery>
- <enabled>true</enabled>
+ <enabled>false</enabled>
<host>client-sample</host>
<protocol>udp</protocol>
+ <address>224.244.224.245</address>
<port>30490</port>
</service-discovery>
<applications>
diff --git a/implementation/configuration/include/configuration_impl.hpp b/implementation/configuration/include/configuration_impl.hpp
index 9a1d14b..8e382df 100644
--- a/implementation/configuration/include/configuration_impl.hpp
+++ b/implementation/configuration/include/configuration_impl.hpp
@@ -60,6 +60,7 @@
bool is_service_discovery_enabled() const;
const std::string & get_service_discovery_protocol() const;
+ const std::string & get_service_discovery_address() const;
uint16_t get_service_discovery_port() const;
client_t get_id(const std::string &_name) const;
@@ -103,6 +104,7 @@
bool is_service_discovery_enabled_;
std::string service_discovery_host_;
std::string service_discovery_protocol_;
+ std::string service_discovery_address_;
uint16_t service_discovery_port_;
std::map< std::string, client_t > applications_;
diff --git a/implementation/configuration/include/internal.hpp b/implementation/configuration/include/internal.hpp
index 8dcf084..8f2bd19 100644
--- a/implementation/configuration/include/internal.hpp
+++ b/implementation/configuration/include/internal.hpp
@@ -11,45 +11,46 @@
namespace vsomeip {
-#define VSOMEIP_SD_LIBRARY "libvsomeip-sd.so"
-#define VSOMEIP_SD_RUNTIME_SYMBOL VSOMEIP_SD_RUNTIME
-#define VSOMEIP_SD_RUNTIME_SYMBOL_STRING "VSOMEIP_SD_RUNTIME"
+#define VSOMEIP_SD_LIBRARY "libvsomeip-sd.so"
+#define VSOMEIP_SD_RUNTIME_SYMBOL VSOMEIP_SD_RUNTIME
+#define VSOMEIP_SD_RUNTIME_SYMBOL_STRING "VSOMEIP_SD_RUNTIME"
-#define VSOMEIP_ROUTING_ENDPOINT "rtg"
-#define VSOMEIP_SERVICE_DISCOVERY_ENDPOINT "sd"
+#define VSOMEIP_ROUTING_ENDPOINT "rtg"
-#define VSOMEIP_DEFAULT_CONNECT_TIMEOUT 100
-#define VSOMEIP_DEFAULT_FLUSH_TIMEOUT 1000
+#define VSOMEIP_DEFAULT_CONNECT_TIMEOUT 100
+#define VSOMEIP_DEFAULT_FLUSH_TIMEOUT 1000
-#define VSOMEIP_DEFAULT_WATCHDOG_CYCLE 1000
-#define VSOMEIP_DEFAULT_WATCHDOG_TIMEOUT 1000
-#define VSOMEIP_DEFAULT_MAX_MISSING_PONGS 3
+#define VSOMEIP_DEFAULT_WATCHDOG_CYCLE 1000
+#define VSOMEIP_DEFAULT_WATCHDOG_TIMEOUT 1000
+#define VSOMEIP_DEFAULT_MAX_MISSING_PONGS 3
-#define VSOMEIP_COMMAND_HEADER_SIZE 7
+#define VSOMEIP_INVALID_PORT 0xFFFF
-#define VSOMEIP_COMMAND_TYPE_POS 0
-#define VSOMEIP_COMMAND_CLIENT_POS 1
-#define VSOMEIP_COMMAND_SIZE_POS_MIN 3
-#define VSOMEIP_COMMAND_SIZE_POS_MAX 5
-#define VSOMEIP_COMMAND_PAYLOAD_POS 7
+#define VSOMEIP_COMMAND_HEADER_SIZE 7
-#define VSOMEIP_REGISTER_APPLICATION 0x00
-#define VSOMEIP_DEREGISTER_APPLICATION 0x01
-#define VSOMEIP_APPLICATION_LOST 0x02
-#define VSOMEIP_ROUTING_INFO 0x03
+#define VSOMEIP_COMMAND_TYPE_POS 0
+#define VSOMEIP_COMMAND_CLIENT_POS 1
+#define VSOMEIP_COMMAND_SIZE_POS_MIN 3
+#define VSOMEIP_COMMAND_SIZE_POS_MAX 5
+#define VSOMEIP_COMMAND_PAYLOAD_POS 7
-#define VSOMEIP_PING 0x0E
-#define VSOMEIP_PONG 0x0F
+#define VSOMEIP_REGISTER_APPLICATION 0x00
+#define VSOMEIP_DEREGISTER_APPLICATION 0x01
+#define VSOMEIP_APPLICATION_LOST 0x02
+#define VSOMEIP_ROUTING_INFO 0x03
-#define VSOMEIP_OFFER_SERVICE 0x10
-#define VSOMEIP_STOP_OFFER_SERVICE 0x11
-#define VSOMEIP_PUBLISH_EVENTGROUP 0x12
-#define VSOMEIP_STOP_PUBLISH_EVENTGROUP 0x13
-#define VSOMEIP_ADD_EVENT 0x14
-#define VSOMEIP_ADD_FIELD 0x15
-#define VSOMEIP_REMOVE_EVENT_OR_FIELD 0x16
-#define VSOMEIP_SEND 0x17
-#define VSOMEIP_SET 0x18
+#define VSOMEIP_PING 0x0E
+#define VSOMEIP_PONG 0x0F
+
+#define VSOMEIP_OFFER_SERVICE 0x10
+#define VSOMEIP_STOP_OFFER_SERVICE 0x11
+#define VSOMEIP_PUBLISH_EVENTGROUP 0x12
+#define VSOMEIP_STOP_PUBLISH_EVENTGROUP 0x13
+#define VSOMEIP_ADD_EVENT 0x14
+#define VSOMEIP_ADD_FIELD 0x15
+#define VSOMEIP_REMOVE_EVENT_OR_FIELD 0x16
+#define VSOMEIP_SEND 0x17
+#define VSOMEIP_SET 0x18
#define VSOMEIP_OFFER_SERVICE_COMMAND_SIZE 20
#define VSOMEIP_STOP_OFFER_SERVICE_COMMAND_SIZE 11
diff --git a/implementation/configuration/src/configuration_impl.cpp b/implementation/configuration/src/configuration_impl.cpp
index 53bad42..cbad8b4 100644
--- a/implementation/configuration/src/configuration_impl.cpp
+++ b/implementation/configuration/src/configuration_impl.cpp
@@ -333,6 +333,8 @@
service_discovery_host_ = its_value;
} else if (its_key == "protocol") {
service_discovery_protocol_ = its_value;
+ } else if (its_key == "address") {
+ service_discovery_address_ = its_value;
} else if (its_key == "port") {
its_converter << its_value;
its_converter >> service_discovery_port_;
@@ -560,6 +562,10 @@
return service_discovery_protocol_;
}
+const std::string & configuration_impl::get_service_discovery_address() const {
+ return service_discovery_address_;
+}
+
uint16_t configuration_impl::get_service_discovery_port() const {
return service_discovery_port_;
}
diff --git a/implementation/routing/include/routing_manager_impl.hpp b/implementation/routing/include/routing_manager_impl.hpp
index cac752a..4769c91 100644
--- a/implementation/routing/include/routing_manager_impl.hpp
+++ b/implementation/routing/include/routing_manager_impl.hpp
@@ -106,29 +106,39 @@
bool is_available(service_t _service, instance_t _instance) const;
+ // interface to stub
+ endpoint * create_local(client_t _client);
endpoint * find_local(client_t _client);
endpoint * find_or_create_local(client_t _client);
void remove_local(client_t _client);
endpoint * find_local(service_t _service, instance_t _instance);
+ // interface "service_discovery_host"
const std::map< std::string, std::shared_ptr< servicegroup > > & get_servicegroups() const;
service_map_t get_offered_services(const std::string &_name) const;
+ void create_service_discovery_endpoint(const std::string &_address,
+ uint16_t _port, const std::string &_protocol);
private:
void on_message(const byte_t *_data, length_t _length, instance_t _instance);
- client_t find_client(service_t _service, instance_t _instance);
+ client_t find_local_client(service_t _service, instance_t _instance);
instance_t find_instance(service_t _service, endpoint *_endpoint);
serviceinfo * find_service(service_t _service, instance_t _instance);
void create_service(service_t _service, instance_t _instance,
major_version_t _major, minor_version_t _minor, ttl_t _ttl);
- endpoint * find_service_endpoint(uint16_t _port, bool _reliable);
- endpoint * create_service_endpoint(uint16_t _port, bool _reliable);
- endpoint * find_or_create_service_endpoint(uint16_t _port, bool _reliable);
- endpoint * create_local(client_t _client);
+ std::shared_ptr< endpoint > create_client_endpoint(const std::string &_address, uint16_t _port, bool _reliable);
+ std::shared_ptr< endpoint > find_client_endpoint(const std::string &_address, uint16_t _port, bool _reliable);
+ std::shared_ptr< endpoint > find_or_create_client_endpoint(const std::string &_address, uint16_t _port, bool _reliable);
+
+ std::shared_ptr< endpoint > create_server_endpoint(uint16_t _port, bool _reliable);
+ std::shared_ptr< endpoint > find_server_endpoint(uint16_t _port, bool _reliable);
+ std::shared_ptr< endpoint > find_or_create_server_endpoint(uint16_t _port, bool _reliable);
+
+ void init_routing_info();
private:
boost::asio::io_service &io_;
@@ -149,10 +159,13 @@
std::map< service_t, std::map< instance_t, client_t > > local_services_;
// Server endpoints for local services
- std::map< uint16_t, std::map< bool, std::shared_ptr< endpoint > > > service_endpoints_;
+ std::map< uint16_t, std::map< bool, std::shared_ptr< endpoint > > > server_endpoints_;
std::map< service_t, std::map< endpoint *, instance_t > > service_instances_;
// Client endpoints for remote services
+ std::map< std::string,
+ std::map< uint16_t,
+ std::map< bool, std::shared_ptr< endpoint > > > > client_endpoints_;
std::map< service_t,
std::map< instance_t,
std::map< bool, std::shared_ptr< endpoint > > > > remote_services_;
diff --git a/implementation/routing/src/routing_manager_impl.cpp b/implementation/routing/src/routing_manager_impl.cpp
index 6d8d94a..f7f4c80 100644
--- a/implementation/routing/src/routing_manager_impl.cpp
+++ b/implementation/routing/src/routing_manager_impl.cpp
@@ -27,6 +27,7 @@
#include "../../message/include/deserializer.hpp"
#include "../../message/include/event_impl.hpp"
#include "../../message/include/serializer.hpp"
+#include "../../service_discovery/include/constants.hpp"
#include "../../service_discovery/include/runtime.hpp"
#include "../../service_discovery/include/service_discovery_impl.hpp"
#include "../../utility/include/utility.hpp"
@@ -80,6 +81,8 @@
discovery_ = (*its_runtime)->create_service_discovery(this);
discovery_->init();
}
+ } else {
+ init_routing_info();
}
}
@@ -258,10 +261,14 @@
// Check whether hosting application should get the message
// If not, check routes to external
if ((its_client == host_->get_client() && !is_request) ||
- (find_client(its_service, _instance) == host_->get_client() && is_request)) {
+ (find_local_client(its_service, _instance) == host_->get_client() && is_request)) {
on_message(_data, _size, _instance);
} else {
- VSOMEIP_ERROR << "Must route to other device. Not implemented yet.";
+ if (is_request) {
+
+ } else {
+
+ }
}
}
}
@@ -332,6 +339,20 @@
return host_->get_configuration();
}
+void routing_manager_impl::create_service_discovery_endpoint(
+ const std::string &_address, uint16_t _port, const std::string &_protocol) {
+/*
+ endpoint *its_endpoint = find_service_endpoint(sd::VSOMEIP_SD_SERVICE, sd::VSOMEIP_SD_INSTANCE);
+ if (nullptr != its_endpoint) {
+ bool is_reliable = (_protocol != "udp");
+
+ its_endpoint = create_service_endpoint(_port, is_reliable);
+ its_endpoint->join(_address);
+ its_endpoint->start();
+ }
+*/
+}
+
service_map_t routing_manager_impl::get_offered_services(const std::string &_name) const {
service_map_t its_offers;
@@ -371,7 +392,7 @@
if (its_reliable_port != VSOMEIP_ILLEGAL_PORT) {
std::shared_ptr< endpoint > its_reliable_endpoint(
- find_or_create_service_endpoint(its_reliable_port, true));
+ find_or_create_server_endpoint(its_reliable_port, true));
its_info->set_reliable_endpoint(its_reliable_endpoint);
// TODO: put this in a method and check whether an assignment already exists!
@@ -380,7 +401,7 @@
if (its_unreliable_port != VSOMEIP_ILLEGAL_PORT) {
std::shared_ptr< endpoint > its_unreliable_endpoint(
- find_or_create_service_endpoint(its_unreliable_port, false));
+ find_or_create_server_endpoint(its_unreliable_port, false));
its_info->set_unreliable_endpoint(its_unreliable_endpoint);
service_instances_[_service][its_unreliable_endpoint.get()] = _instance;
@@ -402,38 +423,27 @@
}
}
-endpoint * routing_manager_impl::find_service_endpoint(uint16_t _port, bool _reliable) {
- endpoint *its_endpoint(0);
-
- auto found_port = service_endpoints_.find(_port);
- if (found_port != service_endpoints_.end()) {
- auto found_endpoint = found_port->second.find(_reliable);
- if (found_endpoint != found_port->second.end()) {
- its_endpoint = found_endpoint->second.get();
- }
- }
-
- return its_endpoint;
-}
-
-endpoint * routing_manager_impl::create_service_endpoint(uint16_t _port, bool _reliable) {
- endpoint *its_endpoint(0);
+std::shared_ptr< endpoint > routing_manager_impl::create_client_endpoint(
+ const std::string &_address, uint16_t _port, bool _reliable) {
+ std::shared_ptr< endpoint > its_endpoint;
try {
- boost::asio::ip::address its_address = configuration_->get_address();
+ boost::asio::ip::address its_address = boost::asio::ip::address::from_string(_address);
if (_reliable) {
- its_endpoint = new tcp_server_endpoint_impl(
+ its_endpoint = std::make_shared< tcp_client_endpoint_impl >(
shared_from_this(),
boost::asio::ip::tcp::endpoint(its_address, _port),
io_
);
} else {
- its_endpoint = new udp_server_endpoint_impl(
+ its_endpoint = std::make_shared< udp_client_endpoint_impl >(
shared_from_this(),
boost::asio::ip::udp::endpoint(its_address, _port),
io_
);
}
+
+ client_endpoints_[_address][_port][_reliable] = its_endpoint;
}
catch (std::exception &e) {
host_->on_error(); // Define error for "Server endpoint could not be created. Reason: ...
@@ -442,10 +452,75 @@
return its_endpoint;
}
-endpoint * routing_manager_impl::find_or_create_service_endpoint(uint16_t _port, bool _reliable) {
- endpoint *its_endpoint = find_service_endpoint(_port, _reliable);
+std::shared_ptr< endpoint > routing_manager_impl::find_client_endpoint(
+ const std::string &_address, uint16_t _port, bool _reliable) {
+ std::shared_ptr< endpoint > its_endpoint;
+ auto found_address = client_endpoints_.find(_address);
+ if (found_address != client_endpoints_.end()) {
+ auto found_port = found_address->second.find(_port);
+ if (found_port != found_address->second.end()) {
+ auto found_endpoint = found_port->second.find(_reliable);
+ if (found_endpoint != found_port->second.end()) {
+ its_endpoint = found_endpoint->second;
+ }
+ }
+ }
+ return its_endpoint;
+}
+
+std::shared_ptr< endpoint > routing_manager_impl::find_or_create_client_endpoint(
+ const std::string &_address, uint16_t _port, bool _reliable) {
+ std::shared_ptr< endpoint > its_endpoint = find_client_endpoint(_address, _port, _reliable);
if (0 == its_endpoint) {
- its_endpoint = create_service_endpoint(_port, _reliable);
+ its_endpoint = create_client_endpoint(_address, _port, _reliable);
+ }
+ return its_endpoint;
+}
+
+std::shared_ptr< endpoint > routing_manager_impl::create_server_endpoint(uint16_t _port, bool _reliable) {
+ std::shared_ptr< endpoint > its_endpoint;
+
+ try {
+ boost::asio::ip::address its_address = configuration_->get_address();
+ if (_reliable) {
+ its_endpoint = std::make_shared< tcp_server_endpoint_impl >(
+ shared_from_this(),
+ boost::asio::ip::tcp::endpoint(its_address, _port),
+ io_
+ );
+ } else {
+ its_endpoint = std::make_shared< udp_server_endpoint_impl >(
+ shared_from_this(),
+ boost::asio::ip::udp::endpoint(its_address, _port),
+ io_
+ );
+ }
+
+ server_endpoints_[_port][_reliable] = its_endpoint;
+ }
+ catch (std::exception &e) {
+ host_->on_error(); // Define error for "Server endpoint could not be created. Reason: ...
+ }
+
+ return its_endpoint;
+}
+
+std::shared_ptr< endpoint > routing_manager_impl::find_server_endpoint(uint16_t _port, bool _reliable) {
+ std::shared_ptr< endpoint > its_endpoint;
+ auto found_port = server_endpoints_.find(_port);
+ if (found_port != server_endpoints_.end()) {
+ auto found_endpoint = found_port->second.find(_reliable);
+ if (found_endpoint != found_port->second.end()) {
+ its_endpoint = found_endpoint->second;
+ }
+ }
+ return its_endpoint;
+}
+
+std::shared_ptr< endpoint > routing_manager_impl::find_or_create_server_endpoint(uint16_t _port, bool _reliable) {
+ std::shared_ptr< endpoint > its_endpoint = find_server_endpoint(_port, _reliable);
+ if (0 == its_endpoint) {
+ its_endpoint = create_server_endpoint(_port, _reliable);
}
return its_endpoint;
}
@@ -492,10 +567,10 @@
}
endpoint * routing_manager_impl::find_local(service_t _service, instance_t _instance) {
- return find_local(find_client(_service, _instance));
+ return find_local(find_local_client(_service, _instance));
}
-client_t routing_manager_impl::find_client(service_t _service, instance_t _instance) {
+client_t routing_manager_impl::find_local_client(service_t _service, instance_t _instance) {
client_t its_client(0);
auto found_service = local_services_.find(_service);
if (found_service != local_services_.end()) {
@@ -519,4 +594,25 @@
return its_instance;
}
+void routing_manager_impl::init_routing_info() {
+ VSOMEIP_INFO << "Service Discovery disabled. Using static routing information.";
+ for (auto i : configuration_->get_remote_services()) {
+ std::string its_address = configuration_->get_address(i.first, i.second);
+ uint16_t its_reliable_port = configuration_->get_reliable_port(i.first, i.second);
+ uint16_t its_unreliable_port = configuration_->get_unreliable_port(i.first, i.second);
+
+ if (VSOMEIP_INVALID_PORT != its_reliable_port) {
+ VSOMEIP_DEBUG << "Configuring [" << std::hex << i.first << "." << i.second
+ << "] --> (TCP:" << its_address << ":" << std::dec << its_reliable_port << ")";
+ remote_services_[i.first][i.second][true] = create_client_endpoint(its_address, its_reliable_port, true);
+ }
+
+ if (VSOMEIP_INVALID_PORT != its_unreliable_port) {
+ VSOMEIP_DEBUG << "Configuring [" << std::hex << i.first << "." << i.second
+ << "] --> (UDP:" << its_address << ":" << std::dec << its_unreliable_port << ")";
+ remote_services_[i.first][i.second][false] = create_client_endpoint(its_address, its_unreliable_port, false);
+ }
+ }
+}
+
} // namespace vsomeip
diff --git a/implementation/service_discovery/include/service_discovery_host.hpp b/implementation/service_discovery/include/service_discovery_host.hpp
index 61f068c..8a9d486 100644
--- a/implementation/service_discovery/include/service_discovery_host.hpp
+++ b/implementation/service_discovery/include/service_discovery_host.hpp
@@ -27,6 +27,9 @@
virtual boost::asio::io_service & get_io() = 0;
virtual std::shared_ptr< configuration > get_configuration() const = 0;
+ virtual void create_service_discovery_endpoint(
+ const std::string &_address, uint16_t _port, const std::string &_protocol) = 0;
+
virtual service_map_t get_offered_services(const std::string &_name) const = 0;
virtual void send(client_t _client, std::shared_ptr< message > _message, bool _flush, bool _reliable) = 0;
diff --git a/implementation/service_discovery/include/service_discovery_impl.hpp b/implementation/service_discovery/include/service_discovery_impl.hpp
index ac10b53..8110f6c 100644
--- a/implementation/service_discovery/include/service_discovery_impl.hpp
+++ b/implementation/service_discovery/include/service_discovery_impl.hpp
@@ -12,7 +12,6 @@
#include <set>
#include "service_discovery.hpp"
-#include "../../endpoints/include/endpoint_host.hpp"
#include "../../routing/include/routing_types.hpp"
namespace vsomeip {
@@ -26,7 +25,6 @@
class service_discovery_impl:
public service_discovery,
- public endpoint_host,
public std::enable_shared_from_this< service_discovery_impl > {
public:
service_discovery_impl(service_discovery_host *_host);
@@ -64,8 +62,6 @@
std::shared_ptr< service_discovery_fsm > > additional_;
service_map_t requested_;
-
- std::shared_ptr< endpoint > endpoint_;
};
} // namespace sd
diff --git a/implementation/service_discovery/src/service_discovery_impl.cpp b/implementation/service_discovery/src/service_discovery_impl.cpp
index bb86bb9..3b5cebf 100644
--- a/implementation/service_discovery/src/service_discovery_impl.cpp
+++ b/implementation/service_discovery/src/service_discovery_impl.cpp
@@ -57,25 +57,14 @@
VSOMEIP_ERROR << "SD: no configuration found!";
}
- // SD endpoint
- boost::asio::ip::address its_address = its_configuration->get_address();
- uint16_t its_port = its_configuration->get_service_discovery_port();
- if (its_configuration->get_service_discovery_protocol() == "tcp") {
- endpoint_ = std::make_shared< tcp_server_endpoint_impl >(
- shared_from_this(),
- boost::asio::ip::tcp::endpoint(its_address, its_port),
- io_);
- } else {
- endpoint_ = std::make_shared< udp_server_endpoint_impl >(
- shared_from_this(),
- boost::asio::ip::udp::endpoint(its_address, its_port),
- io_);
- }
+ host_->create_service_discovery_endpoint(
+ its_configuration->get_service_discovery_address(),
+ its_configuration->get_service_discovery_port(),
+ its_configuration->get_service_discovery_protocol()
+ );
}
void service_discovery_impl::start() {
- endpoint_->start();
-
default_->start();
for (auto &its_group : additional_) {
its_group.second->start();
diff --git a/interface/vsomeip/configuration.hpp b/interface/vsomeip/configuration.hpp
index 10f3459..cc08c35 100644
--- a/interface/vsomeip/configuration.hpp
+++ b/interface/vsomeip/configuration.hpp
@@ -39,6 +39,7 @@
virtual bool is_service_discovery_enabled() const = 0;
virtual const std::string & get_service_discovery_protocol() const = 0;
+ virtual const std::string & get_service_discovery_address() const = 0;
virtual uint16_t get_service_discovery_port() const = 0;
virtual std::string get_group(service_t _service, instance_t _instance) const = 0;