24 #ifndef NDN_UTIL_NETWORK_MONITOR_IMPL_RTNL_HPP
25 #define NDN_UTIL_NETWORK_MONITOR_IMPL_RTNL_HPP
27 #include "ndn-cxx-config.hpp"
28 #include "../network-monitor.hpp"
30 #ifndef NDN_CXX_HAVE_RTNETLINK
31 #error "This file should not be compiled ..."
34 #include <boost/asio/posix/stream_descriptor.hpp>
39 #include <linux/netlink.h>
40 #include <linux/rtnetlink.h>
41 #include <linux/if_addr.h>
42 #include <linux/if_link.h>
47 class NetworkMonitor::Impl
66 shared_ptr<NetworkInterface>
69 std::vector<shared_ptr<NetworkInterface>>
77 rtattr rta __attribute__((aligned(NLMSG_ALIGNTO)));
82 isEnumerating()
const;
88 sendDumpRequest(uint16_t nlmsgType);
94 handleRead(
const boost::system::error_code& error,
size_t nBytesReceived,
95 const shared_ptr<boost::asio::posix::stream_descriptor>& socket);
98 parseNetlinkMessage(
const nlmsghdr* nlh,
size_t len);
101 parseLinkMessage(
const nlmsghdr* nlh,
const ifinfomsg* ifi);
104 parseAddressMessage(
const nlmsghdr* nlh,
const ifaddrmsg* ifa);
107 parseRouteMessage(
const nlmsghdr* nlh,
const rtmsg* rtm);
114 std::map<
int , shared_ptr<NetworkInterface>> m_interfaces;
115 std::array<uint8_t, 16384> m_buffer;
116 shared_ptr<boost::asio::posix::stream_descriptor> m_socket;
118 uint32_t m_sequenceNo;
119 bool m_isEnumeratingLinks;
120 bool m_isEnumeratingAddresses;
126 #endif // NDN_UTIL_NETWORK_MONITOR_IMPL_RTNL_HPP
Impl(NetworkMonitor &nm, boost::asio::io_service &io)
Copyright (c) 2013-2016 Regents of the University of California.
NetworkMonitor onInterfaceAdded and onInterfaceRemoved signals are supported.
Network interfaces monitor.
listNetworkInterfaces() and getNetworkInterface() are supported
NetworkMonitor(boost::asio::io_service &io)
Construct instance, request enumeration of all network interfaces, and start monitoring for network s...
Represents one network interface attached to the host.
NetworkInterface onStateChanged signal is supported.
std::vector< shared_ptr< NetworkInterface > > listNetworkInterfaces() const
uint32_t getCapabilities() const
NetworkInterface onMtuChanged signal is supported.
shared_ptr< NetworkInterface > getNetworkInterface(const std::string &) const
NetworkInterface onAddressAdded and onAddressRemoved signals are supported.