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

Unified Diff: net/dns/dns_response.h

Issue 9190031: DnsClient refactoring + features (timeout, suffix search, server rotation). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added comments. Fixed tests. Created 8 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 side-by-side diff with in-line comments
Download patch
Index: net/dns/dns_response.h
diff --git a/net/dns/dns_response.h b/net/dns/dns_response.h
index ddd2c2089439ad47997ec4435982e9c4f0e9c207..7984a58f7450aba4ebeea59a4a0942812157c2f6 100644
--- a/net/dns/dns_response.h
+++ b/net/dns/dns_response.h
@@ -51,6 +51,9 @@ class NET_EXPORT_PRIVATE DnsRecordParser {
// Returns |true| if no more bytes remain in the packet.
bool AtEnd() const { return cur_ == packet_ + length_; }
+ // Returns current offset into the packet.
+ size_t offset() const { return cur_ - packet_; }
+
// Parses a (possibly compressed) DNS name from the packet starting at
// |pos|. Stores output (even partial) in |out| unless |out| is NULL. |out|
// is stored in the dotted form, e.g., "example.com". Returns number of bytes
@@ -92,11 +95,17 @@ class NET_EXPORT_PRIVATE DnsResponse {
bool InitParse(int nbytes, const DnsQuery& query);
// Accessors for the header.
- uint8 flags0() const; // first byte of flags
- uint8 flags1() const; // second byte of flags excluding rcode
+ uint16 flags() const; // excluding rcode
uint8 rcode() const;
int answer_count() const;
+ // Accessors to the question. The qname is unparsed.
+ base::StringPiece qname() const;
+ uint16 qtype() const;
+
+ // Returns qname in dotted format.
+ std::string GetDottedName() const;
+
// Returns an iterator to the resource records in the answer section. Must be
// called after InitParse. The iterator is valid only in the scope of the
// DnsResponse.

Powered by Google App Engine
This is Rietveld 408576698