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 <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include <ostream> | 9 #include <ostream> |
10 | 10 |
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
814 | 814 |
815 internal::WlanHandle client; | 815 internal::WlanHandle client; |
816 DWORD cur_version = 0; | 816 DWORD cur_version = 0; |
817 const DWORD kMaxClientVersion = 2; | 817 const DWORD kMaxClientVersion = 2; |
818 DWORD result = wlanapi.OpenHandle( | 818 DWORD result = wlanapi.OpenHandle( |
819 kMaxClientVersion, &cur_version, &client); | 819 kMaxClientVersion, &cur_version, &client); |
820 if (result != ERROR_SUCCESS) | 820 if (result != ERROR_SUCCESS) |
821 return -1; | 821 return -1; |
822 | 822 |
823 WLAN_INTERFACE_INFO_LIST* interface_list_ptr = NULL; | 823 WLAN_INTERFACE_INFO_LIST* interface_list_ptr = NULL; |
824 result = wlanapi.enum_interfaces_func(client, NULL, &interface_list_ptr); | 824 result = wlanapi.enum_interfaces_func(client.Get(), NULL, |
| 825 &interface_list_ptr); |
825 if (result != ERROR_SUCCESS) | 826 if (result != ERROR_SUCCESS) |
826 return -1; | 827 return -1; |
827 scoped_ptr<WLAN_INTERFACE_INFO_LIST, internal::WlanApiDeleter> interface_list( | 828 scoped_ptr<WLAN_INTERFACE_INFO_LIST, internal::WlanApiDeleter> interface_list( |
828 interface_list_ptr); | 829 interface_list_ptr); |
829 | 830 |
830 for (unsigned i = 0; i < interface_list->dwNumberOfItems; ++i) { | 831 for (unsigned i = 0; i < interface_list->dwNumberOfItems; ++i) { |
831 WLAN_INTERFACE_INFO* info = &interface_list->InterfaceInfo[i]; | 832 WLAN_INTERFACE_INFO* info = &interface_list->InterfaceInfo[i]; |
832 DWORD data_size; | 833 DWORD data_size; |
833 PVOID data; | 834 PVOID data; |
834 int options = 0; | 835 int options = 0; |
835 result = wlanapi.query_interface_func( | 836 result = wlanapi.query_interface_func( |
836 client, | 837 client.Get(), |
837 &info->InterfaceGuid, | 838 &info->InterfaceGuid, |
838 wlan_intf_opcode_background_scan_enabled, | 839 wlan_intf_opcode_background_scan_enabled, |
839 NULL, | 840 NULL, |
840 &data_size, | 841 &data_size, |
841 &data, | 842 &data, |
842 NULL); | 843 NULL); |
843 if (result != ERROR_SUCCESS) | 844 if (result != ERROR_SUCCESS) |
844 continue; | 845 continue; |
845 if (!read_int_or_bool(data_size, data)) { | 846 if (!read_int_or_bool(data_size, data)) { |
846 options |= WIFI_OPTIONS_DISABLE_SCAN; | 847 options |= WIFI_OPTIONS_DISABLE_SCAN; |
847 } | 848 } |
848 internal::WlanApi::GetInstance().free_memory_func(data); | 849 internal::WlanApi::GetInstance().free_memory_func(data); |
849 | 850 |
850 result = wlanapi.query_interface_func( | 851 result = wlanapi.query_interface_func( |
851 client, | 852 client.Get(), |
852 &info->InterfaceGuid, | 853 &info->InterfaceGuid, |
853 wlan_intf_opcode_media_streaming_mode, | 854 wlan_intf_opcode_media_streaming_mode, |
854 NULL, | 855 NULL, |
855 &data_size, | 856 &data_size, |
856 &data, | 857 &data, |
857 NULL); | 858 NULL); |
858 if (result != ERROR_SUCCESS) | 859 if (result != ERROR_SUCCESS) |
859 continue; | 860 continue; |
860 if (read_int_or_bool(data_size, data)) { | 861 if (read_int_or_bool(data_size, data)) { |
861 options |= WIFI_OPTIONS_MEDIA_STREAMING_MODE; | 862 options |= WIFI_OPTIONS_MEDIA_STREAMING_MODE; |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
973 TEST_P(NetUtilNonUniqueNameTest, IsHostnameNonUnique) { | 974 TEST_P(NetUtilNonUniqueNameTest, IsHostnameNonUnique) { |
974 const NonUniqueNameTestData& test_data = GetParam(); | 975 const NonUniqueNameTestData& test_data = GetParam(); |
975 | 976 |
976 EXPECT_EQ(test_data.is_unique, IsUnique(test_data.hostname)); | 977 EXPECT_EQ(test_data.is_unique, IsUnique(test_data.hostname)); |
977 } | 978 } |
978 | 979 |
979 INSTANTIATE_TEST_CASE_P(, NetUtilNonUniqueNameTest, | 980 INSTANTIATE_TEST_CASE_P(, NetUtilNonUniqueNameTest, |
980 testing::ValuesIn(kNonUniqueNameTestData)); | 981 testing::ValuesIn(kNonUniqueNameTestData)); |
981 | 982 |
982 } // namespace net | 983 } // namespace net |
OLD | NEW |