shill: portal: Recheck portal state

Introduce a retry interval for automatically retrying portal
checks.  Also provide a Manager API method for immediately
re-checking portal status.

BUG=chromium-os:27335
TEST=New unit tests, tested on real machine, including setting
PortaCheckInterval over DBus, and using Jason's addition to
test-flimflam for 'recheck-portal'.
Change-Id: Idc7def18c6f863859e94f4d4e9f266ab2670679c
Reviewed-on: https://gerrit.chromium.org/gerrit/17367
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
diff --git a/manager.h b/manager.h
index c76732f..faf055d 100644
--- a/manager.h
+++ b/manager.h
@@ -36,10 +36,12 @@
  public:
   struct Properties {
    public:
-    Properties() : offline_mode(false) {}
+    Properties()
+        : offline_mode(false), portal_check_interval_seconds(0) {}
     bool offline_mode;
     std::string check_portal_list;
     std::string country;
+    int32 portal_check_interval_seconds;
     std::string portal_url;
     std::string host_name;
   };
@@ -88,6 +90,9 @@
 
   // called via RPC (e.g., from ManagerDBusAdaptor)
   ServiceRefPtr GetService(const KeyValueStore &args, Error *error);
+  // Request portal detection checks on each registered device until a portal
+  // detection attempt starts on one of them.
+  void RecheckPortal(Error *error);
   void RequestScan(const std::string &technology, Error *error);
   std::string GetTechnologyOrder();
   void SetTechnologyOrder(const std::string &order, Error *error);
@@ -122,6 +127,9 @@
   // Return whether a technology is marked as enabled for portal detection.
   virtual bool IsPortalDetectionEnabled(Technology::Identifier tech);
 
+  virtual int GetPortalCheckInterval() const {
+    return props_.portal_check_interval_seconds;
+  }
   virtual const std::string &GetPortalCheckURL() const {
     return props_.portal_url;
   }