| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/local_discovery/service_discovery_client_mac.h" | 5 #include "chrome/browser/local_discovery/service_discovery_client_mac.h" |
| 6 | 6 |
| 7 #import <arpa/inet.h> | 7 #import <arpa/inet.h> |
| 8 #import <Foundation/Foundation.h> | 8 #import <Foundation/Foundation.h> |
| 9 #import <net/if_dl.h> | 9 #import <net/if_dl.h> |
| 10 #include <stddef.h> | 10 #include <stddef.h> |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 service_description_.service_name = service_name_; | 347 service_description_.service_name = service_name_; |
| 348 | 348 |
| 349 for (NSData* address in [service_ addresses]) { | 349 for (NSData* address in [service_ addresses]) { |
| 350 const void* bytes = [address bytes]; | 350 const void* bytes = [address bytes]; |
| 351 int length = [address length]; | 351 int length = [address length]; |
| 352 const sockaddr* socket = static_cast<const sockaddr*>(bytes); | 352 const sockaddr* socket = static_cast<const sockaddr*>(bytes); |
| 353 net::IPEndPoint end_point; | 353 net::IPEndPoint end_point; |
| 354 if (end_point.FromSockAddr(socket, length)) { | 354 if (end_point.FromSockAddr(socket, length)) { |
| 355 service_description_.address = | 355 service_description_.address = |
| 356 net::HostPortPair::FromIPEndPoint(end_point); | 356 net::HostPortPair::FromIPEndPoint(end_point); |
| 357 service_description_.ip_address = end_point.address(); | 357 service_description_.ip_address = end_point.address().bytes(); |
| 358 break; | 358 break; |
| 359 } | 359 } |
| 360 } | 360 } |
| 361 | 361 |
| 362 if (service_description_.address.host().empty()) { | 362 if (service_description_.address.host().empty()) { |
| 363 VLOG(1) << "Service IP is not resolved: " << service_name_; | 363 VLOG(1) << "Service IP is not resolved: " << service_name_; |
| 364 callback_runner_->PostTask( | 364 callback_runner_->PostTask( |
| 365 FROM_HERE, | 365 FROM_HERE, |
| 366 base::Bind(callback_, STATUS_KNOWN_NONEXISTENT, ServiceDescription())); | 366 base::Bind(callback_, STATUS_KNOWN_NONEXISTENT, ServiceDescription())); |
| 367 return; | 367 return; |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 container_->OnResolveUpdate(local_discovery::ServiceResolver::STATUS_SUCCESS); | 483 container_->OnResolveUpdate(local_discovery::ServiceResolver::STATUS_SUCCESS); |
| 484 } | 484 } |
| 485 | 485 |
| 486 - (void)netService:(NSNetService *)sender | 486 - (void)netService:(NSNetService *)sender |
| 487 didNotResolve:(NSDictionary *)errorDict { | 487 didNotResolve:(NSDictionary *)errorDict { |
| 488 container_->OnResolveUpdate( | 488 container_->OnResolveUpdate( |
| 489 local_discovery::ServiceResolver::STATUS_REQUEST_TIMEOUT); | 489 local_discovery::ServiceResolver::STATUS_REQUEST_TIMEOUT); |
| 490 } | 490 } |
| 491 | 491 |
| 492 @end | 492 @end |
| OLD | NEW |