llmx-rtaco 0.0.1
RTNL-only netlink control-plane library for Linux (C++23).
Loading...
Searching...
No Matches
nl_link_dump_task.hxx
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4#include <expected>
5#include <memory_resource>
6#include <optional>
7#include <system_error>
8
11
12struct nlmsghdr;
13
14namespace llmx {
15namespace rtaco {
16
17class SocketGuard;
18
24class LinkDumpTask : public LinkTask<LinkDumpTask, LinkEventList> {
26
27public:
35 LinkDumpTask(SocketGuard& socket_guard, std::pmr::memory_resource* pmr,
36 uint16_t ifindex, uint32_t sequence) noexcept;
37
39 void prepare_request();
40
46 auto process_message(const nlmsghdr& header)
47 -> std::optional<std::expected<LinkEventList, std::error_code>>;
48
49private:
50 auto handle_done() -> std::expected<LinkEventList, std::error_code>;
51
52 auto handle_error(const nlmsghdr& header)
53 -> std::expected<LinkEventList, std::error_code>;
54
55 auto dispatch_link(const nlmsghdr& header)
56 -> std::optional<std::expected<LinkEventList, std::error_code>>;
57};
58
59} // namespace rtaco
60} // namespace llmx
auto dispatch_link(const nlmsghdr &header) -> std::optional< std::expected< LinkEventList, std::error_code > >
Definition nl_link_dump_task.cxx:64
LinkDumpTask(SocketGuard &socket_guard, std::pmr::memory_resource *pmr, uint16_t ifindex, uint32_t sequence) noexcept
Construct a LinkDumpTask.
Definition nl_link_dump_task.cxx:22
void prepare_request()
Prepare the netlink request to dump links.
Definition nl_link_dump_task.cxx:27
auto handle_done() -> std::expected< LinkEventList, std::error_code >
Definition nl_link_dump_task.cxx:47
auto handle_error(const nlmsghdr &header) -> std::expected< LinkEventList, std::error_code >
Definition nl_link_dump_task.cxx:51
auto process_message(const nlmsghdr &header) -> std::optional< std::expected< LinkEventList, std::error_code > >
Process a received netlink message for link dump responses.
Definition nl_link_dump_task.cxx:33
LinkEventList learned_
Definition nl_link_dump_task.hxx:25
Base task type for link-related netlink operations.
Definition nl_link_task.hxx:27
auto ifindex() const noexcept -> uint16_t
Definition nl_request_task.hxx:93
auto sequence() const noexcept -> uint32_t
Definition nl_request_task.hxx:89
Thread-safe guard owning a labeled Socket.
Definition nl_socket_guard.hxx:25
Definition nl_common.hxx:21
std::pmr::vector< LinkEvent > LinkEventList
Definition nl_link_event.hxx:62
Definition nl_common.hxx:20