| 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 #include "net/base/net_util.h" | 5 #include "net/base/net_util.h" |
| 6 | 6 |
| 7 #include <iphlpapi.h> | 7 #include <iphlpapi.h> |
| 8 #include <wlanapi.h> | 8 #include <wlanapi.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 // Pick one IPv6 address with least valid lifetime. | 183 // Pick one IPv6 address with least valid lifetime. |
| 184 // The reason we are checking |ValidLifeftime| as there is no other | 184 // The reason we are checking |ValidLifeftime| as there is no other |
| 185 // way identifying the interface type. Usually (and most likely) temp | 185 // way identifying the interface type. Usually (and most likely) temp |
| 186 // IPv6 will have a shorter ValidLifetime value then the permanent | 186 // IPv6 will have a shorter ValidLifetime value then the permanent |
| 187 // interface. | 187 // interface. |
| 188 if (family == AF_INET6 && | 188 if (family == AF_INET6 && |
| 189 (policy & INCLUDE_ONLY_TEMP_IPV6_ADDRESS_IF_POSSIBLE)) { | 189 (policy & INCLUDE_ONLY_TEMP_IPV6_ADDRESS_IF_POSSIBLE)) { |
| 190 if (ipv6_valid_lifetime == 0 || | 190 if (ipv6_valid_lifetime == 0 || |
| 191 ipv6_valid_lifetime > address->ValidLifetime) { | 191 ipv6_valid_lifetime > address->ValidLifetime) { |
| 192 ipv6_valid_lifetime = address->ValidLifetime; | 192 ipv6_valid_lifetime = address->ValidLifetime; |
| 193 ipv6_address.reset(new NetworkInterface(adapter->AdapterName, | 193 ipv6_address.reset(new NetworkInterface( |
| 194 base::SysWideToNativeMB(adapter->FriendlyName), | 194 adapter->AdapterName, |
| 195 index, | 195 base::SysWideToNativeMB(adapter->FriendlyName), |
| 196 GetNetworkInterfaceType(adapter->IfType), | 196 index, |
| 197 endpoint.address(), | 197 GetNetworkInterfaceType(adapter->IfType), |
| 198 net_prefix)); | 198 endpoint.address(), |
| 199 net_prefix, |
| 200 IP_ADDRESS_ATTRIBUTE_NONE)); |
| 199 continue; | 201 continue; |
| 200 } | 202 } |
| 201 } | 203 } |
| 202 networks->push_back( | 204 networks->push_back( |
| 203 NetworkInterface(adapter->AdapterName, | 205 NetworkInterface(adapter->AdapterName, |
| 204 base::SysWideToNativeMB(adapter->FriendlyName), | 206 base::SysWideToNativeMB(adapter->FriendlyName), |
| 205 index, GetNetworkInterfaceType(adapter->IfType), | 207 index, |
| 206 endpoint.address(), net_prefix)); | 208 GetNetworkInterfaceType(adapter->IfType), |
| 209 endpoint.address(), |
| 210 net_prefix, |
| 211 IP_ADDRESS_ATTRIBUTE_NONE)); |
| 207 } | 212 } |
| 208 } | 213 } |
| 209 } | 214 } |
| 210 } | 215 } |
| 211 | 216 |
| 212 if (ipv6_address.get()) { | 217 if (ipv6_address.get()) { |
| 213 networks->push_back(*(ipv6_address.get())); | 218 networks->push_back(*(ipv6_address.get())); |
| 214 } | 219 } |
| 215 return true; | 220 return true; |
| 216 } | 221 } |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 case dot11_phy_type_erp: | 305 case dot11_phy_type_erp: |
| 301 return WIFI_PHY_LAYER_PROTOCOL_G; | 306 return WIFI_PHY_LAYER_PROTOCOL_G; |
| 302 case dot11_phy_type_ht: | 307 case dot11_phy_type_ht: |
| 303 return WIFI_PHY_LAYER_PROTOCOL_N; | 308 return WIFI_PHY_LAYER_PROTOCOL_N; |
| 304 default: | 309 default: |
| 305 return WIFI_PHY_LAYER_PROTOCOL_UNKNOWN; | 310 return WIFI_PHY_LAYER_PROTOCOL_UNKNOWN; |
| 306 } | 311 } |
| 307 } | 312 } |
| 308 | 313 |
| 309 } // namespace net | 314 } // namespace net |
| OLD | NEW |