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