llmx-rtaco 0.0.1
RTNL-only netlink control-plane library for Linux (C++23).
Loading...
Searching...
No Matches
llmx::rtaco::NeighborGetTask Class Reference

Task that retrieves a single neighbor entry. More...

#include <nl_neighbor_get_task.hxx>

Inheritance diagram for llmx::rtaco::NeighborGetTask:
llmx::rtaco::NeighborTask< NeighborGetTask, NeighborEvent > llmx::rtaco::RequestTask< NeighborGetTask, NeighborEvent >

Public Member Functions

 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.
void prepare_request ()
 Prepare the netlink request to get the neighbor.
auto process_message (const nlmsghdr &header) -> std::optional< std::expected< NeighborEvent, std::error_code > >
 Process a response message and extract a NeighborEvent.
Public Member Functions inherited from llmx::rtaco::NeighborTask< NeighborGetTask, NeighborEvent >
auto request_payload () const -> std::span< const uint8_t >
 Get the serialized request payload for the neighbor request.
Public Member Functions inherited from llmx::rtaco::RequestTask< NeighborGetTask, NeighborEvent >
 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< NeighborEvent, std::error_code > >
 Run the request asynchronously and return the result.

Private Member Functions

auto handle_done () -> std::expected< NeighborEvent, std::error_code >
auto handle_error (const nlmsghdr &header) -> std::expected< NeighborEvent, std::error_code >
auto handle_neighbor (const nlmsghdr &header) -> std::optional< std::expected< NeighborEvent, std::error_code > >

Private Attributes

std::array< uint8_t, 16 > address_

Additional Inherited Members

Protected Member Functions inherited from llmx::rtaco::NeighborTask< NeighborGetTask, NeighborEvent >
void build_request (uint16_t msg_type, uint16_t msg_flags, uint16_t ndm_state, uint8_t ndm_flags, std::span< uint8_t, 16 > address)
Protected Member Functions inherited from llmx::rtaco::RequestTask< NeighborGetTask, NeighborEvent >
auto socket () noexcept -> Socket &
auto sequence () const noexcept -> uint32_t
auto ifindex () const noexcept -> uint16_t
Protected Attributes inherited from llmx::rtaco::NeighborTask< NeighborGetTask, NeighborEvent >
NeighborRequest request_

Detailed Description

Task that retrieves a single neighbor entry.

Sends a lookup request for the given neighbor address on the specified interface and returns the corresponding NeighborEvent if found.

Constructor & Destructor Documentation

◆ NeighborGetTask()

llmx::rtaco::NeighborGetTask::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.

Parameters
socket_guardSocket guard used for IO.
uint16_tInterface index.
sequenceNetlink message sequence number.
addressAddress bytes identifying the neighbor.

Member Function Documentation

◆ handle_done()

auto llmx::rtaco::NeighborGetTask::handle_done ( ) -> std::expected< NeighborEvent, std::error_code >
private

◆ handle_error()

auto llmx::rtaco::NeighborGetTask::handle_error ( const nlmsghdr & header) -> std::expected< NeighborEvent, std::error_code >
private

◆ handle_neighbor()

auto llmx::rtaco::NeighborGetTask::handle_neighbor ( const nlmsghdr & header) -> std::optional< std::expected< NeighborEvent, std::error_code > >
private

◆ prepare_request()

void llmx::rtaco::NeighborGetTask::prepare_request ( )

Prepare the netlink request to get the neighbor.

◆ process_message()

auto llmx::rtaco::NeighborGetTask::process_message ( const nlmsghdr & header) -> std::optional< std::expected< NeighborEvent, std::error_code > >

Process a response message and extract a NeighborEvent.

Parameters
headerNetlink message header.
Returns
Optional expected NeighborEvent or error.

Member Data Documentation

◆ address_

std::array<uint8_t, 16> llmx::rtaco::NeighborGetTask::address_
private

The documentation for this class was generated from the following files: