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

Side by Side Diff: runtime/bin/socket_win.cc

Issue 17640008: Add reverse dns lookup as a method on InternetAddress. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « runtime/bin/socket_patch.dart ('k') | sdk/lib/io/socket.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 bool Socket::ReverseLookup(RawAddr addr,
258 char* host,
259 intptr_t host_len,
260 OSError** os_error) {
261 ASSERT(host_len >= NI_MAXHOST);
262 int status = TEMP_FAILURE_RETRY(getnameinfo(
263 &addr.addr,
264 SocketAddress::GetAddrLength(&addr),
265 host,
266 host_len,
267 NULL,
268 0,
269 NI_NAMEREQD));
270 if (status != 0) {
271 ASSERT(*os_error == NULL);
272 DWORD error_code = WSAGetLastError();
273 SetLastError(error_code);
274 *os_error = new OSError();
275 return false;
276 }
277 return true;
278 }
279
280
257 AddressList<InterfaceSocketAddress>* Socket::ListInterfaces( 281 AddressList<InterfaceSocketAddress>* Socket::ListInterfaces(
258 int type, 282 int type,
259 OSError** os_error) { 283 OSError** os_error) {
260 Initialize(); 284 Initialize();
261 285
262 ULONG size = 0; 286 ULONG size = 0;
263 DWORD flags = GAA_FLAG_SKIP_ANYCAST | 287 DWORD flags = GAA_FLAG_SKIP_ANYCAST |
264 GAA_FLAG_SKIP_MULTICAST | 288 GAA_FLAG_SKIP_MULTICAST |
265 GAA_FLAG_SKIP_DNS_SERVER; 289 GAA_FLAG_SKIP_DNS_SERVER;
266 // Query the size needed. 290 // Query the size needed.
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 IPPROTO_TCP, 424 IPPROTO_TCP,
401 TCP_NODELAY, 425 TCP_NODELAY,
402 reinterpret_cast<char *>(&on), 426 reinterpret_cast<char *>(&on),
403 sizeof(on)) == 0; 427 sizeof(on)) == 0;
404 } 428 }
405 429
406 } // namespace bin 430 } // namespace bin
407 } // namespace dart 431 } // namespace dart
408 432
409 #endif // defined(TARGET_OS_WINDOWS) 433 #endif // defined(TARGET_OS_WINDOWS)
OLDNEW
« no previous file with comments | « runtime/bin/socket_patch.dart ('k') | sdk/lib/io/socket.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698