| Index: net/base/dns_util.h
|
| diff --git a/net/base/dns_util.h b/net/base/dns_util.h
|
| index bf4c33074a2472acd983df2f02370bc59ea6204c..781c104e8262e8df8cb9c6cb0d8910330859c775 100644
|
| --- a/net/base/dns_util.h
|
| +++ b/net/base/dns_util.h
|
| @@ -9,6 +9,7 @@
|
| #include <string>
|
|
|
| #include "base/basictypes.h"
|
| +#include "base/string_piece.h"
|
| #include "net/base/net_api.h"
|
|
|
| namespace net {
|
| @@ -54,6 +55,37 @@ static const uint8 kDNSSEC_RSA_SHA256 = 8;
|
| static const uint8 kDNSSEC_SHA1 = 1;
|
| static const uint8 kDNSSEC_SHA256 = 2;
|
|
|
| +// A Buffer is used for walking over a DNS response packet.
|
| +class DnsResponseBuffer {
|
| + public:
|
| + DnsResponseBuffer(const uint8* p, unsigned len)
|
| + : p_(p),
|
| + packet_(p),
|
| + len_(len),
|
| + packet_len_(len) {
|
| + }
|
| +
|
| + bool U8(uint8* v);
|
| + bool U16(uint16* v);
|
| + bool U32(uint32* v);
|
| + bool Skip(unsigned n);
|
| +
|
| + bool Block(base::StringPiece* out, unsigned len);
|
| +
|
| + // DNSName parses a (possibly compressed) DNS name from the packet. If |name|
|
| + // is not NULL, then the name is written into it. See RFC 1035 section 4.1.4.
|
| + bool DNSName(std::string* name);
|
| +
|
| + private:
|
| + const uint8* p_;
|
| + const uint8* const packet_;
|
| + unsigned len_;
|
| + const unsigned packet_len_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(DnsResponseBuffer);
|
| +};
|
| +
|
| +
|
| } // namespace net
|
|
|
| #endif // NET_BASE_DNS_UTIL_H_
|
|
|