llmx-rtaco 0.0.1
RTNL-only netlink control-plane library for Linux (C++23).
Loading...
Searching...
No Matches
nl_neighbor_get_task.hxx
Go to the documentation of this file.
1#pragma once
2
3#include <stdint.h>
4#include <array>
5#include <expected>
6#include <optional>
7#include <span>
8#include <system_error>
9
12
13struct nlmsghdr;
14
15namespace llmx {
16namespace rtaco {
17
18class SocketGuard;
19
25class NeighborGetTask : public NeighborTask<NeighborGetTask, NeighborEvent> {
26 std::array<uint8_t, 16> address_;
27
28public:
36 NeighborGetTask(SocketGuard& socket_guard, uint16_t uint16_t, uint32_t sequence,
37 std::span<uint8_t, 16> address);
38
40 void prepare_request();
41
47 auto process_message(const nlmsghdr& header)
48 -> std::optional<std::expected<NeighborEvent, std::error_code>>;
49
50private:
51 auto handle_done() -> std::expected<NeighborEvent, std::error_code>;
52 auto handle_error(const nlmsghdr& header)
53 -> std::expected<NeighborEvent, std::error_code>;
54 auto handle_neighbor(const nlmsghdr& header)
55 -> std::optional<std::expected<NeighborEvent, std::error_code>>;
56};
57
58} // namespace rtaco
59} // namespace llmx
void prepare_request()
Prepare the netlink request to get the neighbor.
Definition nl_neighbor_get_task.cxx:29
auto process_message(const nlmsghdr &header) -> std::optional< std::expected< NeighborEvent, std::error_code > >
Process a response message and extract a NeighborEvent.
Definition nl_neighbor_get_task.cxx:33
NeighborGetTask(SocketGuard &socket_guard, uint16_t uint16_t, uint32_t sequence, std::span< uint8_t, 16 > address)
Construct a NeighborGetTask to retrieve a single neighbor entry.
Definition nl_neighbor_get_task.cxx:21
std::array< uint8_t, 16 > address_
Definition nl_neighbor_get_task.hxx:26
auto handle_done() -> std::expected< NeighborEvent, std::error_code >
Definition nl_neighbor_get_task.cxx:47
auto handle_neighbor(const nlmsghdr &header) -> std::optional< std::expected< NeighborEvent, std::error_code > >
Definition nl_neighbor_get_task.cxx:64
auto handle_error(const nlmsghdr &header) -> std::expected< NeighborEvent, std::error_code >
Definition nl_neighbor_get_task.cxx:51
Base task type for neighbor-related netlink operations.
Definition nl_neighbor_task.hxx:29
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
Definition nl_common.hxx:20