-
Notifications
You must be signed in to change notification settings - Fork 0
Add Unix UDP implementation #54
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
Changes from all commits
6314329
ef1c9e6
05a2955
d8f3878
4b278d6
a1dd184
3aaa831
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| build | ||
| build17 | ||
| build23 | ||
| dist | ||
| bin |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,13 +1,14 @@ | ||||||||||||||||||||||||||||||||||
| CMAKE_MINIMUM_REQUIRED(VERSION 3.22) | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| add_library(module_l4 STATIC) | ||||||||||||||||||||||||||||||||||
| add_executable(module_l4_tests | ||||||||||||||||||||||||||||||||||
| test/test_dummy.cpp) | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| target_sources(module_l4 | ||||||||||||||||||||||||||||||||||
| PRIVATE | ||||||||||||||||||||||||||||||||||
| src/Channel.cpp | ||||||||||||||||||||||||||||||||||
| src/impl/ChannelUnixTcp.cpp | ||||||||||||||||||||||||||||||||||
| src/ChannelRx.cpp | ||||||||||||||||||||||||||||||||||
| src/ChannelTx.cpp | ||||||||||||||||||||||||||||||||||
| src/impl/ClientsRepoImpl.cpp | ||||||||||||||||||||||||||||||||||
| src/impl/ChannelUnixPipeImpl.cpp | ||||||||||||||||||||||||||||||||||
| src/impl/ChannelUnixFile.cpp | ||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
|
|
@@ -16,31 +17,45 @@ target_include_directories(module_l4 PUBLIC | |||||||||||||||||||||||||||||||||
| $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> | ||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| add_executable(module_l4_tests | ||||||||||||||||||||||||||||||||||
| test/test_ChannelUnixTcp.cpp | ||||||||||||||||||||||||||||||||||
| test/test_ChannelUnixPipeImpl.cpp | ||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| if (USE_STD_MEMORY) | ||||||||||||||||||||||||||||||||||
| target_compile_definitions(module_l4 PRIVATE USE_STD_MEMORY) | ||||||||||||||||||||||||||||||||||
| target_compile_definitions(module_l4_tests PRIVATE USE_STD_MEMORY) | ||||||||||||||||||||||||||||||||||
| endif() | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| if(CMAKE_CXX_STANDARD GREATER_EQUAL 23) | ||||||||||||||||||||||||||||||||||
| target_sources(module_l4 PRIVATE src/cxx_23/ChannelTx.cpp) | ||||||||||||||||||||||||||||||||||
| message("Build for C++23") | ||||||||||||||||||||||||||||||||||
| target_sources(module_l4 PRIVATE | ||||||||||||||||||||||||||||||||||
| src/impl/ChannelUnixTcp.cpp | ||||||||||||||||||||||||||||||||||
| src/impl/ChannelUnixUdp.cpp | ||||||||||||||||||||||||||||||||||
| src/impl/ChannelUnixPipeImpl.cpp | ||||||||||||||||||||||||||||||||||
| src/impl/ChannelUnixSocket.cpp | ||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| target_sources(module_l4_tests PRIVATE | ||||||||||||||||||||||||||||||||||
| test/test_ChannelUnixTcp.cpp | ||||||||||||||||||||||||||||||||||
| test/test_ChannelUnixPipeImpl.cpp | ||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| # This helps CMake provide better error messages if the compiler doesn't fully | ||||||||||||||||||||||||||||||||||
| # support the C++23 standard. | ||||||||||||||||||||||||||||||||||
| target_compile_features(module_l4_tests PRIVATE cxx_std_23) | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| elseif(CMAKE_CXX_STANDARD GREATER_EQUAL 17) | ||||||||||||||||||||||||||||||||||
| target_sources(module_l4 PRIVATE src/cxx_17/ChannelTx.cpp) | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| message("Build for C++17") | ||||||||||||||||||||||||||||||||||
| # target_sources(module_l4 PRIVATE src/cxx_17/ChannelTx.cpp) | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
|
Comment on lines
+48
to
+49
|
||||||||||||||||||||||||||||||||||
| # target_sources(module_l4 PRIVATE src/cxx_17/ChannelTx.cpp) | |
| target_sources(module_l4 PRIVATE | |
| src/impl/ChannelUnixTcp.cpp | |
| src/impl/ChannelUnixUdp.cpp | |
| src/impl/ChannelUnixPipeImpl.cpp | |
| src/impl/ChannelUnixSocket.cpp | |
| ) | |
| target_sources(module_l4_tests PRIVATE | |
| test/test_ChannelUnixTcp.cpp | |
| test/test_ChannelUnixPipeImpl.cpp | |
| ) | |
| # This helps CMake provide better error messages if the compiler doesn't fully | |
| # support the C++17 standard. | |
| target_compile_features(module_l4_tests PRIVATE cxx_std_17) |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| #pragma once | ||
|
|
||
| #include "data.h" | ||
| #include "SerializerL4.h" | ||
|
|
||
| namespace styxlib | ||
| { | ||
| class ChannelRx | ||
| { | ||
| protected: | ||
| DeserializerL4Ptr deserializer; | ||
|
|
||
| public: | ||
| ChannelRx(); | ||
| ErrorCode setDeserializer(DeserializerL4Ptr deserializer); | ||
| virtual ~ChannelRx() = default; | ||
| }; | ||
|
|
||
| /** | ||
| * Reads the first X bytes of buffer and interprets them as a packet size. | ||
| * @param headerSize The size of the packet header (1, 2, or 4 bytes). | ||
| * @param buffer The buffer to read from. | ||
| * @param bufferSize The number of valid bytes available in the buffer. | ||
| * @return The decoded packet payload size, or an ErrorCode if the buffer | ||
| * is too small to hold the header. | ||
| */ | ||
| SizeResult getPacketSize( | ||
| const PacketHeaderSize &headerSize, | ||
| const uint8_t *buffer, | ||
| Size bufferSize); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,5 @@ | ||
| #pragma once | ||
| #include "data.h" | ||
| #include "Channel.h" | ||
|
|
||
| namespace styxlib | ||
| { | ||
|
|
||
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new UDP implementation (ChannelUnixUdp.cpp) is built for C++23 but there are no corresponding tests for it. The test suite includes test_ChannelUnixTcp.cpp and test_ChannelUnixPipeImpl.cpp but no test_ChannelUnixUdp.cpp. This new implementation should have test coverage similar to the other channel implementations.