| 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_WINDOWS) | 6 #if defined(TARGET_OS_WINDOWS) |
| 7 | 7 |
| 8 #include "bin/builtin.h" | 8 #include "bin/builtin.h" |
| 9 #include "bin/eventhandler.h" | 9 #include "bin/eventhandler.h" |
| 10 #include "bin/file.h" | 10 #include "bin/file.h" |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 if (c->ai_family == AF_INET || c->ai_family == AF_INET6) { | 247 if (c->ai_family == AF_INET || c->ai_family == AF_INET6) { |
| 248 addresses->SetAt(i, new SocketAddress(c->ai_addr)); | 248 addresses->SetAt(i, new SocketAddress(c->ai_addr)); |
| 249 i++; | 249 i++; |
| 250 } | 250 } |
| 251 } | 251 } |
| 252 freeaddrinfo(info); | 252 freeaddrinfo(info); |
| 253 return addresses; | 253 return addresses; |
| 254 } | 254 } |
| 255 | 255 |
| 256 | 256 |
| 257 const char* Socket::ReverseLookup(RawAddr addr, OSError** os_error) { |
| 258 char* host = new char[NI_MAXHOST]; |
| 259 int status = getnameinfo(&addr.addr, |
| 260 SocketAddress::GetAddrLength(&addr), |
| 261 host, |
| 262 NI_MAXHOST, |
| 263 NULL, |
| 264 0, |
| 265 NI_NAMEREQD); |
| 266 if (status != 0) { |
| 267 ASSERT(*os_error == NULL); |
| 268 DWORD error_code = WSAGetLastError(); |
| 269 SetLastError(error_code); |
| 270 *os_error = new OSError(); |
| 271 delete host; |
| 272 return NULL; |
| 273 } |
| 274 return host; |
| 275 } |
| 276 |
| 277 |
| 257 AddressList<InterfaceSocketAddress>* Socket::ListInterfaces( | 278 AddressList<InterfaceSocketAddress>* Socket::ListInterfaces( |
| 258 int type, | 279 int type, |
| 259 OSError** os_error) { | 280 OSError** os_error) { |
| 260 Initialize(); | 281 Initialize(); |
| 261 | 282 |
| 262 ULONG size = 0; | 283 ULONG size = 0; |
| 263 DWORD flags = GAA_FLAG_SKIP_ANYCAST | | 284 DWORD flags = GAA_FLAG_SKIP_ANYCAST | |
| 264 GAA_FLAG_SKIP_MULTICAST | | 285 GAA_FLAG_SKIP_MULTICAST | |
| 265 GAA_FLAG_SKIP_DNS_SERVER; | 286 GAA_FLAG_SKIP_DNS_SERVER; |
| 266 // Query the size needed. | 287 // Query the size needed. |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 IPPROTO_TCP, | 421 IPPROTO_TCP, |
| 401 TCP_NODELAY, | 422 TCP_NODELAY, |
| 402 reinterpret_cast<char *>(&on), | 423 reinterpret_cast<char *>(&on), |
| 403 sizeof(on)) == 0; | 424 sizeof(on)) == 0; |
| 404 } | 425 } |
| 405 | 426 |
| 406 } // namespace bin | 427 } // namespace bin |
| 407 } // namespace dart | 428 } // namespace dart |
| 408 | 429 |
| 409 #endif // defined(TARGET_OS_WINDOWS) | 430 #endif // defined(TARGET_OS_WINDOWS) |
| OLD | NEW |