Thread-safe guard owning a labeled Socket.
More...
#include <nl_socket_guard.hxx>
Thread-safe guard owning a labeled Socket.
SocketGuard provides synchronized access to an underlying Socket and ensures the socket is opened on demand. It offers convenience methods to ensure the socket is open or to stop/close it. Thread safety should be achieved via external mutex.
◆ SocketGuard() [1/4]
| llmx::rtaco::SocketGuard::SocketGuard |
( |
boost::asio::io_context & | io, |
|
|
std::string_view | label ) |
|
noexcept |
◆ SocketGuard() [2/4]
| llmx::rtaco::SocketGuard::SocketGuard |
( |
boost::asio::io_context & | io, |
|
|
std::string_view | label, |
|
|
uint32_t | group_mask ) |
|
noexcept |
Construct a SocketGuard with a custom netlink group mask.
◆ SocketGuard() [3/4]
| llmx::rtaco::SocketGuard::SocketGuard |
( |
const SocketGuard & | | ) |
|
|
delete |
◆ SocketGuard() [4/4]
| llmx::rtaco::SocketGuard::SocketGuard |
( |
SocketGuard && | | ) |
|
|
delete |
◆ ensure_open()
| auto llmx::rtaco::SocketGuard::ensure_open |
( |
| ) |
-> std::expected< void, std::error_code > |
Ensure the underlying socket is open, opening it if necessary.
- Returns
- Expected void or an error_code on failure.
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ socket()
| auto llmx::rtaco::SocketGuard::socket |
( |
| ) |
-> Socket & |
Access the underlying Socket instance.
◆ stop()
| void llmx::rtaco::SocketGuard::stop |
( |
| ) |
|
Stop and close the guarded socket.
◆ group_mask_
| uint32_t llmx::rtaco::SocketGuard::group_mask_ |
|
private |
◆ socket_
| Socket llmx::rtaco::SocketGuard::socket_ |
|
private |
The documentation for this class was generated from the following files: