Skip to content

Commit

Permalink
Merge branch 'master' into feature/redesign-service-api
Browse files Browse the repository at this point in the history
  • Loading branch information
Peguen authored Dec 13, 2024
2 parents 238b326 + d7a868b commit 1f41360
Show file tree
Hide file tree
Showing 32 changed files with 118 additions and 348 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
16 changes: 1 addition & 15 deletions ecal/core/include/ecal/cimpl/ecal_log_cimpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,26 +33,12 @@
extern "C"
{
#endif /*__cplusplus*/
/**
* @brief Sets the log level.
*
* @param level_ The level.
**/
ECALC_API void eCAL_Logging_SetLogLevel(enum eCAL_Logging_eLogLevel level_);

/**
* @brief Get the current log level.
*
* @return The current log level.
**/
ECALC_API enum eCAL_Logging_eLogLevel eCAL_Logging_GetLogLevel();

/**
* @brief Log a message (with current log level).
*
* @param msg_ The log message string.
**/
ECALC_API void eCAL_Logging_Log(const char* const msg_);
ECALC_API void eCAL_Logging_Log(enum eCAL_Logging_eLogLevel level_, const char* const msg_);

/**
* @brief Get logging string.
Expand Down
45 changes: 15 additions & 30 deletions ecal/core/include/ecal/config/transport_layer.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,47 +33,32 @@ 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
{
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)

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

Expand Down
27 changes: 11 additions & 16 deletions ecal/core/include/ecal/ecal_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,8 @@
namespace eCAL
{
ECAL_API Configuration& GetConfiguration ();
ECAL_API TransportLayer::Configuration& GetTransportLayerConfiguration ();
ECAL_API Registration::Configuration& GetRegistrationConfiguration ();
ECAL_API Monitoring::Configuration& GetMonitoringConfiguration ();
ECAL_API Logging::Configuration& GetLoggingConfiguration ();
ECAL_API Subscriber::Configuration& GetSubscriberConfiguration ();
ECAL_API Publisher::Configuration& GetPublisherConfiguration ();
ECAL_API Time::Configuration& GetTimesyncConfiguration ();
ECAL_API Application::Configuration& GetApplicationConfiguration ();

namespace Config
{
Expand Down Expand Up @@ -98,9 +92,6 @@ namespace eCAL

ECAL_API std::string GetMonitoringFilterExcludeList ();
ECAL_API std::string GetMonitoringFilterIncludeList ();
ECAL_API eCAL_Logging_Filter GetConsoleLogFilter ();
ECAL_API eCAL_Logging_Filter GetFileLogFilter ();
ECAL_API eCAL_Logging_Filter GetUdpLogFilter ();

/////////////////////////////////////
// sys
Expand All @@ -111,18 +102,22 @@ namespace eCAL
/////////////////////////////////////
// publisher
/////////////////////////////////////

ECAL_API bool IsTopicTypeSharingEnabled ();
ECAL_API bool IsTopicDescriptionSharingEnabled ();

/////////////////////////////////////
// subscriber
/////////////////////////////////////

ECAL_API bool GetDropOutOfOrderMessages ();

/////////////////////////////////////
// experimental
// registration
/////////////////////////////////////
namespace Experimental
{
ECAL_API size_t GetShmMonitoringQueueSize ();
ECAL_API std::string GetShmMonitoringDomain ();
ECAL_API bool GetDropOutOfOrderMessages ();
}

ECAL_API size_t GetShmMonitoringQueueSize ();
ECAL_API std::string GetShmMonitoringDomain ();
}
}
//@}
48 changes: 1 addition & 47 deletions ecal/core/include/ecal/ecal_log.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,59 +35,13 @@ namespace eCAL
{
namespace Logging
{
/**
* @brief Sets the log level.
*
* @param level_ The level.
**/
ECAL_API void SetLogLevel(eCAL_Logging_eLogLevel level_);

/**
* @brief Sets the file log filter.
*
* @param filter_ The filter;
*/
ECAL_API void SetFileLogFilter(eCAL_Logging_Filter filter_);

/**
* @brief Sets the udp log filter.
*
* @param filter_ The filter;
*/
ECAL_API void SetUDPLogFilter(eCAL_Logging_Filter filter_);

/**
* @brief Sets the console log filter.
*
* @param filter_ The filter;
*/
ECAL_API void SetConsoleLogFilter(eCAL_Logging_Filter filter_);

/**
* @brief Get the current log level.
*
* @return The current log level.
**/
ECAL_API eCAL_Logging_eLogLevel GetLogLevel();

/**
* @brief Log a message (with current log level).
*
* @param msg_ The log message string.
**/
ECAL_API void Log(const std::string& msg_);

/**
* @brief Log a message.
*
* @param level_ The level.
* @param msg_ The log message string.
**/
inline void Log(eCAL_Logging_eLogLevel level_, const std::string& msg_)
{
SetLogLevel(level_);
Log(msg_);
}
ECAL_API void Log(eCAL_Logging_eLogLevel level_, const std::string& msg_);

/**
* @brief Get logging as serialized protobuf string.
Expand Down
10 changes: 5 additions & 5 deletions ecal/core/include/ecal/types/ecal_custom_data_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ namespace eCAL
**/
class IpAddressV4
{
public:
ECAL_API IpAddressV4(const std::string& ip_address_);
public:
ECAL_API IpAddressV4(const std::string& ip_address_);
ECAL_API IpAddressV4(const char* ip_address_);

ECAL_API std::string Get() const;

ECAL_API IpAddressV4& operator=(const std::string& ip_string_);
ECAL_API IpAddressV4& operator=(const char* ip_string_);
ECAL_API IpAddressV4& operator=(const char* ip_string_);
ECAL_API operator std::string() const;
ECAL_API bool operator==(const eCAL::Types::IpAddressV4& rhs) const;
ECAL_API friend bool operator==(eCAL::Types::IpAddressV4 lhs, const char* ip_string_);
Expand All @@ -61,7 +61,7 @@ namespace eCAL
ECAL_API friend bool operator==(const std::string& ip_string_, eCAL::Types::IpAddressV4 rhs);

private:
ECAL_API void validateIpString(const std::string& ip_address_);
ECAL_API void validateIpString(const std::string& ip_address_);

std::string m_ip_address{};
};
Expand All @@ -79,4 +79,4 @@ namespace eCAL
};

}
}
}
14 changes: 2 additions & 12 deletions ecal/core/src/cimpl/ecal_log_cimpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,9 @@

extern "C"
{
ECALC_API void eCAL_Logging_SetLogLevel(enum eCAL_Logging_eLogLevel level_)
ECALC_API void eCAL_Logging_Log(enum eCAL_Logging_eLogLevel level_, const char* const msg_)
{
eCAL::Logging::SetLogLevel(level_);
}

ECALC_API enum eCAL_Logging_eLogLevel eCAL_Logging_GetLogLevel()
{
return(eCAL::Logging::GetLogLevel());
}

ECALC_API void eCAL_Logging_Log(const char* const msg_)
{
eCAL::Logging::Log(msg_);
eCAL::Logging::Log(level_, msg_);
}

ECALC_API int eCAL_Logging_GetLogging(void* buf_, int buf_len_)
Expand Down
1 change: 0 additions & 1 deletion ecal/core/src/config/builder/logging_attribute_builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ namespace eCAL
attributes.process_id = Process::GetProcessID();
attributes.process_name = Process::GetProcessName();
attributes.unit_name = Process::GetUnitName();
attributes.level = log_level_info;

attributes.udp_sink.enabled = log_config_.provider.udp.enable;
attributes.udp_sink.filter_log = log_config_.provider.udp.filter_log;
Expand Down
8 changes: 5 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::Network::Configuration>::encode(const eCAL::TransportLayer::UDP::Network::Configuration& config_)
Node convert<eCAL::TransportLayer::UDP::MulticastConfiguration>::encode(const eCAL::TransportLayer::UDP::MulticastConfiguration& config_)
{
Node node;
node["group"] = config_.group.Get();
node["ttl"] = config_.ttl;
return node;
}

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

AssignValue<eCAL::TransportLayer::UDP::Network::Configuration>(config_.network, node_, "network");
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/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::Network::Configuration>
struct convert<eCAL::TransportLayer::UDP::MulticastConfiguration>
{
static Node encode(const eCAL::TransportLayer::UDP::Network::Configuration& config_);
static Node encode(const eCAL::TransportLayer::UDP::MulticastConfiguration& config_);

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

template<>
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
21 changes: 11 additions & 10 deletions ecal/core/src/config/ecal_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,6 @@ namespace eCAL

std::string GetMonitoringFilterExcludeList () { return GetConfiguration().monitoring.filter_excl; }
std::string GetMonitoringFilterIncludeList () { return GetConfiguration().monitoring.filter_incl; }
eCAL_Logging_Filter GetConsoleLogFilter () { return GetConfiguration().logging.provider.console.filter_log; }
eCAL_Logging_Filter GetFileLogFilter () { return GetConfiguration().logging.provider.file.filter_log; }
eCAL_Logging_Filter GetUdpLogFilter () { return GetConfiguration().logging.provider.udp.filter_log; }

/////////////////////////////////////
// sys
Expand All @@ -96,18 +93,22 @@ namespace eCAL
/////////////////////////////////////
// publisher
/////////////////////////////////////

bool IsTopicTypeSharingEnabled () { return GetConfiguration().publisher.share_topic_type; }
bool IsTopicDescriptionSharingEnabled () { return GetConfiguration().publisher.share_topic_description; }

/////////////////////////////////////
// experimemtal
// subscriber
/////////////////////////////////////

bool GetDropOutOfOrderMessages () { return GetConfiguration().subscriber.drop_out_of_order_messages; }

/////////////////////////////////////
// registration
/////////////////////////////////////

size_t GetShmMonitoringQueueSize () { return GetConfiguration().registration.layer.shm.queue_size; }
std::string GetShmMonitoringDomain () { return GetConfiguration().registration.layer.shm.domain;}

namespace Experimental
{
size_t GetShmMonitoringQueueSize () { return GetConfiguration().registration.layer.shm.queue_size; }
std::string GetShmMonitoringDomain () { return GetConfiguration().registration.layer.shm.domain;}
bool GetDropOutOfOrderMessages () { return GetConfiguration().subscriber.drop_out_of_order_messages; }
}
}
}
1 change: 1 addition & 0 deletions ecal/core/src/config/ecal_config_initializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
**/

#include "ecal/ecal_config.h"
#include "ecal_config_internal.h"
#include "ecal/ecal_util.h"

#include "ecal_global_accessors.h"
Expand Down
Loading

0 comments on commit 1f41360

Please sign in to comment.