Davide Pesavento | 9a8bae5 | 2016-02-24 20:33:08 +0100 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /** |
Davide Pesavento | 2bf35a6 | 2017-04-02 00:41:06 -0400 | [diff] [blame^] | 3 | * Copyright (c) 2013-2017 Regents of the University of California. |
Davide Pesavento | 9a8bae5 | 2016-02-24 20:33:08 +0100 | [diff] [blame] | 4 | * |
| 5 | * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions). |
| 6 | * |
| 7 | * ndn-cxx library is free software: you can redistribute it and/or modify it under the |
| 8 | * terms of the GNU Lesser General Public License as published by the Free Software |
| 9 | * Foundation, either version 3 of the License, or (at your option) any later version. |
| 10 | * |
| 11 | * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY |
| 12 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
| 13 | * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. |
| 14 | * |
| 15 | * You should have received copies of the GNU General Public License and GNU Lesser |
| 16 | * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see |
| 17 | * <http://www.gnu.org/licenses/>. |
| 18 | * |
| 19 | * See AUTHORS.md for complete list of ndn-cxx authors and contributors. |
| 20 | */ |
| 21 | |
| 22 | #ifndef NDN_UTIL_NETWORK_MONITOR_IMPL_OSX_HPP |
| 23 | #define NDN_UTIL_NETWORK_MONITOR_IMPL_OSX_HPP |
| 24 | |
Davide Pesavento | 2bf35a6 | 2017-04-02 00:41:06 -0400 | [diff] [blame^] | 25 | #include "ndn-cxx-config.hpp" |
Davide Pesavento | 9a8bae5 | 2016-02-24 20:33:08 +0100 | [diff] [blame] | 26 | #include "../network-monitor.hpp" |
| 27 | |
Davide Pesavento | 2bf35a6 | 2017-04-02 00:41:06 -0400 | [diff] [blame^] | 28 | #ifndef NDN_CXX_HAVE_COREFOUNDATION_COREFOUNDATION_H |
| 29 | #error "This file should not be compiled ..." |
| 30 | #endif |
| 31 | |
Davide Pesavento | 9a8bae5 | 2016-02-24 20:33:08 +0100 | [diff] [blame] | 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 | |
Davide Pesavento | 2bf35a6 | 2017-04-02 00:41:06 -0400 | [diff] [blame^] | 48 | shared_ptr<NetworkInterface> |
| 49 | getNetworkInterface(const std::string& ifname) const; |
| 50 | |
| 51 | std::vector<shared_ptr<NetworkInterface>> |
| 52 | listNetworkInterfaces() const; |
| 53 | |
Davide Pesavento | 9a8bae5 | 2016-02-24 20:33:08 +0100 | [diff] [blame] | 54 | static void |
| 55 | afterNotificationCenterEvent(CFNotificationCenterRef center, |
Davide Pesavento | 2bf35a6 | 2017-04-02 00:41:06 -0400 | [diff] [blame^] | 56 | void* observer, |
Davide Pesavento | 9a8bae5 | 2016-02-24 20:33:08 +0100 | [diff] [blame] | 57 | CFStringRef name, |
Davide Pesavento | 2bf35a6 | 2017-04-02 00:41:06 -0400 | [diff] [blame^] | 58 | const void* object, |
Davide Pesavento | 9a8bae5 | 2016-02-24 20:33:08 +0100 | [diff] [blame] | 59 | CFDictionaryRef userInfo); |
| 60 | |
| 61 | private: |
| 62 | void |
| 63 | scheduleCfLoop(); |
| 64 | |
| 65 | void |
| 66 | pollCfLoop(); |
| 67 | |
| 68 | private: |
| 69 | NetworkMonitor& m_nm; |
| 70 | |
| 71 | Scheduler m_scheduler; |
| 72 | scheduler::ScopedEventId m_cfLoopEvent; |
| 73 | }; |
| 74 | |
| 75 | } // namespace util |
| 76 | } // namespace ndn |
| 77 | |
| 78 | #endif // NDN_UTIL_NETWORK_MONITOR_IMPL_OSX_HPP |