NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
network-monitor.cpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
25
#include "
network-monitor.hpp
"
26
#include "ndn-cxx-config.hpp"
27
28
#if defined(NDN_CXX_HAVE_OSX_FRAMEWORKS)
29
#include "
detail/network-monitor-impl-osx.hpp
"
30
#define NETWORK_MONITOR_IMPL_TYPE NetworkMonitorImplOsx
31
#elif defined(NDN_CXX_HAVE_RTNETLINK)
32
#include "
detail/network-monitor-impl-rtnl.hpp
"
33
#define NETWORK_MONITOR_IMPL_TYPE NetworkMonitorImplRtnl
34
#else
35
#include "
detail/network-monitor-impl-noop.hpp
"
36
#define NETWORK_MONITOR_IMPL_TYPE NetworkMonitorImplNoop
37
#endif
38
39
namespace
ndn
{
40
namespace
net
{
41
42
NetworkMonitor::NetworkMonitor
(boost::asio::io_service& io)
43
:
NetworkMonitor
(
make_unique
<
NETWORK_MONITOR_IMPL_TYPE
>(io))
44
{
45
}
46
47
NetworkMonitor::NetworkMonitor
(unique_ptr<NetworkMonitorImpl> impl)
48
: m_impl(
std
::move(impl))
49
, onEnumerationCompleted(m_impl->onEnumerationCompleted)
50
, onInterfaceAdded(m_impl->onInterfaceAdded)
51
, onInterfaceRemoved(m_impl->onInterfaceRemoved)
52
, onNetworkStateChanged(m_impl->onNetworkStateChanged)
53
{
54
}
55
56
uint32_t
57
NetworkMonitor::getCapabilities
()
const
58
{
59
return
m_impl->getCapabilities();
60
}
61
62
shared_ptr<const NetworkInterface>
63
NetworkMonitor::getNetworkInterface
(
const
std::string& ifname)
const
64
{
65
return
m_impl->getNetworkInterface(ifname);
66
}
67
68
std::vector<shared_ptr<const NetworkInterface>>
69
NetworkMonitor::listNetworkInterfaces
()
const
70
{
71
return
m_impl->listNetworkInterfaces();
72
}
73
74
shared_ptr<NetworkInterface>
75
NetworkMonitorImpl::makeNetworkInterface
()
76
{
77
// cannot use make_shared because NetworkInterface constructor is private
78
return
shared_ptr<NetworkInterface>(
new
NetworkInterface
);
79
}
80
81
}
// namespace net
82
}
// namespace ndn
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-strategy-choice-helper.hpp:34
network-monitor-impl-rtnl.hpp
ndn::net::NetworkMonitor::NetworkMonitor
NetworkMonitor(boost::asio::io_service &io)
Construct instance, request enumeration of all network interfaces, and start monitoring for network s...
Definition:
network-monitor.cpp:42
ndn::net::NetworkMonitorImpl::makeNetworkInterface
static shared_ptr< NetworkInterface > makeNetworkInterface()
Definition:
network-monitor.cpp:75
network-monitor-impl-osx.hpp
std
STL namespace.
ndn::net::NetworkMonitor::getCapabilities
uint32_t getCapabilities() const
Returns a bitwise OR'ed set of Capability flags supported on the current platform.
Definition:
network-monitor.cpp:57
NETWORK_MONITOR_IMPL_TYPE
#define NETWORK_MONITOR_IMPL_TYPE
Copyright (c) 2013-2017 Regents of the University of California.
Definition:
network-monitor.cpp:36
ndn::net::NetworkMonitor
Network interface monitor.
Definition:
network-monitor.hpp:50
ndn::net::NetworkInterface
Represents one network interface attached to the host.
Definition:
network-interface.hpp:68
network-monitor-impl-noop.hpp
ndn::net::NetworkMonitor::listNetworkInterfaces
std::vector< shared_ptr< const NetworkInterface > > listNetworkInterfaces() const
Lists all network interfaces currently available on the system.
Definition:
network-monitor.cpp:69
ndn::net::NetworkMonitor::getNetworkInterface
shared_ptr< const NetworkInterface > getNetworkInterface(const std::string &ifname) const
Returns the NetworkInterface with the given name, or nullptr if it does not exist.
Definition:
network-monitor.cpp:63
ndn::make_unique
unique_ptr< T > make_unique(Args &&... args)
Definition:
backports.hpp:73
ndn::net
Definition:
link-type-helper.cpp:30
network-monitor.hpp
ndnSIM
ndn-cxx
src
net
network-monitor.cpp
Generated on Sun Feb 25 2018 13:27:05 for ndnSIM by
1.8.14