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 #ifndef NET_DNS_MDNS_CLIENT_IMPL_H_ | 5 #ifndef NET_DNS_MDNS_CLIENT_IMPL_H_ |
6 #define NET_DNS_MDNS_CLIENT_IMPL_H_ | 6 #define NET_DNS_MDNS_CLIENT_IMPL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <queue> | 9 #include <queue> |
10 #include <string> | 10 #include <string> |
11 #include <utility> | 11 #include <utility> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/cancelable_callback.h" | 14 #include "base/cancelable_callback.h" |
15 #include "base/gtest_prod_util.h" | 15 #include "base/gtest_prod_util.h" |
16 #include "base/memory/scoped_vector.h" | 16 #include "base/memory/scoped_ptr.h" |
17 #include "base/observer_list.h" | 17 #include "base/observer_list.h" |
18 #include "net/base/io_buffer.h" | 18 #include "net/base/io_buffer.h" |
19 #include "net/base/ip_endpoint.h" | 19 #include "net/base/ip_endpoint.h" |
20 #include "net/dns/mdns_cache.h" | 20 #include "net/dns/mdns_cache.h" |
21 #include "net/dns/mdns_client.h" | 21 #include "net/dns/mdns_client.h" |
22 #include "net/udp/datagram_server_socket.h" | 22 #include "net/udp/datagram_server_socket.h" |
23 #include "net/udp/udp_server_socket.h" | 23 #include "net/udp/udp_server_socket.h" |
24 #include "net/udp/udp_socket.h" | 24 #include "net/udp/udp_socket.h" |
25 | 25 |
26 namespace base { | 26 namespace base { |
27 class Clock; | 27 class Clock; |
28 class Timer; | 28 class Timer; |
29 } // namespace base | 29 } // namespace base |
30 | 30 |
31 namespace net { | 31 namespace net { |
32 | 32 |
33 class MDnsSocketFactoryImpl : public MDnsSocketFactory { | 33 class MDnsSocketFactoryImpl : public MDnsSocketFactory { |
34 public: | 34 public: |
35 MDnsSocketFactoryImpl() {} | 35 MDnsSocketFactoryImpl() {} |
36 ~MDnsSocketFactoryImpl() override{}; | 36 ~MDnsSocketFactoryImpl() override{}; |
37 | 37 |
38 void CreateSockets(ScopedVector<DatagramServerSocket>* sockets) override; | 38 void CreateSockets( |
| 39 std::vector<scoped_ptr<DatagramServerSocket>>* sockets) override; |
39 | 40 |
40 private: | 41 private: |
41 DISALLOW_COPY_AND_ASSIGN(MDnsSocketFactoryImpl); | 42 DISALLOW_COPY_AND_ASSIGN(MDnsSocketFactoryImpl); |
42 }; | 43 }; |
43 | 44 |
44 // A connection to the network for multicast DNS clients. It reads data into | 45 // A connection to the network for multicast DNS clients. It reads data into |
45 // DnsResponse objects and alerts the delegate that a packet has been received. | 46 // DnsResponse objects and alerts the delegate that a packet has been received. |
46 class NET_EXPORT_PRIVATE MDnsConnection { | 47 class NET_EXPORT_PRIVATE MDnsConnection { |
47 public: | 48 public: |
48 class Delegate { | 49 class Delegate { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 | 91 |
91 // Callback for handling a datagram being received on either ipv4 or ipv6. | 92 // Callback for handling a datagram being received on either ipv4 or ipv6. |
92 void OnDatagramReceived(DnsResponse* response, | 93 void OnDatagramReceived(DnsResponse* response, |
93 const IPEndPoint& recv_addr, | 94 const IPEndPoint& recv_addr, |
94 int bytes_read); | 95 int bytes_read); |
95 | 96 |
96 void PostOnError(SocketHandler* loop, int rv); | 97 void PostOnError(SocketHandler* loop, int rv); |
97 void OnError(int rv); | 98 void OnError(int rv); |
98 | 99 |
99 // Only socket handlers which successfully bound and started are kept. | 100 // Only socket handlers which successfully bound and started are kept. |
100 ScopedVector<SocketHandler> socket_handlers_; | 101 std::vector<scoped_ptr<SocketHandler>> socket_handlers_; |
101 | 102 |
102 Delegate* delegate_; | 103 Delegate* delegate_; |
103 | 104 |
104 base::WeakPtrFactory<MDnsConnection> weak_ptr_factory_; | 105 base::WeakPtrFactory<MDnsConnection> weak_ptr_factory_; |
105 | 106 |
106 DISALLOW_COPY_AND_ASSIGN(MDnsConnection); | 107 DISALLOW_COPY_AND_ASSIGN(MDnsConnection); |
107 }; | 108 }; |
108 | 109 |
109 class MDnsListenerImpl; | 110 class MDnsListenerImpl; |
110 | 111 |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 MDnsClientImpl* client_; | 320 MDnsClientImpl* client_; |
320 | 321 |
321 bool started_; | 322 bool started_; |
322 int flags_; | 323 int flags_; |
323 | 324 |
324 DISALLOW_COPY_AND_ASSIGN(MDnsTransactionImpl); | 325 DISALLOW_COPY_AND_ASSIGN(MDnsTransactionImpl); |
325 }; | 326 }; |
326 | 327 |
327 } // namespace net | 328 } // namespace net |
328 #endif // NET_DNS_MDNS_CLIENT_IMPL_H_ | 329 #endif // NET_DNS_MDNS_CLIENT_IMPL_H_ |
OLD | NEW |