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

Unified Diff: net/base/dns_response.h

Issue 7008021: Added DnsQuery class (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge with trunk 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 | « net/base/dns_query_unittest.cc ('k') | net/base/dns_response.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/dns_response.h
diff --git a/net/base/dns_response.h b/net/base/dns_response.h
new file mode 100644
index 0000000000000000000000000000000000000000..0119e2a95ab29504d50d99e5c993de707554069d
--- /dev/null
+++ b/net/base/dns_response.h
@@ -0,0 +1,47 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef NET_BASE_DNS_RESPONSE_H_
+#define NET_BASE_DNS_RESPONSE_H_
+#pragma once
+
+#include "net/base/dns_query.h"
+
+namespace net{
+
+class AddressList;
+
+// A class that encapsulates bits and pieces related to DNS response
+// processing.
+class DnsResponse {
+ public:
+ // Constructs an object with an IOBuffer large enough to read
+ // one byte more than largest possible response, to detect malformed
+ // responses; |query| is a pointer to the DnsQuery for which |this|
+ // is supposed to be a response.
+ explicit DnsResponse(DnsQuery* query);
+
+ // Internal buffer accessor into which actual bytes of response will be
+ // read.
+ IOBufferWithSize* io_buffer() { return io_buffer_.get(); }
+
+ // Parses response of size nbytes and puts address into |results|,
+ // returns net_error code in case of failure.
+ int Parse(int nbytes, AddressList* results);
+
+ private:
+ // The matching query; |this| is the response for |query_|. We do not
+ // own it, lifetime of |this| should be within the limits of lifetime of
+ // |query_|.
+ const DnsQuery* const query_;
+
+ // Buffer into which response bytes are read.
+ scoped_refptr<IOBufferWithSize> io_buffer_;
+
+ DISALLOW_COPY_AND_ASSIGN(DnsResponse);
+};
+
+} // namespace net
+
+#endif // NET_BASE_DNS_RESPONSE_H_
« no previous file with comments | « net/base/dns_query_unittest.cc ('k') | net/base/dns_response.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698