3#include <boost/asio/basic_raw_socket.hpp>
4#include <boost/asio/detail/socket_types.hpp>
10#include <linux/netlink.h>
11#include <sys/socket.h>
22template<
typename Protocol>
26 using data_type = boost::asio::detail::socket_addr_type;
36 Endpoint(uint32_t groups, uint32_t pid = AF_UNSPEC)
noexcept {
61 auto size() const noexcept ->
size_t {
73 return std::memcmp(&lhs.sockaddr_, &rhs.sockaddr_,
sizeof(sockaddr_nl)) == 0;
81 return std::memcmp(&lhs.sockaddr_, &rhs.sockaddr_,
sizeof(sockaddr_nl)) < 0;
108 using socket = boost::asio::basic_raw_socket<Protocol>;
117 auto type() const noexcept ->
int {
Netlink-specific endpoint wrapper for Boost.Asio.
Definition nl_protocol.hxx:23
auto protocol() const noexcept -> protocol_type
Return the protocol type instance for this endpoint.
Definition nl_protocol.hxx:46
auto data() const noexcept -> const data_type *
Get const pointer to raw socket address storage.
Definition nl_protocol.hxx:56
boost::asio::detail::socket_addr_type data_type
Definition nl_protocol.hxx:26
Endpoint(const Endpoint &other) noexcept=default
sockaddr_nl sockaddr_
Definition nl_protocol.hxx:97
auto size() const noexcept -> size_t
Size of this endpoint's address structure.
Definition nl_protocol.hxx:61
Endpoint() noexcept
Default construct an Endpoint with unspecified pid/groups.
Definition nl_protocol.hxx:29
friend bool operator==(const Endpoint &lhs, const Endpoint &rhs) noexcept
Definition nl_protocol.hxx:72
friend bool operator<(const Endpoint &lhs, const Endpoint &rhs) noexcept
Definition nl_protocol.hxx:80
auto data() noexcept -> data_type *
Get mutable pointer to raw socket address storage.
Definition nl_protocol.hxx:51
auto capacity() const noexcept -> size_t
Capacity of the address storage.
Definition nl_protocol.hxx:68
void resize(size_t) noexcept
Definition nl_protocol.hxx:65
friend bool operator>(const Endpoint &lhs, const Endpoint &rhs) noexcept
Definition nl_protocol.hxx:84
friend bool operator<=(const Endpoint &lhs, const Endpoint &rhs) noexcept
Definition nl_protocol.hxx:88
Protocol protocol_type
Definition nl_protocol.hxx:25
Endpoint(uint32_t groups, uint32_t pid=AF_UNSPEC) noexcept
Construct an Endpoint for the given multicast groups and pid.
Definition nl_protocol.hxx:36
Endpoint & operator=(const Endpoint &other) noexcept=default
friend bool operator>=(const Endpoint &lhs, const Endpoint &rhs) noexcept
Definition nl_protocol.hxx:92
friend bool operator!=(const Endpoint &lhs, const Endpoint &rhs) noexcept
Definition nl_protocol.hxx:76
Protocol descriptor for netlink sockets.
Definition nl_protocol.hxx:105
Protocol(int proto) noexcept
Construct a Protocol wrapper for a given netlink protocol.
Definition nl_protocol.hxx:113
boost::asio::basic_raw_socket< Protocol > socket
Definition nl_protocol.hxx:108
auto type() const noexcept -> int
Socket type for this protocol (SOCK_RAW).
Definition nl_protocol.hxx:117
auto family() const noexcept -> int
Address family (AF_NETLINK).
Definition nl_protocol.hxx:127
Endpoint< Protocol > endpoint
Definition nl_protocol.hxx:107
int proto_
Definition nl_protocol.hxx:132
auto protocol() const noexcept -> int
Underlying protocol number used with socket(2).
Definition nl_protocol.hxx:122
Definition nl_common.hxx:21
Definition nl_common.hxx:20