join 1.0
lightweight network framework library
Loading...
Searching...
No Matches
netlink_protocol.hpp
Go to the documentation of this file.
1
25#ifndef JOIN_FABRIC_NETLINK_PROTOCOL_HPP
26#define JOIN_FABRIC_NETLINK_PROTOCOL_HPP
27
28// libjoin.
30#include <join/protocol.hpp>
31
32namespace join
33{
37 class Netlink
38 {
39 public:
42
47 constexpr Netlink (int proto = NETLINK_ROUTE) noexcept
48 : _proto (proto)
49 {
50 }
51
56 static inline Netlink& rt () noexcept
57 {
58 static Netlink route (NETLINK_ROUTE);
59 return route;
60 }
61
66 static inline Netlink& nf () noexcept
67 {
68 static Netlink netfilter (NETLINK_NETFILTER);
69 return netfilter;
70 }
71
76 constexpr int family () const noexcept
77 {
78 return AF_NETLINK;
79 }
80
85 constexpr int type () const noexcept
86 {
87 return SOCK_RAW;
88 }
89
94 constexpr int protocol () const noexcept
95 {
96 return _proto;
97 }
98
99 private:
101 int _proto;
102 };
103
110 constexpr bool operator== (const Netlink& a, const Netlink& b) noexcept
111 {
112 return a.protocol () == b.protocol ();
113 }
114
121 constexpr bool operator!= (const Netlink& a, const Netlink& b) noexcept
122 {
123 return !(a == b);
124 }
125}
126
127#endif
basic netlink endpoint class.
Definition netlink_endpoint.hpp:43
Definition acceptor.hpp:32
bool operator==(const BasicLinkLayerEndpoint< Protocol > &a, const BasicLinkLayerEndpoint< Protocol > &b) noexcept
compare if endpoints are equal.
Definition endpoint.hpp:186
bool operator!=(const BasicLinkLayerEndpoint< Protocol > &a, const BasicLinkLayerEndpoint< Protocol > &b) noexcept
compare if endpoints are not equal.
Definition endpoint.hpp:198