28 #include "ndn-cxx/detail/config.hpp" 30 #if defined(NDN_CXX_HAVE_OSX_FRAMEWORKS) 32 #define NETWORK_MONITOR_IMPL_TYPE NetworkMonitorImplOsx 33 #elif defined(NDN_CXX_HAVE_NETLINK) 35 #define NETWORK_MONITOR_IMPL_TYPE NetworkMonitorImplNetlink 37 #define NETWORK_MONITOR_IMPL_TYPE NetworkMonitorImplNoop 45 static unique_ptr<NetworkMonitorImpl>
49 return make_unique<NETWORK_MONITOR_IMPL_TYPE>(io);
51 catch (
const std::runtime_error& e) {
54 return make_unique<NetworkMonitorImplNoop>(io);
75 return m_impl->getCapabilities();
78 shared_ptr<const NetworkInterface>
81 return m_impl->getNetworkInterface(ifname);
84 std::vector<shared_ptr<const NetworkInterface>>
87 return m_impl->listNetworkInterfaces();
90 shared_ptr<NetworkInterface>
Copyright (c) 2011-2015 Regents of the University of California.
NetworkMonitor(boost::asio::io_service &io)
Construct instance, request enumeration of all network interfaces, and start monitoring for network s...
static shared_ptr< NetworkInterface > makeNetworkInterface()
util::Signal< NetworkMonitorImpl, shared_ptr< const NetworkInterface > > & onInterfaceAdded
Fires whenever a new interface is detected on the system.
#define NDN_LOG_WARN(expression)
util::Signal< NetworkMonitorImpl > & onNetworkStateChanged
uint32_t getCapabilities() const
Returns a bitwise OR'ed set of Capability flags supported on the current platform.
#define NETWORK_MONITOR_IMPL_TYPE
static unique_ptr< NetworkMonitorImpl > makeNetworkMonitorImpl(boost::asio::io_service &io)
Network interface monitor.
Represents one network interface attached to the host.
util::Signal< NetworkMonitorImpl, shared_ptr< const NetworkInterface > > & onInterfaceRemoved
Fires whenever an interface disappears from the system.
NDN_CXX_NODISCARD std::vector< shared_ptr< const NetworkInterface > > listNetworkInterfaces() const
Lists all network interfaces currently available on the system.
shared_ptr< const NetworkInterface > getNetworkInterface(const std::string &ifname) const
Returns the NetworkInterface with the given name, or nullptr if it does not exist.
#define NDN_LOG_INIT(name)
declare a log module
util::Signal< NetworkMonitorImpl > & onEnumerationCompleted
Fires when the enumeration of all network interfaces on the system is complete.