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

Namespaces

namespace  detail

Classes

class  Control
 High-level control interface for kernel netlink operations. More...
class  Listener
 Asynchronous netlink message listener and event dispatcher. More...
class  Signal
 Signal/slot wrapper supporting synchronous and asynchronous execution. More...
class  Signal< R(Args...), Combiner >
struct  enable_bitmask_operators
 Enable bitwise operators for an enum class. More...
struct  AddressEvent
struct  enable_bitmask_operators< AddressEvent::Flags >
struct  LinkEvent
struct  enable_bitmask_operators< LinkEvent::Flags >
struct  NeighborEvent
struct  RouteEvent
struct  enable_bitmask_operators< RouteEvent::Flags >
class  Endpoint
 Netlink-specific endpoint wrapper for Boost.Asio. More...
class  Protocol
 Protocol descriptor for netlink sockets. More...
class  Socket
 RAII wrapper for a Boost.Asio netlink socket. More...
class  SocketGuard
 Thread-safe guard owning a labeled Socket. More...
class  AddressDumpTask
 Task that performs a full address dump from the kernel. More...
struct  AddressRequest
class  AddressTask
 Base task type for address-related netlink operations. More...
class  LinkDumpTask
 Task that performs a full link dump from the kernel. More...
struct  LinkRequest
class  LinkTask
 Base task type for link-related netlink operations. More...
class  NeighborDumpTask
 Task that performs a complete neighbor table dump. More...
class  NeighborFlushTask
 Task that flushes (deletes) a specific neighbor entry. More...
class  NeighborGetTask
 Task that retrieves a single neighbor entry. More...
class  NeighborProbeTask
 Task that triggers a neighbor probe (solicit) for an address. More...
struct  NeighborRequest
class  NeighborTask
 Base task type for neighbor-related netlink operations. More...
class  RequestTask
 Base template for single-request netlink tasks. More...
class  RouteDumpTask
 Task that performs a full route table dump from the kernel. More...
struct  RouteRequest
class  RouteTask
 Base task type for route-related netlink operations. More...

Concepts

concept  IsEnumeration
concept  IsNetlinkEvent
concept  request_behavior

Typedefs

using AddressEventList = std::pmr::vector<AddressEvent>
using LinkEventList = std::pmr::vector<LinkEvent>
using NeighborEventList = std::pmr::vector<NeighborEvent>
using RouteEventList = std::pmr::vector<RouteEvent>

Enumerations

enum class  ExecPolicy { Sync , Async }

Functions

constexpr auto trim_string (std::string_view sv) -> std::string
 Remove trailing NUL characters and return an owning string.
template<size_t N>
constexpr auto trim_string (const std::array< char, N > &arr) -> std::string
 Remove trailing NULs from a fixed-size char array and return a string.
auto extract_ifname (const nlmsghdr &header) -> std::string
 Extract the interface name from a netlink header.
auto attribute_string (const rtattr &attr) -> std::string
 Convert an rtattr payload to a trimmed std::string.
auto attribute_address (const rtattr &attr, uint8_t family) -> std::string
 Convert an rtattr payload to a text representation of an IP address.
auto attribute_uint32 (const rtattr &attr) -> uint32_t
 Read a uint32_t value from an rtattr payload.
auto attribute_hwaddr (const rtattr &attr) -> std::string
 Format a hardware address (MAC) from an rtattr payload as a string.
template<typename MsgT>
const MsgT * get_msg_payload (const nlmsghdr &header)
 Get a typed pointer to the message payload in a netlink header.
template<typename MsgT, typename Fn>
void for_each_attr (const nlmsghdr &header, const MsgT *info, Fn &&fn)
 Iterate over rtattr attributes for a given message payload.
auto type_to_string (IsNetlinkEvent auto &&type) noexcept -> std::string_view
 Convert a netlink message or event type to a readable name.
auto family_to_string (uint8_t family) noexcept -> std::string_view
 Convert an address family constant to a human-readable name.
auto protocol_to_string (uint8_t protocol) noexcept -> std::string_view
 Convert a protocol identifier to a readable name.
auto route_type_to_string (uint8_t route_type) noexcept -> std::string_view
 Convert a route type constant to a string.
template<typename E>
constexpr E operator| (E lhs, E rhs)
template<typename E>
constexpr E operator& (E lhs, E rhs)
template<typename E>
constexpr E operator^ (E lhs, E rhs)
template<typename E>
constexpr E operator~ (E val)
template<typename E>
constexpr E & operator|= (E &lhs, E rhs)
template<typename E>
constexpr E & operator&= (E &lhs, E rhs)
template<typename E>
constexpr E & operator^= (E &lhs, E rhs)
template<typename E, std::integral U>
constexpr E operator<< (E lhs, U shift)
template<typename E, std::integral U>
constexpr E operator>> (E lhs, U shift)

Variables

template<typename _Tp>
constexpr bool enable_bitmask_operators_v = enable_bitmask_operators<_Tp>::value
constexpr uint32_t DEFAULT_GROUP_MASK

Typedef Documentation

◆ AddressEventList

using llmx::rtaco::AddressEventList = std::pmr::vector<AddressEvent>

◆ LinkEventList

using llmx::rtaco::LinkEventList = std::pmr::vector<LinkEvent>

◆ NeighborEventList

using llmx::rtaco::NeighborEventList = std::pmr::vector<NeighborEvent>

◆ RouteEventList

using llmx::rtaco::RouteEventList = std::pmr::vector<RouteEvent>

Enumeration Type Documentation

◆ ExecPolicy

enum class llmx::rtaco::ExecPolicy
strong
Enumerator
Sync 
Async 

Function Documentation

◆ attribute_address()

auto llmx::rtaco::attribute_address ( const rtattr & attr,
uint8_t family ) -> std::string
inline

Convert an rtattr payload to a text representation of an IP address.

Supports IPv4 and IPv6 families.

Parameters
attrAttribute containing the address bytes.
familyAddress family (AF_INET or AF_INET6).
Returns
Printable address string or empty string if conversion fails.

◆ attribute_hwaddr()

auto llmx::rtaco::attribute_hwaddr ( const rtattr & attr) -> std::string
inline

Format a hardware address (MAC) from an rtattr payload as a string.

Produces a colon-separated lowercase hex representation.

◆ attribute_string()

auto llmx::rtaco::attribute_string ( const rtattr & attr) -> std::string
inline

Convert an rtattr payload to a trimmed std::string.

Parameters
attrAttribute whose payload is interpreted as a NUL-terminated string.
Returns
Trimmed string value or empty string if payload is empty or invalid.

◆ attribute_uint32()

auto llmx::rtaco::attribute_uint32 ( const rtattr & attr) -> uint32_t
inline

Read a uint32_t value from an rtattr payload.

Returns 0 on insufficient payload length.

◆ extract_ifname()

auto llmx::rtaco::extract_ifname ( const nlmsghdr & header) -> std::string
inline

Extract the interface name from a netlink header.

Parses netlink attributes for an ifinfomsg within the provided header and returns the interface name if present.

Parameters
headerNetlink message header containing an ifinfomsg.
Returns
Interface name or empty string if not found.

◆ family_to_string()

auto llmx::rtaco::family_to_string ( uint8_t family) -> std::string_view
inlinenoexcept

Convert an address family constant to a human-readable name.

◆ for_each_attr()

template<typename MsgT, typename Fn>
void llmx::rtaco::for_each_attr ( const nlmsghdr & header,
const MsgT * info,
Fn && fn )
inline

Iterate over rtattr attributes for a given message payload.

Calls the provided function for each attribute discovered.

◆ get_msg_payload()

template<typename MsgT>
const MsgT * llmx::rtaco::get_msg_payload ( const nlmsghdr & header)
inline

Get a typed pointer to the message payload in a netlink header.

Template Parameters
MsgTMessage type expected in the payload (e.g., ifinfomsg).
Parameters
headerNetlink message header.
Returns
Pointer to the typed payload or nullptr if header is too short.

◆ operator&()

template<typename E>
E llmx::rtaco::operator& ( E lhs,
E rhs )
constexpr

◆ operator&=()

template<typename E>
E & llmx::rtaco::operator&= ( E & lhs,
E rhs )
constexpr

◆ operator<<()

template<typename E, std::integral U>
E llmx::rtaco::operator<< ( E lhs,
U shift )
constexpr

◆ operator>>()

template<typename E, std::integral U>
E llmx::rtaco::operator>> ( E lhs,
U shift )
constexpr

◆ operator^()

template<typename E>
E llmx::rtaco::operator^ ( E lhs,
E rhs )
constexpr

◆ operator^=()

template<typename E>
E & llmx::rtaco::operator^= ( E & lhs,
E rhs )
constexpr

◆ operator|()

template<typename E>
E llmx::rtaco::operator| ( E lhs,
E rhs )
constexpr

◆ operator|=()

template<typename E>
E & llmx::rtaco::operator|= ( E & lhs,
E rhs )
constexpr

◆ operator~()

template<typename E>
E llmx::rtaco::operator~ ( E val)
constexpr

◆ protocol_to_string()

auto llmx::rtaco::protocol_to_string ( uint8_t protocol) -> std::string_view
inlinenoexcept

Convert a protocol identifier to a readable name.

◆ route_type_to_string()

auto llmx::rtaco::route_type_to_string ( uint8_t route_type) -> std::string_view
inlinenoexcept

Convert a route type constant to a string.

◆ trim_string() [1/2]

template<size_t N>
auto llmx::rtaco::trim_string ( const std::array< char, N > & arr) -> std::string
inlineconstexpr

Remove trailing NULs from a fixed-size char array and return a string.

Convenience overload for fixed-size char arrays.

◆ trim_string() [2/2]

auto llmx::rtaco::trim_string ( std::string_view sv) -> std::string
inlineconstexpr

Remove trailing NUL characters and return an owning string.

Trims any trailing '\0' characters from the provided string_view and returns a newly allocated std::string containing the result.

Parameters
svInput string view possibly containing trailing NULs.
Returns
A std::string with trailing NULs removed.

◆ type_to_string()

auto llmx::rtaco::type_to_string ( IsNetlinkEvent auto && type) -> std::string_view
inlinenoexcept

Convert a netlink message or event type to a readable name.

Template Parameters
IsNetlinkEventAn enumeration or integral type representing the message/event type.
Parameters
typeThe event/type value.
Returns
Human-readable name for the type or "UNKNOWN" if not mapped.

Variable Documentation

◆ DEFAULT_GROUP_MASK

uint32_t llmx::rtaco::DEFAULT_GROUP_MASK
constexpr
Initial value:
= RTMGRP_LINK | RTMGRP_NEIGH | RTMGRP_IPV4_IFADDR |
RTMGRP_IPV6_IFADDR | RTMGRP_IPV4_ROUTE | RTMGRP_IPV6_ROUTE

◆ enable_bitmask_operators_v

template<typename _Tp>
bool llmx::rtaco::enable_bitmask_operators_v = enable_bitmask_operators<_Tp>::value
constexpr