Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: net/base/net_util_win.h

Issue 992733002: Remove //net (except for Android test stuff) and sdch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/base/net_util_unittest.cc ('k') | net/base/net_util_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef NET_BASE_NET_UTIL_WIN_H_
6 #define NET_BASE_NET_UTIL_WIN_H_
7
8 // This file is only used to expose some of the internals
9 // of net_util_win.cc to tests.
10
11 #include <iphlpapi.h>
12 #include <wlanapi.h>
13
14 #include "base/win/scoped_handle.h"
15 #include "net/base/net_export.h"
16 #include "net/base/net_util.h"
17
18 namespace net {
19 namespace internal {
20
21 struct NET_EXPORT WlanApi {
22 typedef DWORD (WINAPI *WlanOpenHandleFunc)(
23 DWORD, VOID*, DWORD*, HANDLE*);
24 typedef DWORD (WINAPI *WlanEnumInterfacesFunc)(
25 HANDLE, VOID*, WLAN_INTERFACE_INFO_LIST**);
26 typedef DWORD (WINAPI *WlanQueryInterfaceFunc)(
27 HANDLE, const GUID*, WLAN_INTF_OPCODE, VOID*, DWORD*, VOID**,
28 WLAN_OPCODE_VALUE_TYPE*);
29 typedef DWORD (WINAPI *WlanSetInterfaceFunc)(
30 HANDLE, const GUID*, WLAN_INTF_OPCODE, DWORD, const VOID*, VOID*);
31 typedef VOID (WINAPI *WlanFreeMemoryFunc)(VOID*);
32 typedef DWORD (WINAPI *WlanCloseHandleFunc)(HANDLE, VOID*);
33
34 WlanApi();
35 static WlanApi& GetInstance();
36
37 template <typename T>
38 DWORD OpenHandle(DWORD client_version, DWORD* cur_version, T* handle) const {
39 HANDLE temp_handle;
40 DWORD result = open_handle_func(client_version, NULL, cur_version,
41 &temp_handle);
42 if (result != ERROR_SUCCESS)
43 return result;
44 handle->Set(temp_handle);
45 return ERROR_SUCCESS;
46 }
47
48 HMODULE module;
49 WlanOpenHandleFunc open_handle_func;
50 WlanEnumInterfacesFunc enum_interfaces_func;
51 WlanQueryInterfaceFunc query_interface_func;
52 WlanSetInterfaceFunc set_interface_func;
53 WlanFreeMemoryFunc free_memory_func;
54 WlanCloseHandleFunc close_handle_func;
55 bool initialized;
56 };
57
58 struct WlanApiHandleTraits {
59 typedef HANDLE Handle;
60
61 static bool CloseHandle(HANDLE handle) {
62 return WlanApi::GetInstance().close_handle_func(handle, NULL) ==
63 ERROR_SUCCESS;
64 }
65 static bool IsHandleValid(HANDLE handle) {
66 return base::win::HandleTraits::IsHandleValid(handle);
67 }
68 static HANDLE NullHandle() {
69 return base::win::HandleTraits::NullHandle();
70 }
71 };
72
73 typedef base::win::GenericScopedHandle<
74 WlanApiHandleTraits,
75 base::win::DummyVerifierTraits> WlanHandle;
76
77 struct WlanApiDeleter {
78 inline void operator()(void* ptr) const {
79 WlanApi::GetInstance().free_memory_func(ptr);
80 }
81 };
82
83 NET_EXPORT bool GetNetworkListImpl(
84 NetworkInterfaceList* networks,
85 int policy,
86 bool is_xp,
87 const IP_ADAPTER_ADDRESSES* ip_adapter_addresses);
88
89 } // namespace internal
90
91 } // namespace net
92
93 #endif // NET_BASE_NET_UTIL_WIN_H_
OLDNEW
« no previous file with comments | « net/base/net_util_unittest.cc ('k') | net/base/net_util_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698