NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
network-monitor-impl-osx.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2013-2017 Regents of the University of California.
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_NET_NETWORK_MONITOR_IMPL_OSX_HPP
23
#define NDN_NET_NETWORK_MONITOR_IMPL_OSX_HPP
24
25
#include "ndn-cxx-config.hpp"
26
#include "../network-monitor.hpp"
27
28
#ifndef NDN_CXX_HAVE_OSX_FRAMEWORKS
29
#error "This file should not be compiled ..."
30
#endif
31
32
#include "../../util/cf-releaser-osx.hpp"
33
#include "../../util/scheduler.hpp"
34
#include "../../util/scheduler-scoped-event-id.hpp"
35
36
#include <CoreFoundation/CoreFoundation.h>
37
#include <SystemConfiguration/SystemConfiguration.h>
38
39
#include <boost/asio/ip/udp.hpp>
40
41
namespace
ndn
{
42
namespace
net {
43
44
class
IfAddrs;
45
46
class
NetworkMonitorImplOsx
:
public
NetworkMonitorImpl
47
{
48
public
:
49
using
Error
=
NetworkMonitor::Error
;
50
51
NetworkMonitorImplOsx
(boost::asio::io_service& io);
52
53
~NetworkMonitorImplOsx
();
54
55
uint32_t
56
getCapabilities
() const final
57
{
58
return
NetworkMonitor::CAP_ENUM
|
59
NetworkMonitor::CAP_IF_ADD_REMOVE
|
60
NetworkMonitor::CAP_STATE_CHANGE
|
61
NetworkMonitor::CAP_ADDR_ADD_REMOVE
;
62
}
63
64
shared_ptr<const NetworkInterface>
65
getNetworkInterface
(
const
std::string& ifname)
const
final
;
66
67
std::vector<shared_ptr<const NetworkInterface>>
68
listNetworkInterfaces
()
const
final
;
69
70
private
:
71
static
void
72
afterNotificationCenterEvent(CFNotificationCenterRef center,
void
* observer,
73
CFStringRef
name
,
const
void
*
object
,
74
CFDictionaryRef userInfo);
75
76
void
77
scheduleCfLoop();
78
79
void
80
enumerateInterfaces();
81
82
std::set<std::string>
83
getInterfaceNames()
const
;
84
85
void
86
addNewInterface(
const
std::string& ifName,
const
IfAddrs
& ifaList);
87
88
InterfaceState
89
getInterfaceState(
const
NetworkInterface
& netif)
const
;
90
91
size_t
92
getInterfaceMtu(
const
NetworkInterface
& netif);
93
94
void
95
updateInterfaceInfo(
NetworkInterface
& netif,
const
IfAddrs
& ifaList);
96
97
static
void
98
onConfigChanged(SCDynamicStoreRef store, CFArrayRef changedKeys,
void
* context);
99
100
void
101
onConfigChanged(CFArrayRef changedKeys);
102
103
private
:
104
std::map<std::string, shared_ptr<NetworkInterface>> m_interfaces;
105
106
util::Scheduler m_scheduler;
107
util::scheduler::ScopedEventId
m_cfLoopEvent;
108
109
SCDynamicStoreContext m_context;
110
util::CFReleaser<SCDynamicStoreRef>
m_scStore;
111
util::CFReleaser<CFRunLoopSourceRef>
m_loopSource;
112
113
boost::asio::ip::udp::socket
m_ioctlSocket;
114
};
115
116
}
// namespace net
117
}
// namespace ndn
118
119
#endif // NDN_NET_NETWORK_MONITOR_IMPL_OSX_HPP
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-strategy-choice-helper.hpp:34
ndn::net::NetworkMonitor::Error
Definition:
network-monitor.hpp:57
ndn::net::NetworkMonitor::CAP_ENUM
listNetworkInterfaces() and getNetworkInterface() are supported
Definition:
network-monitor.hpp:81
ndn::net::IfAddrs
Definition:
network-monitor-impl-osx.cpp:76
ndn::net::NetworkMonitor::CAP_ADDR_ADD_REMOVE
NetworkInterface onAddressAdded and onAddressRemoved signals are supported.
Definition:
network-monitor.hpp:89
ndn::net::NetworkMonitorImplOsx::NetworkMonitorImplOsx
NetworkMonitorImplOsx(boost::asio::io_service &io)
Definition:
network-monitor-impl-osx.cpp:104
ndn::net::NetworkMonitor::CAP_STATE_CHANGE
NetworkInterface onStateChanged signal is supported.
Definition:
network-monitor.hpp:85
ndn::net::InterfaceState
InterfaceState
Indicates the state of a network interface.
Definition:
network-interface.hpp:49
ndn::net::NetworkMonitorImpl
Definition:
network-monitor.hpp:141
ndn::net::NetworkInterface
Represents one network interface attached to the host.
Definition:
network-interface.hpp:68
ndn::net::NetworkMonitorImplOsx::~NetworkMonitorImplOsx
~NetworkMonitorImplOsx()
Definition:
network-monitor-impl-osx.cpp:149
ndn::net::NetworkMonitorImplOsx::listNetworkInterfaces
std::vector< shared_ptr< const NetworkInterface > > listNetworkInterfaces() const final
Definition:
network-monitor-impl-osx.cpp:165
ndn::net::NetworkMonitorImplOsx
Definition:
network-monitor-impl-osx.hpp:46
ndn::util::CFReleaser< SCDynamicStoreRef >
ndn::net::NetworkMonitorImplOsx::getNetworkInterface
shared_ptr< const NetworkInterface > getNetworkInterface(const std::string &ifname) const final
Definition:
network-monitor-impl-osx.cpp:158
ndn::util::scheduler::ScopedEventId
Event that is automatically cancelled upon destruction.
Definition:
scheduler-scoped-event-id.hpp:33
ndn::net::NetworkMonitor::CAP_IF_ADD_REMOVE
NetworkMonitor onInterfaceAdded and onInterfaceRemoved signals are supported.
Definition:
network-monitor.hpp:83
websocketpp::transport::asio::socket::error::socket
Catch-all error for socket component errors that don't fit in other categories.
Definition:
base.hpp:83
ndn::net::NetworkMonitorImplOsx::getCapabilities
uint32_t getCapabilities() const final
Definition:
network-monitor-impl-osx.hpp:56
ndn::name
Definition:
name-component.cpp:37
ndnSIM
ndn-cxx
src
net
detail
network-monitor-impl-osx.hpp
Generated on Thu Nov 2 2017 03:30:28 for ndnSIM by
1.8.11