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

Side by Side Diff: net/dns/mdns_client.cc

Issue 2333923004: Extracting NetLog inner classes into their own classes. (Closed)
Patch Set: Some nit fixes and better, impl-agnostic naming of net_log_parameters_callback_typedef.h -> net/log… Created 4 years, 2 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
OLDNEW
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 "net/dns/mdns_client.h" 5 #include "net/dns/mdns_client.h"
6 6
7 #include "net/base/ip_address.h" 7 #include "net/base/ip_address.h"
8 #include "net/base/net_errors.h" 8 #include "net/base/net_errors.h"
9 #include "net/base/network_interfaces.h" 9 #include "net/base/network_interfaces.h"
10 #include "net/dns/dns_protocol.h" 10 #include "net/dns/dns_protocol.h"
11 #include "net/dns/mdns_client_impl.h" 11 #include "net/dns/mdns_client_impl.h"
12 #include "net/log/net_log_source.h"
12 13
13 namespace net { 14 namespace net {
14 15
15 namespace { 16 namespace {
16 17
17 const char kMDnsMulticastGroupIPv4[] = "224.0.0.251"; 18 const char kMDnsMulticastGroupIPv4[] = "224.0.0.251";
18 const char kMDnsMulticastGroupIPv6[] = "FF02::FB"; 19 const char kMDnsMulticastGroupIPv6[] = "FF02::FB";
19 20
20 IPEndPoint GetMDnsIPEndPoint(const char* address) { 21 IPEndPoint GetMDnsIPEndPoint(const char* address) {
21 IPAddress multicast_group_number; 22 IPAddress multicast_group_number;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 // Interfaces could have multiple addresses. Filter out duplicate entries. 82 // Interfaces could have multiple addresses. Filter out duplicate entries.
82 interfaces.erase(std::unique(interfaces.begin(), interfaces.end()), 83 interfaces.erase(std::unique(interfaces.begin(), interfaces.end()),
83 interfaces.end()); 84 interfaces.end());
84 return interfaces; 85 return interfaces;
85 } 86 }
86 87
87 std::unique_ptr<DatagramServerSocket> CreateAndBindMDnsSocket( 88 std::unique_ptr<DatagramServerSocket> CreateAndBindMDnsSocket(
88 AddressFamily address_family, 89 AddressFamily address_family,
89 uint32_t interface_index) { 90 uint32_t interface_index) {
90 std::unique_ptr<DatagramServerSocket> socket( 91 std::unique_ptr<DatagramServerSocket> socket(
91 new UDPServerSocket(NULL, NetLog::Source())); 92 new UDPServerSocket(NULL, NetLogSource()));
92 93
93 IPEndPoint multicast_addr = GetMDnsIPEndPoint(address_family); 94 IPEndPoint multicast_addr = GetMDnsIPEndPoint(address_family);
94 int rv = Bind(multicast_addr, interface_index, socket.get()); 95 int rv = Bind(multicast_addr, interface_index, socket.get());
95 if (rv != OK) { 96 if (rv != OK) {
96 socket.reset(); 97 socket.reset();
97 VLOG(1) << "Bind failed, endpoint=" << multicast_addr.ToStringWithoutPort() 98 VLOG(1) << "Bind failed, endpoint=" << multicast_addr.ToStringWithoutPort()
98 << ", error=" << rv; 99 << ", error=" << rv;
99 } 100 }
100 return socket; 101 return socket;
101 } 102 }
102 103
103 } // namespace net 104 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698