ndn::util::NetworkMonitor Class Reference

Network state change monitor. More...

#include <network-monitor.hpp>

Inheritance diagram for ndn::util::NetworkMonitor:
[legend]
Collaboration diagram for ndn::util::NetworkMonitor:
[legend]

Data Structures

class  Error
 
class  Impl
 

Public Member Functions

 NetworkMonitor (boost::asio::io_service &io)
 Construct instance and start monitoring for network state changes. More...
 
 ~NetworkMonitor ()
 Terminate network state monitoring. More...
 

Data Fields

Signal< NetworkMonitoronNetworkStateChanged
 

Detailed Description

Network state change monitor.

When network change is detected, onNetworkStateChanged signal will be fired. Monitoring is run for the lifetime of the NetworkMonitor instance.

Note
Implementation of this class is platform dependent and not all supported platforms are supported:
  • OS X: CFNotificationCenterAddObserver
  • Linux: rtnetlink notifications

Network state change detection is not guaranteed to be precise and (zero or more) notifications are expected to be fired for the following events:

  • any network interface going up or down
  • IPv4 or IPv6 address changes on any of the interfaces

Definition at line 53 of file network-monitor.hpp.

Constructor & Destructor Documentation

ndn::util::NetworkMonitor::NetworkMonitor ( boost::asio::io_service &  io)
explicit

Construct instance and start monitoring for network state changes.

Parameters
ioio_service thread that will dispatch events
Exceptions
Errorwhen network monitoring is not supported or there is an error starting monitoring

Definition at line 52 of file network-monitor.cpp.

ndn::util::NetworkMonitor::~NetworkMonitor ( )
default

Terminate network state monitoring.

Field Documentation

Signal<NetworkMonitor> ndn::util::NetworkMonitor::onNetworkStateChanged

Definition at line 79 of file network-monitor.hpp.