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 CHROMEOS_NETWORK_NETWORK_UTIL_H_ | 5 #ifndef CHROMEOS_NETWORK_NETWORK_UTIL_H_ |
6 #define CHROMEOS_NETWORK_NETWORK_UTIL_H_ | 6 #define CHROMEOS_NETWORK_NETWORK_UTIL_H_ |
7 | 7 |
8 // This header is introduced to make it easy to switch from chromeos_network.cc | 8 // This header is introduced to make it easy to switch from chromeos_network.cc |
9 // to Chrome's own DBus code. crosbug.com/16557 | 9 // to Chrome's own DBus code. crosbug.com/16557 |
10 // All calls to functions in chromeos_network.h should be made through | 10 // All calls to functions in chromeos_network.h should be made through |
11 // functions provided by this header. | 11 // functions provided by this header. |
12 | 12 |
| 13 #include <stdint.h> |
| 14 |
13 #include <string> | 15 #include <string> |
14 #include <vector> | 16 #include <vector> |
15 | 17 |
16 #include "base/basictypes.h" | |
17 #include "base/callback.h" | 18 #include "base/callback.h" |
18 #include "base/memory/scoped_ptr.h" | 19 #include "base/memory/scoped_ptr.h" |
19 #include "base/time/time.h" | 20 #include "base/time/time.h" |
20 #include "base/values.h" | 21 #include "base/values.h" |
21 #include "chromeos/chromeos_export.h" | 22 #include "chromeos/chromeos_export.h" |
22 | 23 |
23 namespace base { | 24 namespace base { |
24 class ListValue; | 25 class ListValue; |
25 } | 26 } |
26 | 27 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 typedef base::Callback<void( | 69 typedef base::Callback<void( |
69 const std::string& path, | 70 const std::string& path, |
70 NetworkMethodErrorType error, | 71 NetworkMethodErrorType error, |
71 const std::string& error_message)> NetworkOperationCallback; | 72 const std::string& error_message)> NetworkOperationCallback; |
72 | 73 |
73 namespace network_util { | 74 namespace network_util { |
74 | 75 |
75 // Converts a |prefix_length| to a netmask. (for IPv4 only) | 76 // Converts a |prefix_length| to a netmask. (for IPv4 only) |
76 // e.g. a |prefix_length| of 24 is converted to a netmask of "255.255.255.0". | 77 // e.g. a |prefix_length| of 24 is converted to a netmask of "255.255.255.0". |
77 // Invalid prefix lengths will return the empty string. | 78 // Invalid prefix lengths will return the empty string. |
78 CHROMEOS_EXPORT std::string PrefixLengthToNetmask(int32 prefix_length); | 79 CHROMEOS_EXPORT std::string PrefixLengthToNetmask(int32_t prefix_length); |
79 | 80 |
80 // Converts a |netmask| to a prefixlen. (for IPv4 only) | 81 // Converts a |netmask| to a prefixlen. (for IPv4 only) |
81 // e.g. a |netmask| of 255.255.255.0 is converted to a prefixlen of 24 | 82 // e.g. a |netmask| of 255.255.255.0 is converted to a prefixlen of 24 |
82 CHROMEOS_EXPORT int32 NetmaskToPrefixLength(const std::string& netmask); | 83 CHROMEOS_EXPORT int32_t NetmaskToPrefixLength(const std::string& netmask); |
83 | 84 |
84 // Returns |shill_mac_address| in aa:bb format. | 85 // Returns |shill_mac_address| in aa:bb format. |
85 CHROMEOS_EXPORT std::string FormattedMacAddress( | 86 CHROMEOS_EXPORT std::string FormattedMacAddress( |
86 const std::string& shill_mac_address); | 87 const std::string& shill_mac_address); |
87 | 88 |
88 // Parses |list|, which contains DictionaryValues and returns a vector of | 89 // Parses |list|, which contains DictionaryValues and returns a vector of |
89 // CellularScanResult in |scan_results|. Returns false if parsing fails, | 90 // CellularScanResult in |scan_results|. Returns false if parsing fails, |
90 // in which case the contents of |scan_results| will be undefined. | 91 // in which case the contents of |scan_results| will be undefined. |
91 CHROMEOS_EXPORT bool ParseCellularScanResults( | 92 CHROMEOS_EXPORT bool ParseCellularScanResults( |
92 const base::ListValue& list, std::vector<CellularScanResult>* scan_results); | 93 const base::ListValue& list, std::vector<CellularScanResult>* scan_results); |
(...skipping 19 matching lines...) Expand all Loading... |
112 // there is no match. Only valid for ethernet, wifi, wimax, cellular, and vpn. | 113 // there is no match. Only valid for ethernet, wifi, wimax, cellular, and vpn. |
113 CHROMEOS_EXPORT std::string TranslateONCTypeToShill(const std::string& type); | 114 CHROMEOS_EXPORT std::string TranslateONCTypeToShill(const std::string& type); |
114 | 115 |
115 // Inverse of TranslateONCTypeToShill. | 116 // Inverse of TranslateONCTypeToShill. |
116 CHROMEOS_EXPORT std::string TranslateShillTypeToONC(const std::string& type); | 117 CHROMEOS_EXPORT std::string TranslateShillTypeToONC(const std::string& type); |
117 | 118 |
118 } // namespace network_util | 119 } // namespace network_util |
119 } // namespace chromeos | 120 } // namespace chromeos |
120 | 121 |
121 #endif // CHROMEOS_NETWORK_NETWORK_UTIL_H_ | 122 #endif // CHROMEOS_NETWORK_NETWORK_UTIL_H_ |
OLD | NEW |