Index: chrome/browser/chromeos/cros/network_ip_config.cc |
diff --git a/chrome/browser/chromeos/cros/network_ip_config.cc b/chrome/browser/chromeos/cros/network_ip_config.cc |
index 60785bf9e2a9193620bc2bf086f4f60eb61418ca..3124a0d4c7cdc390d019d650762c6397d29e0138 100644 |
--- a/chrome/browser/chromeos/cros/network_ip_config.cc |
+++ b/chrome/browser/chromeos/cros/network_ip_config.cc |
@@ -8,6 +8,23 @@ |
namespace chromeos { |
+namespace { |
+#define ENUM_CASE(x) case x: return std::string(#x) |
+std::string IPConfigTypeAsString(IPConfigType type) { |
+ switch (type) { |
+ ENUM_CASE(IPCONFIG_TYPE_UNKNOWN); |
+ ENUM_CASE(IPCONFIG_TYPE_IPV4); |
+ ENUM_CASE(IPCONFIG_TYPE_IPV6); |
+ ENUM_CASE(IPCONFIG_TYPE_DHCP); |
+ ENUM_CASE(IPCONFIG_TYPE_BOOTP); |
+ ENUM_CASE(IPCONFIG_TYPE_ZEROCONF); |
+ ENUM_CASE(IPCONFIG_TYPE_DHCP6); |
+ ENUM_CASE(IPCONFIG_TYPE_PPP); |
+ } |
stevenjb
2012/05/21 23:59:46
Doesn't this need a NOTREACHED() + return std::str
Greg Spencer (Chromium)
2012/05/22 00:45:14
Done.
|
+} |
+#undef ENUM_CASE |
+} // namespace |
+ |
NetworkIPConfig::NetworkIPConfig( |
const std::string& device_path, IPConfigType type, |
const std::string& address, const std::string& netmask, |
@@ -22,6 +39,15 @@ NetworkIPConfig::NetworkIPConfig( |
NetworkIPConfig::~NetworkIPConfig() {} |
+std::string NetworkIPConfig::ToString() const { |
+ return std::string("path: ") + device_path |
+ + " type: " + IPConfigTypeAsString(type) |
+ + " address: " + address |
+ + " netmask: " + netmask |
+ + " gateway: " + gateway |
+ + " name_servers: " + name_servers; |
+} |
+ |
int32 NetworkIPConfig::GetPrefixLength() const { |
int count = 0; |
int prefixlen = 0; |