Skip to content

Commit

Permalink
Reworkd transport layer struct for MulticastConfiguration.
Browse files Browse the repository at this point in the history
  • Loading branch information
Peguen committed Dec 10, 2024
1 parent 7ba8e0a commit 193104c
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 31 deletions.
1 change: 0 additions & 1 deletion ecal/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
34 changes: 12 additions & 22 deletions ecal/core/include/ecal/config/transport_layer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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;
}
};
}

Expand Down
6 changes: 3 additions & 3 deletions ecal/core/src/config/builder/logging_attribute_builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 193104c

Please sign in to comment.