Skip to content

Commit

Permalink
Revert "rework tl"
Browse files Browse the repository at this point in the history
This reverts commit 128ae8f.
  • Loading branch information
Peguen committed Dec 10, 2024
1 parent 59cf322 commit 57db79a
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 25 deletions.
51 changes: 33 additions & 18 deletions ecal/core/include/ecal/config/transport_layer.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,32 +33,47 @@ namespace eCAL
{
namespace UDP
{
struct MulticastConfiguration
namespace Network
{
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
{
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) */
};
}

struct Configuration
{
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)
v2: masks are now considered like routes masking (Default: 255.0.0.0-255.255.255.255)*/
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)
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; //!< default: "127.255.255.255", 1U
Network::Configuration network;
const Local::Configuration local;

ECAL_API Configuration& operator=(const Configuration& other);
};
}

Expand Down
6 changes: 3 additions & 3 deletions ecal/core/src/config/configuration_to_yaml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,15 +220,15 @@ namespace YAML
return true;
}

Node convert<eCAL::TransportLayer::UDP::MulticastConfiguration>::encode(const eCAL::TransportLayer::UDP::MulticastConfiguration& config_)
Node convert<eCAL::TransportLayer::UDP::Network::Configuration>::encode(const eCAL::TransportLayer::UDP::Network::Configuration& config_)
{
Node node;
node["group"] = config_.group.Get();
node["ttl"] = config_.ttl;
return node;
}

bool convert<eCAL::TransportLayer::UDP::MulticastConfiguration>::decode(const Node& node_, eCAL::TransportLayer::UDP::MulticastConfiguration& config_)
bool convert<eCAL::TransportLayer::UDP::Network::Configuration>::decode(const Node& node_, eCAL::TransportLayer::UDP::Network::Configuration& config_)
{
AssignValue<std::string>(config_.group, node_, "group");
AssignValue<unsigned int>(config_.ttl, node_, "ttl");
Expand Down Expand Up @@ -265,7 +265,7 @@ namespace YAML
AssignValue<bool>(config_.join_all_interfaces, node_, "join_all_interfaces");
AssignValue<bool>(config_.npcap_enabled, node_, "npcap_enabled");

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

Expand Down
6 changes: 3 additions & 3 deletions ecal/core/src/config/configuration_to_yaml.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ namespace YAML
};

template<>
struct convert<eCAL::TransportLayer::UDP::MulticastConfiguration>
struct convert<eCAL::TransportLayer::UDP::Network::Configuration>
{
static Node encode(const eCAL::TransportLayer::UDP::MulticastConfiguration& config_);
static Node encode(const eCAL::TransportLayer::UDP::Network::Configuration& config_);

static bool decode(const Node& node_, eCAL::TransportLayer::UDP::MulticastConfiguration& config_);
static bool decode(const Node& node_, eCAL::TransportLayer::UDP::Network::Configuration& config_);
};

template<>
Expand Down
15 changes: 14 additions & 1 deletion ecal/core/src/config/transport_layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,20 @@ namespace eCAL
{
namespace UDP
{
const MulticastConfiguration Configuration::local { "127.255.255.255", 1U };
Configuration& Configuration::operator=(const Configuration& other)
{
config_version = other.config_version;
join_all_interfaces = other.join_all_interfaces;
mask = other.mask;
mode = other.mode;
network = other.network;
npcap_enabled = other.npcap_enabled;
port = other.port;
receive_buffer = other.receive_buffer;
send_buffer = other.send_buffer;

return *this;
}
}
}
}

0 comments on commit 57db79a

Please sign in to comment.