Skip to content

Commit

Permalink
Make local udp config unconst again.
Browse files Browse the repository at this point in the history
  • Loading branch information
Peguen committed Dec 11, 2024
1 parent 73f2d4b commit 085aca9
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 26 deletions.
25 changes: 10 additions & 15 deletions ecal/core/include/ecal/config/transport_layer.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,28 +42,23 @@ namespace eCAL

struct Configuration
{
Types::UdpConfigVersion config_version { Types::UdpConfigVersion::V2 }; /*!< UDP configuration version (Since eCAL 5.12.)
Types::UdpConfigVersion config_version { Types::UdpConfigVersion::V2 }; /*!< UDP configuration version (Since eCAL 5.12.)
v1: default behavior
v2: new behavior, comes with a bit more intuitive handling regarding masking of the groups (Default: v2) */
unsigned int port { 14002 }; /*!< UDP multicast port number (Default: 14002) */
Types::UDPMode mode { Types::UDPMode::LOCAL }; /*!< Valid modes: local, network (Default: local)*/
Types::IpAddressV4 mask { "255.255.255.240" }; /*!< v1: Mask maximum number of dynamic multicast group (Default: 0.0.0.1-0.0.0.255)
unsigned int port { 14002 }; /*!< UDP multicast port number (Default: 14002) */
Types::UDPMode mode { Types::UDPMode::LOCAL }; /*!< Valid modes: local, network (Default: local)*/
Types::IpAddressV4 mask { "255.255.255.240" }; /*!< v1: Mask maximum number of dynamic multicast group (Default: 0.0.0.1-0.0.0.255)
v2: masks are now considered like routes masking (Default: 255.0.0.0-255.255.255.255)*/

unsigned int send_buffer { 5242880 }; //!< UDP send buffer in bytes (Default: 5242880)
unsigned int receive_buffer { 5242880 }; //!< UDP receive buffer in bytes (Default: 5242880)
bool join_all_interfaces { false }; /*!< Linux specific setting to enable joining multicast groups on all network interfacs
unsigned int send_buffer { 5242880 }; //!< UDP send buffer in bytes (Default: 5242880)
unsigned int receive_buffer { 5242880 }; //!< UDP receive buffer in bytes (Default: 5242880)
bool join_all_interfaces { false }; /*!< Linux specific setting to enable joining multicast groups on all network interfacs
independent of their link state. Enabling this makes sure that eCAL processes
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)
bool npcap_enabled { false }; //!< Enable to receive UDP traffic with the Npcap based receiver (Default: false)

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;
}
MulticastConfiguration network { "239.0.0.1", 3U }; //!< default: "239.0.0.1", 3U
MulticastConfiguration local { "127.255.255.255", 1U}; //!< default: "127.255.255.255", 1U
};
}

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_config.address = tl_config_.udp.local.group;
attributes.udp_config.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
2 changes: 2 additions & 0 deletions ecal/core/src/config/configuration_to_yaml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ namespace YAML
node["join_all_interfaces"] = config_.join_all_interfaces;
node["npcap_enabled"] = config_.npcap_enabled;
node["network"] = config_.network;
node["local"] = config_.local;
return node;
}

Expand All @@ -266,6 +267,7 @@ namespace YAML
AssignValue<bool>(config_.npcap_enabled, node_, "npcap_enabled");

AssignValue<eCAL::TransportLayer::UDP::MulticastConfiguration>(config_.network, node_, "network");
AssignValue<eCAL::TransportLayer::UDP::MulticastConfiguration>(config_.local, node_, "local");
return true;
}

Expand Down
6 changes: 3 additions & 3 deletions ecal/core/src/config/default_configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,12 @@ namespace eCAL
ss << R"( # Windows specific setting to enable receiving UDP traffic with the Npcap based receiver)" << "\n";
ss << R"( npcap_enabled: )" << config_.transport_layer.udp.npcap_enabled << "\n";
ss << R"()" << "\n";
ss << R"( # In local mode multicast group and ttl are set by default and are not adjustable)" << "\n";
ss << R"( # Local mode multicast group and ttl)" << "\n";
ss << R"( local:)" << "\n";
ss << R"( # Multicast group base. All registration and logging is sent on this address)" << "\n";
ss << R"( # group: "127.0.0.1")" << "\n";
ss << R"( group: )" << quoteString(config_.transport_layer.udp.local.group) << "\n";
ss << R"( # TTL (hop limit) is used to determine the amount of routers being traversed towards the destination)" << "\n";
ss << R"( # ttl: 0)" << "\n";
ss << R"( ttl: )" << config_.transport_layer.udp.local.ttl << "\n";
ss << R"()" << "\n";
ss << R"( network:)" << "\n";
ss << R"( # Multicast group base. All registration and logging is sent on this address)" << "\n";
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 085aca9

Please sign in to comment.