OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_DNS_TRANSACTION_H_ | 5 #ifndef NET_DNS_DNS_TRANSACTION_H_ |
6 #define NET_DNS_DNS_TRANSACTION_H_ | 6 #define NET_DNS_DNS_TRANSACTION_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
11 #include <utility> | 11 #include <utility> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
15 #include "base/scoped_ptr.h" | 15 #include "base/scoped_ptr.h" |
16 #include "base/timer.h" | 16 #include "base/timer.h" |
17 #include "base/threading/non_thread_safe.h" | 17 #include "base/threading/non_thread_safe.h" |
18 #include "net/base/completion_callback.h" | 18 #include "net/base/completion_callback.h" |
19 #include "net/base/ip_endpoint.h" | 19 #include "net/base/ip_endpoint.h" |
20 #include "net/base/net_api.h" | 20 #include "net/base/net_export.h" |
21 #include "net/base/net_log.h" | 21 #include "net/base/net_log.h" |
22 #include "net/base/rand_callback.h" | 22 #include "net/base/rand_callback.h" |
23 | 23 |
24 namespace net { | 24 namespace net { |
25 | 25 |
26 class ClientSocketFactory; | 26 class ClientSocketFactory; |
27 class DatagramClientSocket; | 27 class DatagramClientSocket; |
28 class DnsQuery; | 28 class DnsQuery; |
29 class DnsResponse; | 29 class DnsResponse; |
30 | 30 |
31 // Performs (with fixed retries) a single asynchronous DNS transaction, | 31 // Performs (with fixed retries) a single asynchronous DNS transaction, |
32 // which consists of sending out a DNS query, waiting for response, and | 32 // which consists of sending out a DNS query, waiting for response, and |
33 // parsing and returning the IP addresses that it matches. | 33 // parsing and returning the IP addresses that it matches. |
34 class NET_TEST DnsTransaction : NON_EXPORTED_BASE(public base::NonThreadSafe) { | 34 class NET_EXPORT_PRIVATE DnsTransaction : |
| 35 NON_EXPORTED_BASE(public base::NonThreadSafe) { |
35 public: | 36 public: |
36 typedef std::pair<std::string, uint16> Key; | 37 typedef std::pair<std::string, uint16> Key; |
37 | 38 |
38 // Interface that should implemented by DnsTransaction consumer and | 39 // Interface that should implemented by DnsTransaction consumer and |
39 // passed to |Start| method to be notified when the transaction has | 40 // passed to |Start| method to be notified when the transaction has |
40 // completed. | 41 // completed. |
41 class NET_TEST Delegate { | 42 class NET_EXPORT_PRIVATE Delegate { |
42 public: | 43 public: |
43 Delegate(); | 44 Delegate(); |
44 virtual ~Delegate(); | 45 virtual ~Delegate(); |
45 | 46 |
46 // A consumer of DnsTransaction should override |OnTransactionComplete| | 47 // A consumer of DnsTransaction should override |OnTransactionComplete| |
47 // and call |set_delegate(this)|. The method will be called once the | 48 // and call |set_delegate(this)|. The method will be called once the |
48 // resolution has completed, results passed in as arguments. | 49 // resolution has completed, results passed in as arguments. |
49 virtual void OnTransactionComplete( | 50 virtual void OnTransactionComplete( |
50 int result, | 51 int result, |
51 const DnsTransaction* transaction, | 52 const DnsTransaction* transaction, |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 CompletionCallbackImpl<DnsTransaction> io_callback_; | 138 CompletionCallbackImpl<DnsTransaction> io_callback_; |
138 | 139 |
139 BoundNetLog net_log_; | 140 BoundNetLog net_log_; |
140 | 141 |
141 DISALLOW_COPY_AND_ASSIGN(DnsTransaction); | 142 DISALLOW_COPY_AND_ASSIGN(DnsTransaction); |
142 }; | 143 }; |
143 | 144 |
144 } // namespace net | 145 } // namespace net |
145 | 146 |
146 #endif // NET_DNS_DNS_TRANSACTION_H_ | 147 #endif // NET_DNS_DNS_TRANSACTION_H_ |
OLD | NEW |