Skip to content

Commit

Permalink
Solved TODOs and switched to NPCAP option (formerly UDPCAP)
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianReimold committed Mar 4, 2024
1 parent b8edf00 commit 3877127
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 16 deletions.
29 changes: 15 additions & 14 deletions ecaludp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
find_package(asio REQUIRED)
find_package(recycle REQUIRED)

message(STATUS "ECALUDP_ENABLE_UDPCAP: ${ECALUDP_ENABLE_UDPCAP}")
if(ECALUDP_ENABLE_UDPCAP)
message(STATUS "ECALUDP_ENABLE_NPCAP: ${ECALUDP_ENABLE_NPCAP}")
if(ECALUDP_ENABLE_NPCAP)
find_package(udpcap REQUIRED)
endif()

Expand Down Expand Up @@ -62,18 +62,19 @@ set(sources
###############################################
# Sources for npcap enabled build
###############################################
list(APPEND includes
include_with_udpcap/ecaludp/socket_udpcap.h
)

list(APPEND sources
src/socket_udpcap.cpp
src/async_udpcap_socket.cpp
src/async_udpcap_socket.h
)
if(ECALUDP_ENABLE_NPCAP)
list(APPEND includes
include_with_udpcap/ecaludp/socket_udpcap.h
)

list(APPEND sources
src/socket_udpcap.cpp
src/async_udpcap_socket.cpp
src/async_udpcap_socket.h
)
endif()

# Build as object library
# Build as library
add_library (${PROJECT_NAME} ${ECALUDP_LIBRARY_TYPE}
${includes}
${sources}
Expand All @@ -99,15 +100,15 @@ target_link_libraries(${PROJECT_NAME}
$<BUILD_INTERFACE:steinwurf::recycle>
$<$<BOOL:${WIN32}>:ws2_32>
$<$<BOOL:${WIN32}>:wsock32>
$<$<BOOL:${ECALUDP_ENABLE_UDPCAP}>:udpcap::udpcap>
$<$<BOOL:${ECALUDP_ENABLE_NPCAP}>:udpcap::udpcap>
)

target_compile_definitions(${PROJECT_NAME}
PRIVATE
ASIO_STANDALONE
_WIN32_WINNT=0x0601
PUBLIC
$<$<BOOL:${ECALUDP_ENABLE_UDPCAP}>:ECALUDP_UDPCAP_ENABLED>
$<$<BOOL:${ECALUDP_ENABLE_NPCAP}>:ECALUDP_UDPCAP_ENABLED>
)

# Check if ecaludp is a static lib. We can only add the private tests for
Expand Down
1 change: 0 additions & 1 deletion ecaludp/src/socket_udpcap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ namespace ecaludp
{
if (error)
{
std::cerr << "Error receiving: " << error.ToString() << std::endl; // TODO: Remove
completion_handler(nullptr, error);
return;
}
Expand Down
1 change: 0 additions & 1 deletion tests/ecaludp_private_test/src/fragmentation_v5_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,6 @@ TEST_F(FragmentationV5Test, FaultyFragmentedMessages)
}
}

// TODO: Test adding faulty datagrams and duplicated datagrams to the reassembly
// TODO: Test adding messages from more than 1 sender to the reassembly

// Entry point for running the tests
Expand Down

0 comments on commit 3877127

Please sign in to comment.