diff --git a/ecal/core/CMakeLists.txt b/ecal/core/CMakeLists.txt index 6d510030da..386621d997 100644 --- a/ecal/core/CMakeLists.txt +++ b/ecal/core/CMakeLists.txt @@ -68,7 +68,6 @@ set(ecal_config_src src/config/default_configuration.cpp src/config/ecal_config.cpp src/config/ecal_config_initializer.cpp - src/config/transport_layer.cpp src/types/ecal_custom_data_types.cpp ) if (ECAL_CORE_CONFIGURATION) diff --git a/ecal/core/include/ecal/config/transport_layer.h b/ecal/core/include/ecal/config/transport_layer.h index 0a30caedc2..bce6d4e508 100644 --- a/ecal/core/include/ecal/config/transport_layer.h +++ b/ecal/core/include/ecal/config/transport_layer.h @@ -33,25 +33,12 @@ namespace eCAL { namespace UDP { - namespace Network + struct MulticastConfiguration { - struct Configuration - { - Types::IpAddressV4 group { "239.0.0.1" }; //!< UDP multicast group base (Default: 239.0.0.1) - unsigned int ttl { 3U }; /*!< UDP ttl value, also known as hop limit, is used in determining - the intermediate routers being traversed towards the destination (Default: 3) */ - }; - } - - namespace Local - { - struct Configuration - { - Types::IpAddressV4 group { "127.255.255.255" }; //!< UDP multicast group base (Default: 127.255.255.255) - unsigned int ttl { 1U }; /*!< UDP ttl value, also known as hop limit, is used in determining - the intermediate routers being traversed towards the destination (Default: 1) */ - }; - } + Types::IpAddressV4 group{"239.0.0.1"}; //!< UDP multicast group base + unsigned int ttl; /*!< UDP ttl value, also known as hop limit, is used in determining + the intermediate routers being traversed towards the destination */ + }; struct Configuration { @@ -70,10 +57,13 @@ namespace eCAL receive data if they are started before network devices are up and running. (Default: false)*/ bool npcap_enabled { false }; //!< Enable to receive UDP traffic with the Npcap based receiver (Default: false) - Network::Configuration network; - const Local::Configuration local; - - ECAL_API Configuration& operator=(const Configuration& other); + MulticastConfiguration network { "239.0.0.1", 3U }; //!< default: "239.0.0.1", 3U + + static const MulticastConfiguration& local() + { + static const MulticastConfiguration local { "127.255.255.255", 1U}; //!< default: "127.255.255.255", 1U + return local; + } }; } diff --git a/ecal/core/src/config/builder/logging_attribute_builder.cpp b/ecal/core/src/config/builder/logging_attribute_builder.cpp index b6459defd9..7ebda9b051 100644 --- a/ecal/core/src/config/builder/logging_attribute_builder.cpp +++ b/ecal/core/src/config/builder/logging_attribute_builder.cpp @@ -46,8 +46,8 @@ namespace eCAL attributes.udp_config.ttl = tl_config_.udp.network.ttl; break; case Types::UDPMode::LOCAL: - attributes.udp_config.address = tl_config_.udp.local.group; - attributes.udp_config.ttl = tl_config_.udp.local.ttl; + attributes.udp_sender.address = tl_config_.udp.local().group; + attributes.udp_sender.ttl = tl_config_.udp.local().ttl; break; default: break; @@ -77,7 +77,7 @@ namespace eCAL attributes.udp_receiver.address = tl_config_.udp.network.group; break; case Types::UDPMode::LOCAL: - attributes.udp_receiver.address = tl_config_.udp.local.group; + attributes.udp_receiver.address = tl_config_.udp.local().group; break; default: break; diff --git a/ecal/core/src/config/builder/registration_attribute_builder.cpp b/ecal/core/src/config/builder/registration_attribute_builder.cpp index 45d1032d41..465c2e47f8 100644 --- a/ecal/core/src/config/builder/registration_attribute_builder.cpp +++ b/ecal/core/src/config/builder/registration_attribute_builder.cpp @@ -49,8 +49,8 @@ namespace eCAL attr.udp.network.group = tl_udp_confi_.network.group; attr.udp.network.ttl = tl_udp_confi_.network.ttl; - attr.udp.local.group = tl_udp_confi_.local.group; - attr.udp.local.ttl = tl_udp_confi_.local.ttl; + attr.udp.local.group = tl_udp_confi_.local().group; + attr.udp.local.ttl = tl_udp_confi_.local().ttl; return attr; } diff --git a/ecal/core/src/pubsub/config/builder/reader_attribute_builder.cpp b/ecal/core/src/pubsub/config/builder/reader_attribute_builder.cpp index 2703e0a499..c3249fa932 100644 --- a/ecal/core/src/pubsub/config/builder/reader_attribute_builder.cpp +++ b/ecal/core/src/pubsub/config/builder/reader_attribute_builder.cpp @@ -44,7 +44,7 @@ namespace eCAL attributes.udp.port = tl_config_.udp.port; attributes.udp.receivebuffer = tl_config_.udp.receive_buffer; - attributes.udp.local.group = tl_config_.udp.local.group; + attributes.udp.local.group = tl_config_.udp.local().group; attributes.udp.network.group = tl_config_.udp.network.group; diff --git a/ecal/core/src/pubsub/config/builder/writer_attribute_builder.cpp b/ecal/core/src/pubsub/config/builder/writer_attribute_builder.cpp index 6d12889cc2..081e3a3046 100644 --- a/ecal/core/src/pubsub/config/builder/writer_attribute_builder.cpp +++ b/ecal/core/src/pubsub/config/builder/writer_attribute_builder.cpp @@ -57,8 +57,8 @@ namespace eCAL attributes.udp.network.group = tl_config_.udp.network.group; attributes.udp.network.ttl = tl_config_.udp.network.ttl; - attributes.udp.local.group = tl_config_.udp.local.group; - attributes.udp.local.ttl = tl_config_.udp.local.ttl; + attributes.udp.local.group = tl_config_.udp.local().group; + attributes.udp.local.ttl = tl_config_.udp.local().ttl; attributes.tcp.enable = pub_config_.layer.tcp.enable; attributes.tcp.thread_pool_size = tl_config_.tcp.number_executor_writer;