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

Unified Diff: net/dns/dns_query.h

Issue 8762001: Isolates generic DnsClient from AsyncHostResolver. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: retrying to fix status of dns_session.h Created 9 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/dns/dns_protocol.h ('k') | net/dns/dns_query.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/dns/dns_query.h
diff --git a/net/dns/dns_query.h b/net/dns/dns_query.h
index c6bd3bc1ceb608836251e49b52980628bde65ccc..e8511134354265df87966525e1a27dd90a740c12 100644
--- a/net/dns/dns_query.h
+++ b/net/dns/dns_query.h
@@ -6,53 +6,41 @@
#define NET_DNS_DNS_QUERY_H_
#pragma once
-#include <string>
-
+#include "base/basictypes.h"
#include "base/memory/ref_counted.h"
+#include "base/string_piece.h"
#include "net/base/net_export.h"
-#include "net/base/rand_callback.h"
namespace net {
class IOBufferWithSize;
// Represents on-the-wire DNS query message as an object.
+// TODO(szym): add support for the OPT pseudo-RR (EDNS0/DNSSEC).
class NET_EXPORT_PRIVATE DnsQuery {
public:
// Constructs a query message from |qname| which *MUST* be in a valid
- // DNS name format, and |qtype| which must be either kDNS_A or kDNS_AAAA.
-
- // Every generated object has a random ID, hence two objects generated
- // with the same set of constructor arguments are generally not equal;
- // there is a 1/2^16 chance of them being equal due to size of |id_|.
- DnsQuery(const std::string& qname,
- uint16 qtype,
- const RandIntCallback& rand_int_cb);
+ // DNS name format, and |qtype|. The qclass is set to IN.
+ DnsQuery(uint16 id, const base::StringPiece& qname, uint16 qtype);
~DnsQuery();
- // Clones |this| verbatim, with ID field of the header regenerated.
- DnsQuery* CloneWithNewId() const;
+ // Clones |this| verbatim, with ID field of the header set to |id|.
+ DnsQuery* CloneWithNewId(uint16 id) const;
// DnsQuery field accessors.
uint16 id() const;
+ base::StringPiece qname() const;
uint16 qtype() const;
- // Returns the size of the Question section of the query. Used when
- // matching the response.
- size_t question_size() const;
-
- // Returns pointer to the Question section of the query. Used when
- // matching the response.
- const char* question_data() const;
+ // Returns the Question section of the query. Used when matching the
+ // response.
+ base::StringPiece question() const;
// IOBuffer accessor to be used for writing out the query.
IOBufferWithSize* io_buffer() const { return io_buffer_; }
private:
- const std::string qname() const;
-
- // Randomizes ID field of the query message.
- void RandomizeId();
+ DnsQuery(const DnsQuery& orig, uint16 id);
// Size of the DNS name (*NOT* hostname) we are trying to resolve; used
// to calculate offsets.
@@ -61,9 +49,6 @@ class NET_EXPORT_PRIVATE DnsQuery {
// Contains query bytes to be consumed by higher level Write() call.
scoped_refptr<IOBufferWithSize> io_buffer_;
- // PRNG function for generating IDs.
- RandIntCallback rand_int_cb_;
-
DISALLOW_COPY_AND_ASSIGN(DnsQuery);
};
« no previous file with comments | « net/dns/dns_protocol.h ('k') | net/dns/dns_query.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698