diff options
author | agl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-18 20:04:12 +0000 |
---|---|---|
committer | agl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-18 20:04:12 +0000 |
commit | ff58b6b0e4a3774fb1e0b7c177529dc39651055b (patch) | |
tree | d9b1405f37a7ce4f6c7c527aeefcf5223237916e /net/base/dnsrr_resolver.h | |
parent | 293f19251f23ea4c9de9c0d12262237e213ed788 (diff) | |
download | chromium_src-ff58b6b0e4a3774fb1e0b7c177529dc39651055b.zip chromium_src-ff58b6b0e4a3774fb1e0b7c177529dc39651055b.tar.gz chromium_src-ff58b6b0e4a3774fb1e0b7c177529dc39651055b.tar.bz2 |
DnsRRResolver: hoist inner class and callback on MessageLoop.
This change moves the Response class to the top level to save other
files from having to #include the header in order to get a pointer to
a Response object.
This change also modifies the semantics of resolution: the callback
will now be made of the origin MessageLoop, rather than a random
thread.
TEST=net_unittests
BUG=none
http://codereview.chromium.org/3110015/show
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56585 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/dnsrr_resolver.h')
-rw-r--r-- | net/base/dnsrr_resolver.h | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/net/base/dnsrr_resolver.h b/net/base/dnsrr_resolver.h index 6dfea2f..28bceaa 100644 --- a/net/base/dnsrr_resolver.h +++ b/net/base/dnsrr_resolver.h @@ -15,6 +15,24 @@ namespace net { +// RRResponse contains the result of a successful request for a resource record. +struct RRResponse { + // name contains the canonical name of the resulting domain. If the queried + // name was a CNAME then this can differ. + std::string name; + // ttl contains the TTL of the resource records. + uint32 ttl; + // dnssec is true if the response was DNSSEC validated. + bool dnssec; + std::vector<std::string> rrdatas; + // sigs contains the RRSIG records returned. + std::vector<std::string> signatures; + + // For testing only + bool ParseFromResponse(const uint8* data, unsigned len, + uint16 rrtype_requested); +}; + // DnsRRResolver resolves arbitary DNS resource record types. It should not be // confused with HostResolver and should not be used to resolve A/AAAA records. // @@ -25,37 +43,19 @@ namespace net { // the name is a fully qualified DNS domain. class DnsRRResolver { public: - // Response contains the details of a successful request. - struct Response { - // name contains the canonical name of the resulting domain. If the queried - // name was a CNAME then this can differ. - std::string name; - // ttl contains the TTL of the resource records. - uint32 ttl; - // dnssec is true if the response was DNSSEC validated. - bool dnssec; - std::vector<std::string> rrdatas; - // sigs contains the RRSIG records returned. - std::vector<std::string> signatures; - - // For testing only - bool ParseFromResponse(const uint8* data, unsigned len, - uint16 rrtype_requested); - }; - enum { // Try harder to get a DNSSEC signed response. This doesn't mean that the - // Response will always have the dnssec bit set. + // RRResponse will always have the dnssec bit set. FLAG_WANT_DNSSEC = 1, }; // Resolve starts the resolution process. When complete, |callback| is called // with a result. If the result is |OK| then |response| is filled with the - // result of the resolution. Note the |callback| is called from a random - // worker thread. + // result of the resolution. Note the |callback| is called on the current + // MessageLoop. static bool Resolve(const std::string& name, uint16 rrtype, uint16 flags, CompletionCallback* callback, - Response* response); + RRResponse* response); private: DISALLOW_COPY_AND_ASSIGN(DnsRRResolver); |