shill: Parse dhcpcd Event signal properties.
BUG=chromium-os:16126
TEST=unit test
Change-Id: Idafd3cebc015a5f900fd589c27dfcd1b405da7ef
Reviewed-on: http://gerrit.chromium.org/gerrit/2126
Reviewed-by: Chris Masone <cmasone@chromium.org>
Tested-by: Darin Petkov <petkov@chromium.org>
diff --git a/ipconfig.h b/ipconfig.h
index bd964be..bf860d6 100644
--- a/ipconfig.h
+++ b/ipconfig.h
@@ -6,6 +6,7 @@
#define SHILL_IPCONFIG_
#include <string>
+#include <vector>
#include <base/memory/ref_counted.h>
@@ -17,21 +18,40 @@
// class.
class IPConfig : public base::RefCounted<IPConfig> {
public:
+ struct Properties {
+ Properties() : subnet_cidr(0), mtu(0) {}
+
+ std::string address;
+ int subnet_cidr;
+ std::string broadcast_address;
+ std::string gateway;
+ std::vector<std::string> dns_servers;
+ std::string domain_name;
+ std::vector<std::string> domain_search;
+ int mtu;
+ };
+
explicit IPConfig(const Device &device);
virtual ~IPConfig();
const Device &device() const { return device_; }
-
const std::string &GetDeviceName() const;
- // Request or renew IP configuration. Return true on success, false otherwise.
- virtual bool Request() { return false; }
- virtual bool Renew() { return false; }
+ // Updates the IP configuration properties and notifies registered listeners
+ // about the event.
+ void UpdateProperties(const Properties &properties);
+
+ const Properties &properties() const { return properties_; }
+
+ // Request or renew IP configuration. Return true on success, false
+ // otherwise. The default implementation always returns false indicating a
+ // failure.
+ virtual bool Request();
+ virtual bool Renew();
private:
- friend class base::RefCounted<IPConfig>;
-
const Device &device_;
+ Properties properties_;
DISALLOW_COPY_AND_ASSIGN(IPConfig);
};