Network interface monitor. More...
#include <ndn-cxx/net/network-monitor.hpp>
Classes | |
class | Error |
Public Types | |
enum | Capability : uint32_t { CAP_NONE = 0 , CAP_ENUM = 1 << 0 , CAP_IF_ADD_REMOVE = 1 << 1 , CAP_STATE_CHANGE = 1 << 2 , CAP_MTU_CHANGE = 1 << 3 , CAP_ADDR_ADD_REMOVE = 1 << 4 } |
Public Member Functions | |
NetworkMonitor (boost::asio::io_context &ioCtx) | |
Construct instance, request enumeration of all network interfaces, and start monitoring for network state changes. More... | |
uint32_t | getCapabilities () const |
Returns a bitwise OR'ed set of Capability flags supported on the current platform. More... | |
shared_ptr< const NetworkInterface > | getNetworkInterface (const std::string &ifname) const |
Returns the NetworkInterface with the given name, or nullptr if it does not exist. More... | |
std::vector< shared_ptr< const NetworkInterface > > | listNetworkInterfaces () const |
Lists all network interfaces currently available on the system. More... | |
Public Attributes | |
signal::Signal< NetworkMonitorImpl > & | onEnumerationCompleted |
Fires when the enumeration of all network interfaces on the system is complete. More... | |
signal::Signal< NetworkMonitorImpl, shared_ptr< const NetworkInterface > > & | onInterfaceAdded |
Fires whenever a new interface is detected on the system. More... | |
signal::Signal< NetworkMonitorImpl, shared_ptr< const NetworkInterface > > & | onInterfaceRemoved |
Fires whenever an interface disappears from the system. More... | |
signal::Signal< NetworkMonitorImpl > & | onNetworkStateChanged |
Protected Member Functions | |
NetworkMonitor (unique_ptr< NetworkMonitorImpl > impl) | |
NetworkMonitorImpl & | getImpl () |
Network interface monitor.
Maintains an up-to-date view of every system network interface and notifies when an interface is added or removed.
Definition at line 51 of file network-monitor.hpp.
enum ndn::net::NetworkMonitor::Capability : uint32_t |
Enumerator | |
---|---|
CAP_NONE | NetworkMonitor is not supported and is a no-op. |
CAP_ENUM | listNetworkInterfaces() and getNetworkInterface() are supported |
CAP_IF_ADD_REMOVE | NetworkMonitor onInterfaceAdded and onInterfaceRemoved signals are supported. |
CAP_STATE_CHANGE | NetworkInterface onStateChanged signal is supported. |
CAP_MTU_CHANGE | NetworkInterface onMtuChanged signal is supported. |
CAP_ADDR_ADD_REMOVE | NetworkInterface onAddressAdded and onAddressRemoved signals are supported. |
Definition at line 68 of file network-monitor.hpp.
|
explicit |
Construct instance, request enumeration of all network interfaces, and start monitoring for network state changes.
ioCtx | io_context instance that will dispatch events |
Definition at line 57 of file network-monitor.cpp.
|
explicitprotected |
Definition at line 62 of file network-monitor.cpp.
uint32_t ndn::net::NetworkMonitor::getCapabilities | ( | ) | const |
Returns a bitwise OR'ed set of Capability flags supported on the current platform.
Definition at line 72 of file network-monitor.cpp.
|
inlineprotected |
Definition at line 104 of file network-monitor.hpp.
shared_ptr< const NetworkInterface > ndn::net::NetworkMonitor::getNetworkInterface | ( | const std::string & | ifname | ) | const |
Returns the NetworkInterface with the given name, or nullptr
if it does not exist.
Definition at line 78 of file network-monitor.cpp.
std::vector< shared_ptr< const NetworkInterface > > ndn::net::NetworkMonitor::listNetworkInterfaces | ( | ) | const |
Lists all network interfaces currently available on the system.
Definition at line 84 of file network-monitor.cpp.
signal::Signal<NetworkMonitorImpl>& ndn::net::NetworkMonitor::onEnumerationCompleted |
Fires when the enumeration of all network interfaces on the system is complete.
Definition at line 116 of file network-monitor.hpp.
signal::Signal<NetworkMonitorImpl, shared_ptr<const NetworkInterface> >& ndn::net::NetworkMonitor::onInterfaceAdded |
Fires whenever a new interface is detected on the system.
Definition at line 119 of file network-monitor.hpp.
signal::Signal<NetworkMonitorImpl, shared_ptr<const NetworkInterface> >& ndn::net::NetworkMonitor::onInterfaceRemoved |
Fires whenever an interface disappears from the system.
Definition at line 126 of file network-monitor.hpp.
signal::Signal<NetworkMonitorImpl>& ndn::net::NetworkMonitor::onNetworkStateChanged |
Definition at line 129 of file network-monitor.hpp.