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 |
11 #include "third_party/cros/chromeos_network.h" | 11 #include "third_party/cros/chromeos_network.h" |
12 | 12 |
13 namespace chromeos { | 13 namespace chromeos { |
14 | 14 |
15 // IP Configuration. | 15 // IP Configuration. |
16 struct NetworkIPConfig { | 16 struct NetworkIPConfig { |
17 NetworkIPConfig(const std::string& device_path, IPConfigType type, | 17 NetworkIPConfig(const std::string& device_path, IPConfigType type, |
18 const std::string& address, const std::string& netmask, | 18 const std::string& address, const std::string& netmask, |
19 const std::string& gateway, const std::string& name_servers); | 19 const std::string& gateway, const std::string& name_servers); |
20 ~NetworkIPConfig(); | 20 ~NetworkIPConfig(); |
21 | 21 |
| 22 std::string ToString() const; |
| 23 |
22 // Gets the PrefixLength for an IPv4 netmask. | 24 // Gets the PrefixLength for an IPv4 netmask. |
23 // For example, "255.255.255.0" => 24 | 25 // For example, "255.255.255.0" => 24 |
24 // If the netmask is invalid, this will return -1; | 26 // If the netmask is invalid, this will return -1; |
25 // TODO(chocobo): Add support for IPv6. | 27 // TODO(chocobo): Add support for IPv6. |
26 int32 GetPrefixLength() const; | 28 int32 GetPrefixLength() const; |
27 std::string device_path; // This looks like "/device/0011aa22bb33" | 29 std::string device_path; // This looks like "/device/0011aa22bb33" |
28 IPConfigType type; | 30 IPConfigType type; |
29 std::string address; | 31 std::string address; |
30 std::string netmask; | 32 std::string netmask; |
31 std::string gateway; | 33 std::string gateway; |
32 std::string name_servers; | 34 std::string name_servers; |
33 }; | 35 }; |
34 | 36 |
35 typedef std::vector<NetworkIPConfig> NetworkIPConfigVector; | 37 typedef std::vector<NetworkIPConfig> NetworkIPConfigVector; |
36 | 38 |
37 } // namespace chromeos | 39 } // namespace chromeos |
38 | 40 |
39 #endif // CHROME_BROWSER_CHROMEOS_CROS_NETWORK_IP_CONFIG_H_ | 41 #endif // CHROME_BROWSER_CHROMEOS_CROS_NETWORK_IP_CONFIG_H_ |
OLD | NEW |