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 CHROMEOS_NETWORK_NETWORK_IP_CONFIG_H_ |
6 #define CHROME_BROWSER_CHROMEOS_CROS_NETWORK_IP_CONFIG_H_ | 6 #define CHROMEOS_NETWORK_NETWORK_IP_CONFIG_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "chromeos/chromeos_export.h" |
13 | 14 |
14 namespace chromeos { | 15 namespace chromeos { |
15 | 16 |
16 // ipconfig types (see flimflam/files/doc/ipconfig-api.txt) | 17 // ipconfig types (see flimflam/files/doc/ipconfig-api.txt) |
17 enum IPConfigType { | 18 enum IPConfigType { |
18 IPCONFIG_TYPE_UNKNOWN, | 19 IPCONFIG_TYPE_UNKNOWN, |
19 IPCONFIG_TYPE_IPV4, | 20 IPCONFIG_TYPE_IPV4, |
20 IPCONFIG_TYPE_IPV6, | 21 IPCONFIG_TYPE_IPV6, |
21 IPCONFIG_TYPE_DHCP, | 22 IPCONFIG_TYPE_DHCP, |
22 IPCONFIG_TYPE_BOOTP, // Not Used. | 23 IPCONFIG_TYPE_BOOTP, // Not Used. |
23 IPCONFIG_TYPE_ZEROCONF, | 24 IPCONFIG_TYPE_ZEROCONF, |
24 IPCONFIG_TYPE_DHCP6, | 25 IPCONFIG_TYPE_DHCP6, |
25 IPCONFIG_TYPE_PPP, | 26 IPCONFIG_TYPE_PPP, |
26 }; | 27 }; |
27 | 28 |
28 // IP Configuration. | 29 // IP Configuration. |
29 struct NetworkIPConfig { | 30 struct CHROMEOS_EXPORT NetworkIPConfig { |
30 NetworkIPConfig(const std::string& device_path, IPConfigType type, | 31 NetworkIPConfig(const std::string& device_path, IPConfigType type, |
31 const std::string& address, const std::string& netmask, | 32 const std::string& address, const std::string& netmask, |
32 const std::string& gateway, const std::string& name_servers); | 33 const std::string& gateway, const std::string& name_servers); |
33 ~NetworkIPConfig(); | 34 ~NetworkIPConfig(); |
34 | 35 |
35 std::string ToString() const; | 36 std::string ToString() const; |
36 | 37 |
37 std::string device_path; // This looks like "/device/0011aa22bb33" | 38 std::string device_path; // This looks like "/device/0011aa22bb33" |
38 IPConfigType type; | 39 IPConfigType type; |
39 std::string address; | 40 std::string address; |
40 std::string netmask; | 41 std::string netmask; |
41 std::string gateway; | 42 std::string gateway; |
42 std::string name_servers; | 43 std::string name_servers; |
43 }; | 44 }; |
44 | 45 |
45 typedef std::vector<NetworkIPConfig> NetworkIPConfigVector; | 46 typedef std::vector<NetworkIPConfig> NetworkIPConfigVector; |
46 | 47 |
47 // Used to return the list of IP configs and hardware address from an | 48 // Used to return the list of IP configs and hardware address from an |
48 // asynchronous call to Shill. The hardware address is usually a MAC address | 49 // asynchronous call to Shill. The hardware address is usually a MAC address |
49 // like "0011AA22BB33". |hardware_address| will be an empty string, if no | 50 // like "0011AA22BB33". |hardware_address| will be an empty string, if no |
50 // hardware address is found. | 51 // hardware address is found. |
51 typedef base::Callback<void(const NetworkIPConfigVector& ip_configs, | 52 typedef base::Callback<void(const NetworkIPConfigVector& ip_configs, |
52 const std::string& hardware_address)> | 53 const std::string& hardware_address)> |
53 NetworkGetIPConfigsCallback; | 54 NetworkGetIPConfigsCallback; |
54 | 55 |
55 } // namespace chromeos | 56 } // namespace chromeos |
56 | 57 |
57 #endif // CHROME_BROWSER_CHROMEOS_CROS_NETWORK_IP_CONFIG_H_ | 58 #endif // CHROMEOS_NETWORK_NETWORK_IP_CONFIG_H_ |
OLD | NEW |