OLD | NEW |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 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 | 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_linux.h" | 5 #include "net/base/net_util_linux.h" |
6 | 6 |
7 #include <net/if.h> | 7 #include <net/if.h> |
8 #include <netinet/in.h> | 8 #include <netinet/in.h> |
9 #include <set> | 9 #include <set> |
10 #include <sys/types.h> | 10 #include <sys/types.h> |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 } | 55 } |
56 | 56 |
57 return true; | 57 return true; |
58 } | 58 } |
59 | 59 |
60 } // namespace | 60 } // namespace |
61 | 61 |
62 namespace internal { | 62 namespace internal { |
63 | 63 |
64 inline const unsigned char* GetIPAddressData(const IPAddressNumber& ip) { | 64 inline const unsigned char* GetIPAddressData(const IPAddressNumber& ip) { |
65 #if defined(OS_ANDROID) | |
66 return ip.begin(); | |
67 #else | |
68 return ip.data(); | 65 return ip.data(); |
69 #endif | |
70 } | 66 } |
71 | 67 |
72 bool GetNetworkListImpl( | 68 bool GetNetworkListImpl( |
73 NetworkInterfaceList* networks, | 69 NetworkInterfaceList* networks, |
74 int policy, | 70 int policy, |
75 const base::hash_set<int>& online_links, | 71 const base::hash_set<int>& online_links, |
76 const internal::AddressTrackerLinux::AddressMap& address_map, | 72 const internal::AddressTrackerLinux::AddressMap& address_map, |
77 GetInterfaceNameFunction get_interface_name) { | 73 GetInterfaceNameFunction get_interface_name) { |
78 std::map<int, std::string> ifnames; | 74 std::map<int, std::string> ifnames; |
79 | 75 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 | 141 |
146 internal::AddressTrackerLinux tracker; | 142 internal::AddressTrackerLinux tracker; |
147 tracker.Init(); | 143 tracker.Init(); |
148 | 144 |
149 return internal::GetNetworkListImpl(networks, policy, | 145 return internal::GetNetworkListImpl(networks, policy, |
150 tracker.GetOnlineLinks(), | 146 tracker.GetOnlineLinks(), |
151 tracker.GetAddressMap(), &if_indextoname); | 147 tracker.GetAddressMap(), &if_indextoname); |
152 } | 148 } |
153 | 149 |
154 } // namespace net | 150 } // namespace net |
OLD | NEW |