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

Side by Side Diff: net/base/dnsrr_resolver.h

Issue 6314010: Even more reordering the methods in headers and implementation in net/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | net/base/dnssec_keyset.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_BASE_DNSRR_RESOLVER_H_ 5 #ifndef NET_BASE_DNSRR_RESOLVER_H_
6 #define NET_BASE_DNSRR_RESOLVER_H_ 6 #define NET_BASE_DNSRR_RESOLVER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
11 #include <utility> 11 #include <utility>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/basictypes.h" 14 #include "base/basictypes.h"
15 #include "base/ref_counted.h" 15 #include "base/ref_counted.h"
16 #include "base/threading/non_thread_safe.h" 16 #include "base/threading/non_thread_safe.h"
17 #include "base/time.h" 17 #include "base/time.h"
18 #include "build/build_config.h" 18 #include "build/build_config.h"
19 #include "net/base/completion_callback.h" 19 #include "net/base/completion_callback.h"
20 #include "net/base/network_change_notifier.h" 20 #include "net/base/network_change_notifier.h"
21 21
22 namespace net { 22 namespace net {
23 23
24 // RRResponse contains the result of a successful request for a resource record. 24 // RRResponse contains the result of a successful request for a resource record.
25 struct RRResponse { 25 struct RRResponse {
26 RRResponse(); 26 RRResponse();
27 ~RRResponse(); 27 ~RRResponse();
28 28
29 // HasExpired returns true if |fetch_time| + |ttl| is less than
30 // |current_time|.
31 bool HasExpired(base::Time current_time) const;
32
33 // For testing only
34 bool ParseFromResponse(const uint8* data, unsigned len,
35 uint16 rrtype_requested);
36
29 // name contains the canonical name of the resulting domain. If the queried 37 // name contains the canonical name of the resulting domain. If the queried
30 // name was a CNAME then this can differ. 38 // name was a CNAME then this can differ.
31 std::string name; 39 std::string name;
32 // ttl contains the TTL of the resource records. 40 // ttl contains the TTL of the resource records.
33 uint32 ttl; 41 uint32 ttl;
34 // dnssec is true if the response was DNSSEC validated. 42 // dnssec is true if the response was DNSSEC validated.
35 bool dnssec; 43 bool dnssec;
36 std::vector<std::string> rrdatas; 44 std::vector<std::string> rrdatas;
37 // sigs contains the RRSIG records returned. 45 // sigs contains the RRSIG records returned.
38 std::vector<std::string> signatures; 46 std::vector<std::string> signatures;
39 // fetch_time is the time at which the response was received from the 47 // fetch_time is the time at which the response was received from the
40 // network. 48 // network.
41 base::Time fetch_time; 49 base::Time fetch_time;
42 // negative is true if this is a negative cache entry, i.e. is a placeholder 50 // negative is true if this is a negative cache entry, i.e. is a placeholder
43 // to remember that a given RR doesn't exist. 51 // to remember that a given RR doesn't exist.
44 bool negative; 52 bool negative;
45
46 // HasExpired returns true if |fetch_time| + |ttl| is less than
47 // |current_time|.
48 bool HasExpired(base::Time current_time) const;
49
50 // For testing only
51 bool ParseFromResponse(const uint8* data, unsigned len,
52 uint16 rrtype_requested);
53 }; 53 };
54 54
55 class BoundNetLog; 55 class BoundNetLog;
56 class RRResolverWorker; 56 class RRResolverWorker;
57 class RRResolverJob; 57 class RRResolverJob;
58 58
59 // DnsRRResolver resolves arbitary DNS resource record types. It should not be 59 // DnsRRResolver resolves arbitary DNS resource record types. It should not be
60 // confused with HostResolver and should not be used to resolve A/AAAA records. 60 // confused with HostResolver and should not be used to resolve A/AAAA records.
61 // 61 //
62 // HostResolver exists to lookup addresses and there are many details about 62 // HostResolver exists to lookup addresses and there are many details about
63 // address resolution over and above DNS (i.e. Bonjour, VPNs etc). 63 // address resolution over and above DNS (i.e. Bonjour, VPNs etc).
64 // 64 //
65 // DnsRRResolver should only be used when the data is specifically DNS data and 65 // DnsRRResolver should only be used when the data is specifically DNS data and
66 // the name is a fully qualified DNS domain. 66 // the name is a fully qualified DNS domain.
67 // 67 //
68 // A DnsRRResolver must be used from the MessageLoop which created it. 68 // A DnsRRResolver must be used from the MessageLoop which created it.
69 class DnsRRResolver : public base::NonThreadSafe, 69 class DnsRRResolver : public base::NonThreadSafe,
70 public NetworkChangeNotifier::Observer { 70 public NetworkChangeNotifier::Observer {
71 public: 71 public:
72 typedef intptr_t Handle;
73
72 enum { 74 enum {
73 kInvalidHandle = 0, 75 kInvalidHandle = 0,
74 }; 76 };
75 77
76 enum { 78 enum {
77 // Try harder to get a DNSSEC signed response. This doesn't mean that the 79 // Try harder to get a DNSSEC signed response. This doesn't mean that the
78 // RRResponse will always have the dnssec bit set. 80 // RRResponse will always have the dnssec bit set.
79 FLAG_WANT_DNSSEC = 1, 81 FLAG_WANT_DNSSEC = 1,
80 }; 82 };
81 83
82 typedef intptr_t Handle;
83
84 DnsRRResolver(); 84 DnsRRResolver();
85 ~DnsRRResolver(); 85 ~DnsRRResolver();
86 86
87 uint64 requests() const { return requests_; } 87 uint64 requests() const { return requests_; }
88 uint64 cache_hits() const { return cache_hits_; } 88 uint64 cache_hits() const { return cache_hits_; }
89 uint64 inflight_joins() const { return inflight_joins_; } 89 uint64 inflight_joins() const { return inflight_joins_; }
90 90
91 // Resolve starts the resolution process. When complete, |callback| is called 91 // Resolve starts the resolution process. When complete, |callback| is called
92 // with a result. If the result is |OK| then |response| is filled with the 92 // with a result. If the result is |OK| then |response| is filled with the
93 // result of the resolution. Note that |callback| is called via the current 93 // result of the resolution. Note that |callback| is called via the current
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 uint64 inflight_joins_; 127 uint64 inflight_joins_;
128 128
129 bool in_destructor_; 129 bool in_destructor_;
130 130
131 DISALLOW_COPY_AND_ASSIGN(DnsRRResolver); 131 DISALLOW_COPY_AND_ASSIGN(DnsRRResolver);
132 }; 132 };
133 133
134 } // namespace net 134 } // namespace net
135 135
136 #endif // NET_BASE_DNSRR_RESOLVER_H_ 136 #endif // NET_BASE_DNSRR_RESOLVER_H_
OLDNEW
« no previous file with comments | « no previous file | net/base/dnssec_keyset.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698