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

Unified Diff: net/base/dns_util.h

Issue 7063024: moved Buffer to dns_util as DnsResponseBuffer (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: fix copyright Created 9 years, 7 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
« no previous file with comments | « no previous file | net/base/dns_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_
« no previous file with comments | « no previous file | net/base/dns_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698