UNISTDX_NET_NETLINK_POLLER
using ifaddr_message_container = sys::netlink_container< sys::ifaddr_message_header >

Netlink container for interface address messages.

using ifinfo_message_container = sys::netlink_container< sys::ifinfo_message_header >
enum ifinfo_attribute: u32
  • unspecified = IFLA_UNSPEC
  • interface_name = IFLA_IFNAME
  • link_info = IFLA_LINKINFO
  • link_info_kind = IFLA_INFO_KIND
  • link_info_data = IFLA_INFO_DATA
  • veth_peer_info = VETH_INFO_PEER
  • network_namespace_fd = IFLA_NET_NS_FD
enum ifinfo_message_type: u16
  • new_link = RTM_NEWLINK
  • delete_link = RTM_DELLINK
  • get_link = RTM_GETLINK
  • set_link = RTM_SETLINK
enum ifaddr_attribute: u32

Interface address attributes.

  • unspecified = IFA_UNSPEC
  • address = IFA_ADDRESS
  • local_address = IFA_LOCAL
  • interface_name = IFA_LABEL
  • broadcast_address = IFA_BROADCAST
  • anycast_address = IFA_ANYCAST
  • address_info = IFA_CACHEINFO
  • multicast_address = IFA_MULTICAST
  • flags = IFA_FLAGS
enum ifaddr_message_type: u16

Interface address message types.

  • get_address = RTM_GETADDR
  • new_address = RTM_NEWADDR
  • delete_address = RTM_DELADDR
enum netlink_message_type: u16

Netlink message types.

  • noop = NLMSG_NOOP
  • error = NLMSG_ERROR
  • done = NLMSG_DONE
  • overrun = NLMSG_OVERRUN
enum netlink_message_flags: u16

Netlink message flags.

  • request = NLM_F_REQUEST
  • multipart = NLM_F_MULTI
  • acknowledge = NLM_F_ACK
  • echo = NLM_F_ECHO
  • dump_inconsistent = NLM_F_DUMP_INTR
  • dump_filtered = NLM_F_DUMP_FILTERED
  • root = NLM_F_ROOT
  • all_matching = NLM_F_MATCH
  • atomic = NLM_F_ATOMIC
  • dump = NLM_F_DUMP
  • replace = NLM_F_REPLACE
  • exclude = NLM_F_EXCL
  • create = NLM_F_CREATE
  • append = NLM_F_APPEND
class sys::ifinfo_request
Types
Methods
  • skip(u16 n) -> void
  • end(attr_type * attr) -> void
  • begin(ifinfo_attribute type) -> attr_type *
  • add(ifinfo_attribute type, const std::string & value) -> void
  • add(ifinfo_attribute type, const void * data, u16 size) -> void
  • write(socket & sock) -> void
  • message() -> ifinfo_message &
  • header() -> ifinfo_message_header &
  • ~ifinfo_request()
  • ifinfo_request()
class sys::ifinfo_message
Base classes
  • public ifinfomsg
Types
  • using message_type = ifinfo_message_type
  • using attr_type = rtattributes< ifinfo_attribute >
Methods
template <class A>
class sys::rtattributes

Netlink route attributes.

A
attribute enumeration

A wrapper around rtattr system type (see rtnetlink(7)).

Base classes
  • public rtattr
Types
  • using attributes_type = A

    Attributes enumeration type.

Methods
  • type(attributes_type rhs) -> void
  • type() const -> attributes_type

    Attribute type (see rtnetlink(3)).

  • length(u16 rhs) -> void
  • length() const -> u16

    Attribute length.

  • data(const void * ptr, u16 n) -> void
  • template <class T>
    data() -> T *

    Returns the pointer to the beginning of attribute data.

  • next(int len) -> rtattributes *

    Returns the next attrubute.

  • ok(int len) const -> bool

    Returns true, if the attrubute is valid (see rtnetlink(3).

class sys::ifaddr_message

Netlink interaface address message. A wrapper around ifaddrmsg system type (see rtnetlink(7)).

Base classes
  • public ifaddrmsg
Types
Methods
class sys::ifinfo_message_header
Base classes
Types
  • using message_type = ifinfo_message_type
Methods
  • type(message_type rhs) -> void
  • type() const -> message_type
  • payload_length() const -> int
  • message() const -> const ifinfo_message *

    Returns pointer to message payload.

  • message() -> ifinfo_message *

    Returns pointer to message payload.

template <class T>
class sys::netlink_container

Container for netlink messages.

Types
  • using iterator = netlink_message_iterator< T >

    Message iterator type.

  • using size_type = int

    Message length type.

  • using value_type = T

    Message header type.

Methods
  • length() const -> int

    Netlink message length.

  • end() -> iterator

    Returns the pointer to the end of message sequence.

  • begin() -> iterator

    Returns the pointer to the beginning of message sequence.

  • read(socket & sock) -> void

    Read netlink message sequence from socket sock.

  • header() -> netlink_header &
  • header() const -> const netlink_header &
  • ~netlink_container()
  • netlink_container()
class sys::netlink_header

Netlink message header. A wrapper around nlmsghdr system type (see netlink(7)).

Base classes
  • public nlmsghdr
Derived classes
Methods
  • template <class T>
    tail() -> T *
  • template <class T>
    message() const -> const T *
  • template <class T>
    message() -> T *
  • template <class T>
    messages(int len) -> iterator_pair< netlink_message_iterator< T > >

    Returns all messages as traversable container.

  • template <class T>
    end() -> netlink_message_iterator< T >

    Returns iterator to the end of messages.

  • template <class T>
    begin(int len) -> netlink_message_iterator< T >

    Returns iterator to the first message.

  • payload_length(int len) const -> int

    Returns message payload length.

  • next(int len) -> netlink_header *

    Returns the next header in multipart message.

  • ok(u32 len) const -> bool

    Returns true, if the message is valid (see netlink(3)).

  • overrun() const -> bool

    Returns true, if message data was lost due to buffer overrun.

  • error() const -> bool

    Returns true, if message is an error.

  • done() const -> bool

    Returns true, if message is the last part of multipart message.

  • noop() const -> bool

    Returns true, if message type is to be ignored.

  • port() const -> u32

    Sender port identifier.

  • increment_sequence() -> u32

    Message sequence number.

  • sequence() const -> u32

    Message sequence number.

  • flags(netlink_message_flags rhs) -> void

    Set additional flags.

  • flags(u16 rhs) -> void

    Set additional flags.

  • flags() const -> u16

    Additional flags.

  • type() const -> netlink_message_type

    Payload type.

  • length(u32 rhs) -> void

    Set the length of the message with header.

  • length() const -> u32

    Length of message with header.

class sys::ifaddr_message_header

Netlink interface address message header. A wrapper around nlmsghdr for ifaddrmsg netlink messages (see rtnetlink(7)).

Base classes
Methods
  • type() -> netlink_message_type

    Payload type.

  • type(ifaddr_message_type rhs) -> void

    Set message type.

  • payload_length() const -> int

    Returns message payload length.

  • message() const -> const ifaddr_message *

    Returns pointer to message payload.

  • message() -> ifaddr_message *

    Returns pointer to message payload.

  • get_address() const -> bool

    Returns true, if the message contains address.

  • delete_address() const -> bool

    Returns true, if the message contains address that was deleted.

  • new_address() const -> bool

    Returns true, if the message contains address that was added.

struct sys::is_flag< netlink_message_flags >
Base classes
  • public std::true_type
operator<<(std::ostream & out, const ifaddr_attribute & rhs) -> std::ostream &

Print attribute name for debugging.

to_string(ifaddr_attribute rhs) -> const char *

Returns attribute name.