Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Core/Submodule] Updated Udpcap to 2.0 (fixes lost-datagram-issues) #1396

Merged
merged 1 commit into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions ecal/core/src/io/udp/sendreceive/udp_receiver_npcap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

#include <iostream>

#include <udpcap/udpcap_version.h>

namespace IO
{
namespace UDP
Expand Down Expand Up @@ -110,6 +112,12 @@ namespace IO
{
Udpcap::HostAddress source_address;
uint16_t source_port;

#if UDPCAP_VERSION_MAJOR == 1
// Show a compiler deprecation warning
// TODO: Remove for eCAL6
[[deprecated("Udpcap 1.x is deprecated and prone to data-loss. Please update udpcap to 2.x.")]]

bytes_received = m_socket.receiveDatagram(buf_, len_, static_cast<unsigned long>(timeout_), &source_address, &source_port);

if (bytes_received && source_address.isValid())
Expand All @@ -119,10 +127,32 @@ namespace IO
address_->sin_port = source_port;
memset(&(address_->sin_zero), 0, 8);
}
#else // Udpcap 2.x
Udpcap::Error error(Udpcap::Error::GENERIC_ERROR);
bytes_received = m_socket.receiveDatagram(buf_, len_, timeout_, &source_address, &source_port, error);

if (!error)
{
address_->sin_addr.s_addr = source_address.toInt();
address_->sin_family = AF_INET;
address_->sin_port = source_port;
memset(&(address_->sin_zero), 0, 8);
}
#endif

}
else
{
#if UDPCAP_VERSION_MAJOR == 1
// Show a compiler deprecation warning
// TODO: Remove for eCAL6
[[deprecated("Udpcap 1.x is deprecated and prone to data-loss. Please update udpcap to 2.x.")]]

bytes_received = m_socket.receiveDatagram(buf_, len_, static_cast<unsigned long>(timeout_));
#else // Udpcap 2.x
Udpcap::Error error(Udpcap::Error::GENERIC_ERROR);
bytes_received = m_socket.receiveDatagram(buf_, len_, timeout_, error);
#endif
}
return bytes_received;
}
Expand Down
2 changes: 1 addition & 1 deletion thirdparty/udpcap/udpcap
Submodule udpcap updated 36 files
+67 −0 .clang-tidy
+2 −2 .github/workflows/build-windows.yml
+21 −0 CMakeLists.txt
+17 −5 README.md
+14 −16 samples/asio_sender_multicast/CMakeLists.txt
+21 −24 samples/asio_sender_multicast/src/main.cpp
+14 −16 samples/asio_sender_unicast/CMakeLists.txt
+17 −20 samples/asio_sender_unicast/src/main.cpp
+14 −16 samples/udpcap_receiver_multicast/CMakeLists.txt
+32 −28 samples/udpcap_receiver_multicast/src/main.cpp
+14 −16 samples/udpcap_receiver_unicast/CMakeLists.txt
+31 −27 samples/udpcap_receiver_unicast/src/main.cpp
+44 −0 tests/udpcap_test/CMakeLists.txt
+205 −0 tests/udpcap_test/src/atomic_signalable.h
+966 −0 tests/udpcap_test/src/udpcap_test.cpp
+33 −0 thirdparty/GTest/GTest_make_available.cmake
+1 −0 thirdparty/GTest/Modules/FindGTest.cmake
+1 −1 thirdparty/npcap/Modules/Findnpcap.cmake
+1 −1 thirdparty/pcapplusplus/Modules/Findpcapplusplus.cmake
+21 −20 udpcap/CMakeLists.txt
+1 −1 udpcap/cmake/udpcapConfig-shared.cmake.in
+4 −3 udpcap/cmake/udpcapConfig-static.cmake.in
+116 −0 udpcap/include/udpcap/error.h
+18 −20 udpcap/include/udpcap/host_address.h
+17 −18 udpcap/include/udpcap/npcap_helpers.h
+91 −51 udpcap/include/udpcap/udpcap_socket.h
+0 −12 udpcap/sourcetree.cmake
+23 −25 udpcap/src/host_address.cpp
+25 −23 udpcap/src/ip_reassembly.cpp
+17 −21 udpcap/src/ip_reassembly.h
+14 −17 udpcap/src/log_debug.h
+71 −72 udpcap/src/npcap_helpers.cpp
+28 −25 udpcap/src/udpcap_socket.cpp
+325 −349 udpcap/src/udpcap_socket_private.cpp
+41 −60 udpcap/src/udpcap_socket_private.h
+2 −2 udpcap/version.cmake
Loading