53 #include "ndn-cxx-config.hpp"
55 #ifdef NDN_CXX_HAVE_COREFOUNDATION_COREFOUNDATION_H
58 #include "../network-interface.hpp"
66 , m_cfLoopEvent(m_scheduler)
83 CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(),
84 static_cast<void*>(
this),
86 CFSTR(
"com.apple.system.config.network_change"),
88 CFNotificationSuspensionBehaviorDeliverImmediately);
93 CFNotificationCenterRemoveEveryObserver(CFNotificationCenterGetDarwinNotifyCenter(),
94 static_cast<void*>(
this));
97 shared_ptr<NetworkInterface>
103 std::vector<shared_ptr<NetworkInterface>>
114 CFDictionaryRef userInfo)
116 static_cast<Impl*
>(observer)->m_nm.onNetworkStateChanged();
120 NetworkMonitor::Impl::scheduleCfLoop()
123 m_cfLoopEvent = m_scheduler.scheduleEvent(time::seconds(1), bind(&Impl::pollCfLoop,
this));
127 NetworkMonitor::Impl::pollCfLoop()
130 CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0,
true);
138 #endif // NDN_CXX_HAVE_COREFOUNDATION_COREFOUNDATION_H
Impl(NetworkMonitor &nm, boost::asio::io_service &io)
Copyright (c) 2013-2016 Regents of the University of California.
ndn NetworkMonitor
Copyright (c) 2013-2017 Regents of the University of California.
static void afterNotificationCenterEvent(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo)
std::vector< shared_ptr< NetworkInterface > > listNetworkInterfaces() const
shared_ptr< NetworkInterface > getNetworkInterface(const std::string &) const