Skip to content

Commit

Permalink
UDP Configuration: Adding Receive/Sendbuffer inecal_udp_configurations.
Browse files Browse the repository at this point in the history
  • Loading branch information
Peguen committed Jul 23, 2024
1 parent c6433a1 commit f4896f7
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 11 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ option(ECAL_USE_CLOCKLOCK_MUTEX "Use native mutex with monotonic
set(ECAL_CORE_HAS_PROTOBUF ON)
set(ECAL_CORE_BUILD_SAMPLES ${BUILD_SAMPLES})
set(ECAL_CORE_BUILD_TESTS ${BUILD_ECAL_TESTS})
set(ECAL_CORE_CONFIG_INIFILE ON)
set(ECAL_CORE_CONFIGURATION ON)
set(ECAL_CORE_COMMAND_LINE ON)
set(ECAL_CORE_REGISTRATION ON)
set(ECAL_CORE_MONITORING ON)
Expand Down
6 changes: 3 additions & 3 deletions ecal/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ find_package(asio REQUIRED)
find_package(Threads REQUIRED)
find_package(ecaludp REQUIRED)

if (ECAL_CORE_CONFIG_INIFILE)
if (ECAL_CORE_CONFIGURATION)
find_package(yaml-cpp REQUIRED)
find_package(simpleini REQUIRED)
endif()
Expand Down Expand Up @@ -601,7 +601,7 @@ target_compile_definitions(${PROJECT_NAME}
)

set(ECAL_CORE_FEATURES
ECAL_CORE_CONFIG_INIFILE
ECAL_CORE_CONFIGURATION
ECAL_CORE_COMMAND_LINE
ECAL_CORE_REGISTRATION
ECAL_CORE_MONITORING
Expand All @@ -625,7 +625,7 @@ foreach(CORE_FEATURE ${ECAL_CORE_FEATURES})
endif()
endforeach()

if(ECAL_CORE_CONFIG_INIFILE)
if(ECAL_CORE_CONFIGURATION)
target_link_libraries(${PROJECT_NAME}
PRIVATE
simpleini::simpleini
Expand Down
10 changes: 10 additions & 0 deletions ecal/core/src/io/udp/ecal_udp_configurations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,5 +175,15 @@ namespace eCAL
// if network is enabled, return the configured UDP multicast TTL value
return Config::GetUdpMulticastTtl();
}

int GetReceiveBufferSize()
{
return Config::GetUdpMulticastRcvBufSizeBytes();
}

int GetSendBufferSize()
{
return Config::GetUdpMulticastSndBufSizeBytes();
}
}
}
15 changes: 15 additions & 0 deletions ecal/core/src/io/udp/ecal_udp_configurations.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,5 +147,20 @@ namespace eCAL
* @return The TTL value for UDP multicast communication based on the network configuration.
*/
int GetMulticastTtl();

/**
* @brief GetReceiveBufferSize retrieves the receive buffer size for UDP multicast communication.
*
* @return The receive buffer size in bytes.
*/
int GetReceiveBufferSize();

/**
* @brief GetSendBufferSize retrieves the send buffer size for UDP multicast communication.
*
* @return The send buffer size in bytes.
*/
int GetSendBufferSize();

}
}
4 changes: 2 additions & 2 deletions ecal/core/src/logging/ecal_log_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ namespace eCAL
attr.ttl = UDP::GetMulticastTtl();
attr.broadcast = UDP::IsBroadcast();
attr.loopback = true;
attr.sndbuf = Config::GetUdpMulticastSndBufSizeBytes();
attr.sndbuf = UDP::GetSendBufferSize();

// create udp logging sender
m_udp_logging_sender = std::make_unique<UDP::CSampleSender>(attr);
Expand All @@ -157,7 +157,7 @@ namespace eCAL
attr.port = UDP::GetLoggingPort();
attr.broadcast = UDP::IsBroadcast();
attr.loopback = true;
attr.rcvbuf = Config::GetUdpMulticastRcvBufSizeBytes();
attr.rcvbuf = UDP::GetReceiveBufferSize();

// start logging receiver
m_log_receiver = std::make_shared<UDP::CSampleReceiver>(attr, std::bind(&CLog::HasSample, this, std::placeholders::_1), std::bind(&CLog::ApplySample, this, std::placeholders::_1, std::placeholders::_2));
Expand Down
2 changes: 1 addition & 1 deletion ecal/core/src/readwrite/udp/ecal_reader_udp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ namespace eCAL
attr.port = UDP::GetPayloadPort();
attr.broadcast = UDP::IsBroadcast();
attr.loopback = true;
attr.rcvbuf = Config::GetUdpMulticastRcvBufSizeBytes();
attr.rcvbuf = UDP::GetReceiveBufferSize();

// start payload sample receiver
m_payload_receiver = std::make_shared<UDP::CSampleReceiver>(attr, std::bind(&CUDPReaderLayer::HasSample, this, std::placeholders::_1), std::bind(&CUDPReaderLayer::ApplySample, this, std::placeholders::_1, std::placeholders::_2));
Expand Down
2 changes: 1 addition & 1 deletion ecal/core/src/readwrite/udp/ecal_writer_udp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ namespace eCAL
attr.port = UDP::GetPayloadPort();
attr.ttl = UDP::GetMulticastTtl();
attr.broadcast = UDP::IsBroadcast();
attr.sndbuf = eCAL::GetConfiguration().transport_layer.udp.send_buffer;
attr.sndbuf = UDP::GetSendBufferSize();

// create udp/sample sender with activated loop-back
attr.loopback = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace
attr.port = UDP::GetRegistrationPort();
attr.broadcast = UDP::IsBroadcast();
attr.loopback = true;
attr.rcvbuf = Config::GetUdpMulticastRcvBufSizeBytes();
attr.rcvbuf = UDP::GetReceiveBufferSize();
return attr;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ namespace
attr.ttl = UDP::GetMulticastTtl();
attr.broadcast = UDP::IsBroadcast();
attr.loopback = true;
attr.sndbuf = Config::GetUdpMulticastSndBufSizeBytes();
attr.sndbuf = UDP::GetSendBufferSize();
return attr;
}

Expand Down
2 changes: 1 addition & 1 deletion ecal/ecal-core-options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ option(ECAL_CORE_BUILD_TESTS "Build the eCAL google
# ------------------------------------------------------------------------------------------------------------------------------------------------------------------
# core internal feature configuration (adapt to your needs)
# ------------------------------------------------------------------------------------------------------------------------------------------------------------------
option(ECAL_CORE_CONFIG_INIFILE "Enables to configure eCAL via ecal.yaml file" ON)
option(ECAL_CORE_CONFIGURATION "Enables to configure eCAL at runtime via ecal.yaml file" ON)
option(ECAL_CORE_COMMAND_LINE "Enables eCAL application cmd line interfaces" ON)
option(ECAL_CORE_REGISTRATION "Enables the eCAL registration layer" ON)
option(ECAL_CORE_MONITORING "Enables the eCAL monitoring functionality" ON)
Expand Down

0 comments on commit f4896f7

Please sign in to comment.