| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "platform/globals.h" | 5 #include "platform/globals.h" |
| 6 #if defined(TARGET_OS_MACOS) | 6 #if defined(TARGET_OS_MACOS) |
| 7 | 7 |
| 8 #include <errno.h> // NOLINT | 8 #include <errno.h> // NOLINT |
| 9 #include <stdio.h> // NOLINT | 9 #include <stdio.h> // NOLINT |
| 10 #include <stdlib.h> // NOLINT | 10 #include <stdlib.h> // NOLINT |
| 11 #include <string.h> // NOLINT | 11 #include <string.h> // NOLINT |
| 12 #include <sys/stat.h> // NOLINT | 12 #include <sys/stat.h> // NOLINT |
| 13 #include <unistd.h> // NOLINT | 13 #include <unistd.h> // NOLINT |
| 14 #include <net/if.h> // NOLINT |
| 14 #include <netinet/tcp.h> // NOLINT | 15 #include <netinet/tcp.h> // NOLINT |
| 15 #include <ifaddrs.h> // NOLINT | 16 #include <ifaddrs.h> // NOLINT |
| 16 | 17 |
| 17 #include "bin/fdutils.h" | 18 #include "bin/fdutils.h" |
| 18 #include "bin/file.h" | 19 #include "bin/file.h" |
| 19 #include "bin/log.h" | 20 #include "bin/log.h" |
| 20 #include "bin/socket.h" | 21 #include "bin/socket.h" |
| 21 | 22 |
| 22 | 23 |
| 23 namespace dart { | 24 namespace dart { |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 for (struct ifaddrs* ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) { | 292 for (struct ifaddrs* ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) { |
| 292 if (ShouldIncludeIfaAddrs(ifa, lookup_family)) count++; | 293 if (ShouldIncludeIfaAddrs(ifa, lookup_family)) count++; |
| 293 } | 294 } |
| 294 | 295 |
| 295 AddressList<InterfaceSocketAddress>* addresses = | 296 AddressList<InterfaceSocketAddress>* addresses = |
| 296 new AddressList<InterfaceSocketAddress>(count); | 297 new AddressList<InterfaceSocketAddress>(count); |
| 297 int i = 0; | 298 int i = 0; |
| 298 for (struct ifaddrs* ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) { | 299 for (struct ifaddrs* ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) { |
| 299 if (ShouldIncludeIfaAddrs(ifa, lookup_family)) { | 300 if (ShouldIncludeIfaAddrs(ifa, lookup_family)) { |
| 300 addresses->SetAt(i, new InterfaceSocketAddress( | 301 addresses->SetAt(i, new InterfaceSocketAddress( |
| 301 ifa->ifa_addr, strdup(ifa->ifa_name))); | 302 ifa->ifa_addr, strdup(ifa->ifa_name), if_nametoindex(ifa->ifa_name))); |
| 302 i++; | 303 i++; |
| 303 } | 304 } |
| 304 } | 305 } |
| 305 freeifaddrs(ifaddr); | 306 freeifaddrs(ifaddr); |
| 306 return addresses; | 307 return addresses; |
| 307 } | 308 } |
| 308 | 309 |
| 309 | 310 |
| 310 intptr_t ServerSocket::CreateBindListen(RawAddr addr, | 311 intptr_t ServerSocket::CreateBindListen(RawAddr addr, |
| 311 intptr_t port, | 312 intptr_t port, |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 IPPROTO_TCP, | 407 IPPROTO_TCP, |
| 407 TCP_NODELAY, | 408 TCP_NODELAY, |
| 408 reinterpret_cast<char *>(&on), | 409 reinterpret_cast<char *>(&on), |
| 409 sizeof(on))) == 0; | 410 sizeof(on))) == 0; |
| 410 } | 411 } |
| 411 | 412 |
| 412 } // namespace bin | 413 } // namespace bin |
| 413 } // namespace dart | 414 } // namespace dart |
| 414 | 415 |
| 415 #endif // defined(TARGET_OS_MACOS) | 416 #endif // defined(TARGET_OS_MACOS) |
| OLD | NEW |