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..44f6c4f9cd4309809d9baf6e038dcb377ccd9c31 100644 |
--- a/chrome/browser/chromeos/cros/network_ip_config.cc |
+++ b/chrome/browser/chromeos/cros/network_ip_config.cc |
@@ -4,10 +4,30 @@ |
#include "chrome/browser/chromeos/cros/network_ip_config.h" |
+#include "base/logging.h" |
#include "base/string_tokenizer.h" |
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); |
+ } |
+ NOTREACHED() << "Unhandled enum value " << type; |
+ return std::string(); |
+} |
+#undef ENUM_CASE |
+} // namespace |
+ |
NetworkIPConfig::NetworkIPConfig( |
const std::string& device_path, IPConfigType type, |
const std::string& address, const std::string& netmask, |
@@ -22,6 +42,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; |