network-monitor-impl-osx.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22 #ifndef NDN_UTIL_NETWORK_MONITOR_IMPL_OSX_HPP
23 #define NDN_UTIL_NETWORK_MONITOR_IMPL_OSX_HPP
24 
25 #include "ndn-cxx-config.hpp"
26 #include "../network-monitor.hpp"
27 
28 #ifndef NDN_CXX_HAVE_COREFOUNDATION_COREFOUNDATION_H
29 #error "This file should not be compiled ..."
30 #endif
31 
32 #include "../scheduler.hpp"
33 #include "../scheduler-scoped-event-id.hpp"
34 
35 #include <CoreFoundation/CoreFoundation.h>
36 #include <SystemConfiguration/SystemConfiguration.h>
37 
38 namespace ndn {
39 namespace util {
40 
41 class NetworkMonitor::Impl
42 {
43 public:
44  Impl(NetworkMonitor& nm, boost::asio::io_service& io);
45 
46  ~Impl();
47 
48  uint32_t
50  {
53  }
54 
55  shared_ptr<NetworkInterface>
56  getNetworkInterface(const std::string& ifname) const;
57 
58  std::vector<shared_ptr<NetworkInterface>>
59  listNetworkInterfaces() const;
60 
61  static void
62  afterNotificationCenterEvent(CFNotificationCenterRef center,
63  void* observer,
64  CFStringRef name,
65  const void* object,
66  CFDictionaryRef userInfo);
67 
68 private:
69  void
70  scheduleCfLoop();
71 
72  void
73  pollCfLoop();
74 
75 private:
76  NetworkMonitor& m_nm;
77 
78  Scheduler m_scheduler;
79  scheduler::ScopedEventId m_cfLoopEvent;
80 };
81 
82 } // namespace util
83 } // namespace ndn
84 
85 #endif // NDN_UTIL_NETWORK_MONITOR_IMPL_OSX_HPP
Impl(NetworkMonitor &nm, boost::asio::io_service &io)
Copyright (c) 2013-2016 Regents of the University of California.
Definition: common.hpp:75
Network interfaces monitor.
NetworkMonitor(boost::asio::io_service &io)
Construct instance, request enumeration of all network interfaces, and start monitoring for network s...
static void afterNotificationCenterEvent(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo)
std::vector< shared_ptr< NetworkInterface > > listNetworkInterfaces() const
Event that is automatically cancelled upon destruction.
shared_ptr< NetworkInterface > getNetworkInterface(const std::string &) const
NetworkMonitor is not supported and is a no-op.