Don't add an aura tooltip to bubble close buttons on Windows.
[chromium-blink-merge.git] / net / base / net_util_posix.cc
blob86709d6fa75da6e6f036645a0702f36229bc5d17
1 // Copyright (c) 2011 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.
5 #include "net/base/net_util.h"
7 #include <set>
8 #include <sys/types.h>
10 #include "base/memory/scoped_ptr.h"
12 #if !defined(OS_NACL)
13 #include "net/base/net_util_posix.h"
14 #include <net/if.h>
15 #include <netinet/in.h>
16 #endif // !defined(OS_NACL)
18 namespace net {
20 #if !defined(OS_NACL)
21 namespace internal {
23 // The application layer can pass |policy| defined in net_util.h to
24 // request filtering out certain type of interfaces.
25 bool ShouldIgnoreInterface(const std::string& name, int policy) {
26 // Filter out VMware interfaces, typically named vmnet1 and vmnet8,
27 // which might not be useful for use cases like WebRTC.
28 if ((policy & EXCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES) &&
29 ((name.find("vmnet") != std::string::npos) ||
30 (name.find("vnic") != std::string::npos))) {
31 return true;
34 return false;
37 // Check if the address is unspecified (i.e. made of zeroes) or loopback.
38 bool IsLoopbackOrUnspecifiedAddress(const sockaddr* addr) {
39 if (addr->sa_family == AF_INET6) {
40 const struct sockaddr_in6* addr_in6 =
41 reinterpret_cast<const struct sockaddr_in6*>(addr);
42 const struct in6_addr* sin6_addr = &addr_in6->sin6_addr;
43 if (IN6_IS_ADDR_LOOPBACK(sin6_addr) || IN6_IS_ADDR_UNSPECIFIED(sin6_addr)) {
44 return true;
46 } else if (addr->sa_family == AF_INET) {
47 const struct sockaddr_in* addr_in =
48 reinterpret_cast<const struct sockaddr_in*>(addr);
49 if (addr_in->sin_addr.s_addr == INADDR_LOOPBACK ||
50 addr_in->sin_addr.s_addr == 0) {
51 return true;
53 } else {
54 // Skip non-IP addresses.
55 return true;
57 return false;
60 } // namespace internal
61 #else // OS_NACL
62 bool GetNetworkList(NetworkInterfaceList* networks, int policy) {
63 NOTIMPLEMENTED();
64 return false;
67 std::string GetWifiSSID() {
68 NOTIMPLEMENTED();
69 return "";
71 #endif // OS_NACL
73 WifiPHYLayerProtocol GetWifiPHYLayerProtocol() {
74 return WIFI_PHY_LAYER_PROTOCOL_UNKNOWN;
77 scoped_ptr<ScopedWifiOptions> SetWifiOptions(int options) {
78 return scoped_ptr<ScopedWifiOptions>();
82 } // namespace net