[shill] Make IPConfig objects have sane DBus Paths
following the following schema: /ipconfig/<devicename>_<per-run serial number>_<config type>
BUG=chromium-os:17744
TEST=unit, run on device and use /usr/local/lib/flimflam/list-devices
Change-Id: Ia88814d46facce525d866c8309556131d8fb6a0d
Reviewed-on: http://gerrit.chromium.org/gerrit/4535
Tested-by: Chris Masone <cmasone@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
diff --git a/ipconfig.cc b/ipconfig.cc
index ed789e4..7e5551e 100644
--- a/ipconfig.cc
+++ b/ipconfig.cc
@@ -15,10 +15,31 @@
namespace shill {
+// static
+const char IPConfig::kType[] = "ip";
+// static
+uint IPConfig::global_serial_ = 0;
+
IPConfig::IPConfig(ControlInterface *control_interface,
const std::string &device_name)
: device_name_(device_name),
+ type_(kType),
+ serial_(global_serial_++),
adaptor_(control_interface->CreateIPConfigAdaptor(this)) {
+ Init();
+}
+
+IPConfig::IPConfig(ControlInterface *control_interface,
+ const std::string &device_name,
+ const std::string &type)
+ : device_name_(device_name),
+ type_(type),
+ serial_(global_serial_++),
+ adaptor_(control_interface->CreateIPConfigAdaptor(this)) {
+ Init();
+}
+
+void IPConfig::Init() {
// Address might be R/O or not, depending on the type of IPconfig, so
// we'll leave this up to the subclasses.
// Register(Const?)String(flimflam::kAddressProperty, &properties_.address);
@@ -37,7 +58,7 @@
// TODO(cmasone): Does anyone use this?
// store_.RegisterStrings(flimflam::kSearchDomainsProperty,
// &properties_.domain_search);
- VLOG(2) << __func__ << " device: " << device_name;
+ VLOG(2) << __func__ << " device: " << device_name();
}
IPConfig::~IPConfig() {