|
llmx-rtaco 0.0.1
RTNL-only netlink control-plane library for Linux (C++23).
|
Base template for single-request netlink tasks. More...
#include <nl_request_task.hxx>
Public Member Functions | |
| RequestTask (SocketGuard &socket_guard, uint16_t ifindex, uint32_t sequence) noexcept | |
| Construct a RequestTask. | |
| virtual | ~RequestTask ()=default |
| Virtual destructor. | |
| auto | async_run () -> boost::asio::awaitable< std::expected< Result, std::error_code > > |
| Run the request asynchronously and return the result. | |
Protected Member Functions | |
| auto | socket () noexcept -> Socket & |
| auto | sequence () const noexcept -> uint32_t |
| auto | ifindex () const noexcept -> uint16_t |
Private Member Functions | |
| auto | impl () noexcept -> Derived & |
| auto | impl () const noexcept -> const Derived & |
| auto | send_request () -> boost::asio::awaitable< std::expected< void, std::error_code > > |
| auto | read_loop () -> boost::asio::awaitable< std::expected< Result, std::error_code > > |
Private Attributes | |
| std::array< uint8_t, MAX_RESPONSE_BYTES > | receive_buffer_ |
| SocketGuard & | socket_guard_ |
| uint16_t | ifindex_ |
| uint32_t | sequence_ |
Static Private Attributes | |
| static constexpr size_t | MAX_RESPONSE_BYTES = 64U * 1024U |
Base template for single-request netlink tasks.
Implements the common flow: ask the Derived to prepare a request, send the request via the guarded socket, and read replies until the Derived signals completion via process_message.
Derived classes must implement prepare_request(), request_payload() and process_message(const nlmsghdr&).
|
inlinenoexcept |
Construct a RequestTask.
| socket_guard | SocketGuard used for I/O. |
| ifindex | Interface index associated with the request. |
| sequence | Netlink sequence number for messages. |
|
virtualdefault |
Virtual destructor.
|
inline |
Run the request asynchronously and return the result.
This co-routine will send the prepared request, read replies and return the resulting expected<Result, std::error_code> when complete.
|
inlineprotectednoexcept |
|
inlineprivatenoexcept |
|
inlineprivatenoexcept |
|
inlineprivate |
|
inlineprivate |
|
inlineprotectednoexcept |
|
inlineprotectednoexcept |
|
private |
|
staticconstexprprivate |
|
private |
|
private |
|
private |