| 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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 | 162 |
| 163 IP_ADAPTER_UNICAST_ADDRESS* address; | 163 IP_ADAPTER_UNICAST_ADDRESS* address; |
| 164 for (address = adapter->FirstUnicastAddress; address != NULL; | 164 for (address = adapter->FirstUnicastAddress; address != NULL; |
| 165 address = address->Next) { | 165 address = address->Next) { |
| 166 int family = address->Address.lpSockaddr->sa_family; | 166 int family = address->Address.lpSockaddr->sa_family; |
| 167 if (family == AF_INET || family == AF_INET6) { | 167 if (family == AF_INET || family == AF_INET6) { |
| 168 IPEndPoint endpoint; | 168 IPEndPoint endpoint; |
| 169 if (endpoint.FromSockAddr(address->Address.lpSockaddr, | 169 if (endpoint.FromSockAddr(address->Address.lpSockaddr, |
| 170 address->Address.iSockaddrLength)) { | 170 address->Address.iSockaddrLength)) { |
| 171 std::string name = adapter->AdapterName; | 171 std::string name = adapter->AdapterName; |
| 172 networks->push_back(NetworkInterface(name, endpoint.address())); | 172 networks->push_back(NetworkInterface(name, endpoint.address(), |
| 173 address->OnLinkPrefixLength)); |
| 173 } | 174 } |
| 174 } | 175 } |
| 175 } | 176 } |
| 176 } | 177 } |
| 177 | 178 |
| 178 return true; | 179 return true; |
| 179 } | 180 } |
| 180 | 181 |
| 181 WifiPHYLayerProtocol GetWifiPHYLayerProtocol() { | 182 WifiPHYLayerProtocol GetWifiPHYLayerProtocol() { |
| 182 static base::LazyInstance<WlanApi>::Leaky lazy_wlanapi = | 183 static base::LazyInstance<WlanApi>::Leaky lazy_wlanapi = |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 case dot11_phy_type_erp: | 265 case dot11_phy_type_erp: |
| 265 return WIFI_PHY_LAYER_PROTOCOL_G; | 266 return WIFI_PHY_LAYER_PROTOCOL_G; |
| 266 case dot11_phy_type_ht: | 267 case dot11_phy_type_ht: |
| 267 return WIFI_PHY_LAYER_PROTOCOL_N; | 268 return WIFI_PHY_LAYER_PROTOCOL_N; |
| 268 default: | 269 default: |
| 269 return WIFI_PHY_LAYER_PROTOCOL_UNKNOWN; | 270 return WIFI_PHY_LAYER_PROTOCOL_UNKNOWN; |
| 270 } | 271 } |
| 271 } | 272 } |
| 272 | 273 |
| 273 } // namespace net | 274 } // namespace net |
| OLD | NEW |