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

Integrate ecaludp #51

Closed
wants to merge 9 commits into from
Closed
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
61 changes: 7 additions & 54 deletions ecal/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ project(core VERSION ${eCAL_VERSION_STRING})

find_package(asio REQUIRED)
find_package(Threads REQUIRED)
find_package(ecaludp REQUIRED)

if (ECAL_CORE_CONFIG_INIFILE)
find_package(simpleini REQUIRED)
Expand All @@ -33,10 +34,6 @@ if (ECAL_CORE_TRANSPORT_TCP)
find_package(tcp_pubsub REQUIRED)
endif()

if (ECAL_CORE_NPCAP_SUPPORT)
find_package(udpcap REQUIRED)
endif()

# If we're currently doing a build within a git repository, we will configure the header files.
# Else, (e.g. for source packages such as debian source packages) we will use a preconfigured file.
# If there is really no information available, it will generate a dummy version file 0.0.0
Expand Down Expand Up @@ -139,56 +136,16 @@ endif()
######################################
# io/udp
######################################
# io/udp/fragmentation
set(ecal_io_udp_fragmentation_src
src/io/udp/fragmentation/msg_type.h
src/io/udp/fragmentation/rcv_fragments.cpp
src/io/udp/fragmentation/rcv_fragments.h
src/io/udp/fragmentation/snd_fragments.cpp
src/io/udp/fragmentation/snd_fragments.h
)

# io/udp/sendreceive (npcap)
if(ECAL_CORE_NPCAP_SUPPORT)
set(ecal_io_udp_sendreceive_src_npcap
src/io/udp/sendreceive/udp_receiver_npcap.cpp
src/io/udp/sendreceive/udp_receiver_npcap.h
)
endif()

# io/udp/sendreceive
set(ecal_io_udp_sendreceive_src
src/io/udp/sendreceive/udp_receiver.cpp
src/io/udp/sendreceive/udp_receiver.h
src/io/udp/sendreceive/udp_receiver_asio.cpp
src/io/udp/sendreceive/udp_receiver_asio.h
src/io/udp/sendreceive/udp_sender.cpp
src/io/udp/sendreceive/udp_sender.h
${ecal_io_udp_sendreceive_src_npcap}
)

# io/udp/sendreceive/linux
if(UNIX)
set(ecal_io_udp_sendreceive_linux_src
src/io/udp/sendreceive/linux/socket_os.h
)
endif()

# io/udp/sendreceive/win32
if (WIN32)
set(ecal_io_udp_sendreceive_win_src
src/io/udp/sendreceive/win32/socket_os.h
)
endif()

# io/udp
set(ecal_io_udp_src
src/io/udp/ecal_udp_configurations.cpp
src/io/udp/ecal_udp_configurations.h
src/io/udp/ecal_udp_receiver_attr.h
src/io/udp/ecal_udp_sample_receiver.cpp
src/io/udp/ecal_udp_sample_receiver.h
src/io/udp/ecal_udp_sample_sender.cpp
src/io/udp/ecal_udp_sample_sender.h
src/io/udp/ecal_udp_sender_attr.h
src/io/udp/ecal_udp_topic2mcast.h
)

Expand Down Expand Up @@ -540,8 +497,6 @@ set(ecal_sources
${ecal_io_shm_src}
${ecal_io_shm_linux_src}
${ecal_io_shm_win_src}
${ecal_io_udp_fragmentation_src}
${ecal_io_udp_sendreceive_src}
${ecal_io_udp_src}
${ecal_io_udp_sendreceive_linux_src}
${ecal_io_udp_sendreceive_win_src}
Expand Down Expand Up @@ -660,12 +615,10 @@ if(ECAL_CORE_TRANSPORT_TCP)
)
endif()

if(ECAL_CORE_NPCAP_SUPPORT)
target_link_libraries(${PROJECT_NAME}
PRIVATE
udpcap::udpcap
)
endif()
target_link_libraries(${PROJECT_NAME}
PRIVATE
ecaludp::ecaludp
)

target_include_directories(${PROJECT_NAME}
PRIVATE
Expand Down
6 changes: 2 additions & 4 deletions ecal/core/src/ecal_process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,6 @@
#include <libutil.h>
#endif

#ifdef ECAL_CORE_NPCAP_SUPPORT
#include <udpcap/npcap_helpers.h>
#endif // ECAL_CORE_NPCAP_SUPPORT

#ifndef NDEBUG
#define STD_COUT_DEBUG( x ) { std::stringstream ss; ss << x; std::cout << ss.str(); }
#else
Expand Down Expand Up @@ -212,6 +208,7 @@ namespace eCAL
sstream << "Layer Mode UDP MC : " << LayerMode(Config::IsUdpMulticastRecEnabled()) << '\n';
sstream << "Drop out-of-order msgs : " << (Config::Experimental::GetDropOutOfOrderMessages() ? "on" : "off") << '\n';
#endif
#if 0 // TODO: Do we have this API in ecalupd ?
#ifdef ECAL_CORE_NPCAP_SUPPORT
sstream << "Npcap UDP Reciever : " << LayerMode(Config::IsNpcapEnabled());
if(Config::IsNpcapEnabled() && !Udpcap::Initialize())
Expand All @@ -224,6 +221,7 @@ namespace eCAL
sstream << " (Npcap is enabled, but not configured via CMake!)";
}
#endif // ECAL_CORE_NPCAP_SUPPORT
#endif
sstream << '\n';

// write it into std:string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,24 @@
*/

/**
* @brief eCAL windows includes
* @brief UDP receiver attributes
**/

#pragma once

#if defined(_MSC_VER) && defined(__clang__) && !defined(CINTERFACE)
#define CINTERFACE
#endif
#include <string>

#ifndef NOMINMAX
#define NOMINMAX
#endif

#include <winsock2.h> //NOLINT
#include <Ws2tcpip.h> //NOLINT

#undef CINTERFACE
namespace IO
{
namespace UDP
{
struct SReceiverAttr
{
std::string address;
int port = 0;
bool broadcast = false;
bool loopback = true;
int rcvbuf = 1024 * 1024;
};
}
}
Loading
Loading