| 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 <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 class MDnsListenerImpl; | 102 class MDnsListenerImpl; |
| 103 | 103 |
| 104 class NET_EXPORT_PRIVATE MDnsClientImpl : public MDnsClient { | 104 class NET_EXPORT_PRIVATE MDnsClientImpl : public MDnsClient { |
| 105 public: | 105 public: |
| 106 // The core object exists while the MDnsClient is listening, and is deleted | 106 // The core object exists while the MDnsClient is listening, and is deleted |
| 107 // whenever the number of listeners reaches zero. The deletion happens | 107 // whenever the number of listeners reaches zero. The deletion happens |
| 108 // asychronously, so destroying the last listener does not immediately | 108 // asychronously, so destroying the last listener does not immediately |
| 109 // invalidate the core. | 109 // invalidate the core. |
| 110 class Core : public base::SupportsWeakPtr<Core>, MDnsConnection::Delegate { | 110 class Core : public base::SupportsWeakPtr<Core>, MDnsConnection::Delegate { |
| 111 public: | 111 public: |
| 112 explicit Core(MDnsClientImpl* client); | 112 Core(); |
| 113 ~Core() override; | 113 ~Core() override; |
| 114 | 114 |
| 115 // Initialize the core. Returns true on success. | 115 // Initialize the core. Returns true on success. |
| 116 bool Init(MDnsSocketFactory* socket_factory); | 116 bool Init(MDnsSocketFactory* socket_factory); |
| 117 | 117 |
| 118 // Send a query with a specific rrtype and name. Returns true on success. | 118 // Send a query with a specific rrtype and name. Returns true on success. |
| 119 bool SendQuery(uint16 rrtype, std::string name); | 119 bool SendQuery(uint16 rrtype, std::string name); |
| 120 | 120 |
| 121 // Add/remove a listener to the list of listeners. | 121 // Add/remove a listener to the list of listeners. |
| 122 void AddListener(MDnsListenerImpl* listener); | 122 void AddListener(MDnsListenerImpl* listener); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 150 void OnRecordRemoved(const RecordParsed* record); | 150 void OnRecordRemoved(const RecordParsed* record); |
| 151 | 151 |
| 152 void NotifyNsecRecord(const RecordParsed* record); | 152 void NotifyNsecRecord(const RecordParsed* record); |
| 153 | 153 |
| 154 // Delete and erase the observer list for |key|. Only deletes the observer | 154 // Delete and erase the observer list for |key|. Only deletes the observer |
| 155 // list if is empty. | 155 // list if is empty. |
| 156 void CleanupObserverList(const ListenerKey& key); | 156 void CleanupObserverList(const ListenerKey& key); |
| 157 | 157 |
| 158 ListenerMap listeners_; | 158 ListenerMap listeners_; |
| 159 | 159 |
| 160 MDnsClientImpl* client_; | |
| 161 MDnsCache cache_; | 160 MDnsCache cache_; |
| 162 | 161 |
| 163 base::CancelableClosure cleanup_callback_; | 162 base::CancelableClosure cleanup_callback_; |
| 164 base::Time scheduled_cleanup_; | 163 base::Time scheduled_cleanup_; |
| 165 | 164 |
| 166 scoped_ptr<MDnsConnection> connection_; | 165 scoped_ptr<MDnsConnection> connection_; |
| 167 | 166 |
| 168 DISALLOW_COPY_AND_ASSIGN(Core); | 167 DISALLOW_COPY_AND_ASSIGN(Core); |
| 169 }; | 168 }; |
| 170 | 169 |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 MDnsClientImpl* client_; | 299 MDnsClientImpl* client_; |
| 301 | 300 |
| 302 bool started_; | 301 bool started_; |
| 303 int flags_; | 302 int flags_; |
| 304 | 303 |
| 305 DISALLOW_COPY_AND_ASSIGN(MDnsTransactionImpl); | 304 DISALLOW_COPY_AND_ASSIGN(MDnsTransactionImpl); |
| 306 }; | 305 }; |
| 307 | 306 |
| 308 } // namespace net | 307 } // namespace net |
| 309 #endif // NET_DNS_MDNS_CLIENT_IMPL_H_ | 308 #endif // NET_DNS_MDNS_CLIENT_IMPL_H_ |
| OLD | NEW |