Project

General

Profile

Actions

Feature #2443

closed

NetworkMonitor class to detect network state changes

Added by Alex Afanasyev over 9 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Normal
Category:
Utils
Target version:
Start date:
01/28/2015
Due date:
% Done:

100%

Estimated time:

Description

The immediate use of this class will be in ndn-autoconfig (daemon mode), but it can be used by other applications too.

Here is the interface for this class:

/**
 * @brief 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: dbus
 */
class NetworkMonitor
{
public:
  /**
   * @brief Construct instance and start monitoring for network state changes
   * @param io io_service thread that will dispatch events
   */
  NetworkMonitor(boost::asio::io_service& io);

  /**
   * @brief Terminate network state monitoring
   */
  ~NetworkMonitor();

  Signal<NetworkMonitor> onNetworkStateChanged;
};
Actions

Also available in: Atom PDF