Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(nebula_hw_interfaces): better UDP socket (#231)
* feat(udp): a new UDP socket implementation Signed-off-by: Max SCHMELLER <[email protected]> * chore(udp): more error handling and doc comments Signed-off-by: Max SCHMELLER <[email protected]> * chore(udp): always enable socket reuse Signed-off-by: Max SCHMELLER <[email protected]> * chore(udp): clean up C-style code Signed-off-by: Max SCHMELLER <[email protected]> * chore(udp): remove unnecessary double parens Signed-off-by: Max SCHMELLER <[email protected]> * feat(udp): use poll to prevent blocking when there is no received data Signed-off-by: Max SCHMELLER <[email protected]> * chore(udp): differentiate between socket and usage-related errors Signed-off-by: Max SCHMELLER <[email protected]> * feat(udp): allow setting receive buffer size Signed-off-by: Max SCHMELLER <[email protected]> * chore(udp): use uint8_t because std::byte is annoying to refactor into everywhere Signed-off-by: Max SCHMELLER <[email protected]> * fix(udp): update state correctly when `bind()` is called Signed-off-by: Max SCHMELLER <[email protected]> * feat(udp): monitor socket packet drops Signed-off-by: Max SCHMELLER <[email protected]> * feat(udp): add explicit unsubscribe function to facilitate clean shutdown Signed-off-by: Max SCHMELLER <[email protected]> * chore(expected): add stdexcept include Signed-off-by: Max SCHMELLER <[email protected]> * feat(udp): report when messages have been truncated Signed-off-by: Max SCHMELLER <[email protected]> * chore(udp): relax some usage requirements Signed-off-by: Max SCHMELLER <[email protected]> * test(udp): add most of the unit tests for udp socket Signed-off-by: Max SCHMELLER <[email protected]> * ci(pre-commit): autofix * chore(cspell): add OVFL to dictionary Signed-off-by: Max SCHMELLER <[email protected]> * fix(udp): return correctly truncated buffer when oversized packet is received Signed-off-by: Max SCHMELLER <[email protected]> * chore(udp): uniform initialization for buffer_size_ Signed-off-by: Max SCHMELLER <[email protected]> * chore(udp): disallow re-initializing socket Signed-off-by: Max SCHMELLER <[email protected]> * chore(udp): make error value checking consistent (== -1) Signed-off-by: Max SCHMELLER <[email protected]> * chore(udp): add explanatory comment on handling of 0-length datagrams Signed-off-by: Max SCHMELLER <[email protected]> * chore(udp): disallow binding to broadcast IP Signed-off-by: Max SCHMELLER <[email protected]> * chore(udp): bind to host IP instead of INADDR_ANY in non-multicast case Signed-off-by: Max SCHMELLER <[email protected]> * feat(udp): make polling interval configurable Signed-off-by: Max SCHMELLER <[email protected]> * chore(udp): rename ReceiveMetadata to RxMetadata Signed-off-by: Max SCHMELLER <[email protected]> * chore(udp): parse IP addresses with error checking Signed-off-by: Max SCHMELLER <[email protected]> * test(udp): update and fix tests after changes of recent commits Signed-off-by: Max SCHMELLER <[email protected]> * feat(expected): add shorthand `value_or_throw()` function Signed-off-by: Max SCHMELLER <[email protected]> * feat(udp): refactor to typestate-based builder pattern to make misuse a compiler error Signed-off-by: Max SCHMELLER <[email protected]> * ci(pre-commit): autofix * chore(udp): replace `-1` with `uninitialized` in `SockFd` for clarity Signed-off-by: Max SCHMELLER <[email protected]> * chore(udp): mark SockFd constructor explicit Signed-off-by: Max SCHMELLER <[email protected]> * fix(udp): enforce that at most one multicast group is joined Signed-off-by: Max SCHMELLER <[email protected]> * chore(udp): reorder UdpSocket class to reduce number of needed visibility modifiers Signed-off-by: Max SCHMELLER <[email protected]> * fix(udp): make UDP socket object move-constructible to enable things like optional.emplace() etc. Signed-off-by: Max SCHMELLER <[email protected]> --------- Signed-off-by: Max SCHMELLER <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information