[shill] Enable Device objects to persist themselves to disk

BUG=chromium-os:17254
TEST=unit

Change-Id: Ia00bc2658e0fe03e13e399d7afab81cc09aa0195
Reviewed-on: http://gerrit.chromium.org/gerrit/5309
Reviewed-by: Chris Masone <cmasone@chromium.org>
Tested-by: Chris Masone <cmasone@chromium.org>
diff --git a/device.h b/device.h
index 069b158..08548e6 100644
--- a/device.h
+++ b/device.h
@@ -61,6 +61,7 @@
   virtual void ConfigIP() {}
 
   std::string GetRpcIdentifier();
+  std::string GetStorageIdentifier();
 
   const std::string &link_name() const { return link_name_; }
   int interface_index() const { return interface_index_; }
@@ -73,11 +74,15 @@
 
   PropertyStore *store() { return &store_; }
 
+  bool Load(StoreInterface *storage);
+  bool Save(StoreInterface *storage);
+
  protected:
   FRIEND_TEST(DeviceTest, AcquireDHCPConfig);
   FRIEND_TEST(DeviceTest, DestroyIPConfig);
   FRIEND_TEST(DeviceTest, DestroyIPConfigNULL);
   FRIEND_TEST(DeviceTest, GetProperties);
+  FRIEND_TEST(DeviceTest, Save);
 
   // If there's an IP configuration in |ipconfig_|, releases the IP address and
   // destroys the configuration instance.
@@ -111,9 +116,17 @@
  private:
   friend class DeviceAdaptorInterface;
 
+  static const char kStoragePowered[];
+  static const char kStorageIPConfigs[];
+
   // Callback invoked on every IP configuration update.
   void IPConfigUpdatedCallback(const IPConfigRefPtr &ipconfig, bool success);
 
+  // Right now, Devices reference IPConfigs directly when persisted to disk
+  // It's not clear that this makes sense long-term, but that's how it is now.
+  // This call generates a string in the right format for this persisting.
+  std::string SerializeIPConfigsForStorage();
+
   std::vector<std::string> AvailableIPConfigs();
   std::string GetRpcConnectionIdentifier();