llmx-rtaco 0.0.1
RTNL-only netlink control-plane library for Linux (C++23).
Loading...
Searching...
No Matches
nl_link_event.hxx
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4#include <string>
5#include <vector>
6
7#include <linux/rtnetlink.h>
8
10
11struct nlmsghdr;
12
13namespace llmx {
14namespace rtaco {
15
16struct LinkEvent {
17 enum class Type : uint16_t {
19 NEW_LINK = RTM_NEWLINK,
20 DELETE_LINK = RTM_DELLINK,
21 };
22
23 enum class Flags : uint32_t {
24 UNKNOWN = 0, // 0x00000000
25 UP = (1u << 0), // 0x00000001
26 BROADCAST = (1u << 1), // 0x00000002
27 DEBUG = (1u << 2), // 0x00000004
28 LOOPBACK = (1u << 3), // 0x00000008
29 POINTOPOINT = (1u << 4), // 0x00000010
30 NOTRAILERS = (1u << 5), // 0x00000020
31 RUNNING = (1u << 6), // 0x00000040
32 NOARP = (1u << 7), // 0x00000080
33 PROMISC = (1u << 8), // 0x00000100
34 ALLMULTI = (1u << 9), // 0x00000200
35 MASTER = (1u << 10), // 0x00000400
36 SLAVE = (1u << 11), // 0x00000800
37 MULTICAST = (1u << 12), // 0x00001000
38 PORTSEL = (1u << 13), // 0x00002000
39 AUTOMEDIA = (1u << 14), // 0x00004000
40 DYNAMIC = (1u << 15), // 0x00008000
41 LOWER_UP = (1u << 16), // 0x00010000
42 DORMANT = (1u << 17), // 0x00020000
43 ECHO = (1u << 18), // 0x00040000
44 };
45
47 int index{0};
49 uint32_t change{0};
50 std::string name{};
51
59 static auto from_nlmsghdr(const nlmsghdr& header) -> LinkEvent;
60};
61
62using LinkEventList = std::pmr::vector<LinkEvent>;
63
64template<>
65struct enable_bitmask_operators<LinkEvent::Flags> : std::true_type {};
66
67} // namespace rtaco
68} // namespace llmx
Definition nl_common.hxx:21
std::pmr::vector< LinkEvent > LinkEventList
Definition nl_link_event.hxx:62
Definition nl_common.hxx:20
Definition nl_link_event.hxx:16
Flags flags
Definition nl_link_event.hxx:48
int index
Definition nl_link_event.hxx:47
static auto from_nlmsghdr(const nlmsghdr &header) -> LinkEvent
Parse a LinkEvent from a netlink message header.
Definition nl_link_event.cxx:11
std::string name
Definition nl_link_event.hxx:50
Type
Definition nl_link_event.hxx:17
@ UNKNOWN
Definition nl_link_event.hxx:18
@ DELETE_LINK
Definition nl_link_event.hxx:20
@ NEW_LINK
Definition nl_link_event.hxx:19
Flags
Definition nl_link_event.hxx:23
@ DYNAMIC
Definition nl_link_event.hxx:40
@ RUNNING
Definition nl_link_event.hxx:31
@ POINTOPOINT
Definition nl_link_event.hxx:29
@ NOARP
Definition nl_link_event.hxx:32
@ PROMISC
Definition nl_link_event.hxx:33
@ UNKNOWN
Definition nl_link_event.hxx:24
@ NOTRAILERS
Definition nl_link_event.hxx:30
@ DORMANT
Definition nl_link_event.hxx:42
@ SLAVE
Definition nl_link_event.hxx:36
@ BROADCAST
Definition nl_link_event.hxx:26
@ MASTER
Definition nl_link_event.hxx:35
@ LOWER_UP
Definition nl_link_event.hxx:41
@ MULTICAST
Definition nl_link_event.hxx:37
@ AUTOMEDIA
Definition nl_link_event.hxx:39
@ ECHO
Definition nl_link_event.hxx:43
@ PORTSEL
Definition nl_link_event.hxx:38
@ LOOPBACK
Definition nl_link_event.hxx:28
@ DEBUG
Definition nl_link_event.hxx:27
@ ALLMULTI
Definition nl_link_event.hxx:34
@ UP
Definition nl_link_event.hxx:25
uint32_t change
Definition nl_link_event.hxx:49
Type type
Definition nl_link_event.hxx:46
Enable bitwise operators for an enum class.
Definition nl_utils.hxx:26