| Index: net/dns/dns_response.h
|
| diff --git a/net/dns/dns_response.h b/net/dns/dns_response.h
|
| index 764517a37047354dd2fd9fbd8e6c57e4b0e41294..c7751497951bc9779f9aca1143b789d1db81fb1a 100644
|
| --- a/net/dns/dns_response.h
|
| +++ b/net/dns/dns_response.h
|
| @@ -11,11 +11,13 @@
|
| #include "base/basictypes.h"
|
| #include "base/memory/ref_counted.h"
|
| #include "base/string_piece.h"
|
| +#include "base/time.h"
|
| #include "net/base/net_export.h"
|
| #include "net/base/net_util.h"
|
|
|
| namespace net {
|
|
|
| +class AddressList;
|
| class DnsQuery;
|
| class IOBufferWithSize;
|
|
|
| @@ -61,10 +63,10 @@ class NET_EXPORT_PRIVATE DnsRecordParser {
|
| // This is exposed to allow parsing compressed names within RRDATA for TYPEs
|
| // such as NS, CNAME, PTR, MX, SOA.
|
| // See RFC 1035 section 4.1.4.
|
| - int ParseName(const void* pos, std::string* out) const;
|
| + int ReadName(const void* pos, std::string* out) const;
|
|
|
| - // Parses the next resource record. Returns true if succeeded.
|
| - bool ParseRecord(DnsResourceRecord* record);
|
| + // Parses the next resource record into |record|. Returns true if succeeded.
|
| + bool ReadRecord(DnsResourceRecord* record);
|
|
|
| private:
|
| const char* packet_;
|
| @@ -78,6 +80,19 @@ class NET_EXPORT_PRIVATE DnsRecordParser {
|
| // position the RR parser.
|
| class NET_EXPORT_PRIVATE DnsResponse {
|
| public:
|
| + // Possible results from ParseToAddressList
|
| + enum Result {
|
| + DNS_SUCCESS = 0,
|
| + DNS_MALFORMED_RESPONSE, // DnsRecordParser failed before the end of
|
| + // packet.
|
| + DNS_NAME_MISMATCH, // Got an address but no ordered chain of CNAMEs
|
| + // leads there.
|
| + DNS_SIZE_MISMATCH, // Got an address but size does not match.
|
| + DNS_CNAME_AFTER_ADDRESS, // Found CNAME after an address record.
|
| + DNS_ADDRESS_TTL_MISMATCH, // TTL of all address records are not identical.
|
| + DNS_NO_ADDRESSES, // No address records found.
|
| + };
|
| +
|
| // Constructs an object with an IOBuffer large enough to read
|
| // one byte more than largest possible response, to detect malformed
|
| // responses.
|
| @@ -116,6 +131,10 @@ class NET_EXPORT_PRIVATE DnsResponse {
|
| // This operation is idempotent.
|
| DnsRecordParser Parser() const;
|
|
|
| + // Extracts an AddressList from this response. Returns OK if succeeded.
|
| + // Otherwise returns a detailed error number.
|
| + Result ParseToAddressList(AddressList* addr_list, base::TimeDelta* ttl) const;
|
| +
|
| private:
|
| // Convenience for header access.
|
| const dns_protocol::Header* header() const;
|
|
|