| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_CROS_NETWORK_IP_CONFIG_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_CROS_NETWORK_IP_CONFIG_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_CROS_NETWORK_IP_CONFIG_H_ | 6 #define CHROME_BROWSER_CHROMEOS_CROS_NETWORK_IP_CONFIG_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 // IP Configuration. | 27 // IP Configuration. |
| 28 struct NetworkIPConfig { | 28 struct NetworkIPConfig { |
| 29 NetworkIPConfig(const std::string& device_path, IPConfigType type, | 29 NetworkIPConfig(const std::string& device_path, IPConfigType type, |
| 30 const std::string& address, const std::string& netmask, | 30 const std::string& address, const std::string& netmask, |
| 31 const std::string& gateway, const std::string& name_servers); | 31 const std::string& gateway, const std::string& name_servers); |
| 32 ~NetworkIPConfig(); | 32 ~NetworkIPConfig(); |
| 33 | 33 |
| 34 std::string ToString() const; | 34 std::string ToString() const; |
| 35 | 35 |
| 36 // Gets the PrefixLength for an IPv4 netmask. | |
| 37 // For example, "255.255.255.0" => 24 | |
| 38 // If the netmask is invalid, this will return -1; | |
| 39 // TODO(chocobo): Add support for IPv6. | |
| 40 int32 GetPrefixLength() const; | |
| 41 std::string device_path; // This looks like "/device/0011aa22bb33" | 36 std::string device_path; // This looks like "/device/0011aa22bb33" |
| 42 IPConfigType type; | 37 IPConfigType type; |
| 43 std::string address; | 38 std::string address; |
| 44 std::string netmask; | 39 std::string netmask; |
| 45 std::string gateway; | 40 std::string gateway; |
| 46 std::string name_servers; | 41 std::string name_servers; |
| 47 }; | 42 }; |
| 48 | 43 |
| 49 typedef std::vector<NetworkIPConfig> NetworkIPConfigVector; | 44 typedef std::vector<NetworkIPConfig> NetworkIPConfigVector; |
| 50 | 45 |
| 51 } // namespace chromeos | 46 } // namespace chromeos |
| 52 | 47 |
| 53 #endif // CHROME_BROWSER_CHROMEOS_CROS_NETWORK_IP_CONFIG_H_ | 48 #endif // CHROME_BROWSER_CHROMEOS_CROS_NETWORK_IP_CONFIG_H_ |
| OLD | NEW |