shill: Device: Add LinkMonitor

Start link monitoring for technologies for which it is enabled.
Add facilities in the manager and default profile to determine
and persist a list of technologies for which link monitoring
is enabled.  Provide a means for the Device to report the current
rolling average LinkMonitor response time.

BUG=chromium-os:32600
TEST=Unit tests

Change-Id: I39dcc8ce2332d7be3c95d9953b4ae7d7172d7df1
Reviewed-on: https://gerrit.chromium.org/gerrit/29731
Commit-Ready: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
diff --git a/manager.h b/manager.h
index dc90c7a..5077637 100644
--- a/manager.h
+++ b/manager.h
@@ -60,6 +60,9 @@
     // Comma separated list of technologies on which to use a short DNS
     // timeout to improve performance.
     std::string short_dns_timeout_technologies;
+    // Comma-separated list of technologies for which link-monitoring is
+    // enabled.
+    std::string link_monitor_technologies;
   };
 
   Manager(ControlInterface *control_interface,
@@ -181,6 +184,10 @@
   // Return whether a technology is enabled for using short DNS timeouts.
   bool IsTechnologyShortDNSTimeoutEnabled(Technology::Identifier tech) const;
 
+  // Return whether a technology is enabled for link monitoring.
+  virtual bool IsTechnologyLinkMonitorEnabled(
+      Technology::Identifier technology) const;
+
   std::string CalculateState(Error *error);
 
   virtual int GetPortalCheckInterval() const {
@@ -254,6 +261,7 @@
   FRIEND_TEST(ManagerTest, EnableTechnology);
   FRIEND_TEST(ManagerTest, EnumerateProfiles);
   FRIEND_TEST(ManagerTest, HandleProfileEntryDeletionWithUnload);
+  FRIEND_TEST(ManagerTest, LinkMonitorEnabled);
   FRIEND_TEST(ManagerTest, NotifyDefaultServiceChanged);
   FRIEND_TEST(ManagerTest, PopProfileWithUnload);
   FRIEND_TEST(ManagerTest, SortServices);
@@ -281,6 +289,8 @@
   ServiceRefPtr GetServiceInner(const KeyValueStore &args, Error *error);
   void SetCheckPortalList(const std::string &portal_list, Error *error);
   void EmitDefaultService();
+  bool IsTechnologyInList(const std::string &technology_list,
+                          Technology::Identifier tech) const;
   void EmitDeviceProperties();
 
   // Unload a service while iterating through |services_|.  Returns true if