Chromium Code Reviews| 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..3f19e60cf44d9af6ee96db701766845174c78031 |
| --- /dev/null |
| +++ b/net/base/dns_response.h |
| @@ -0,0 +1,46 @@ |
| +// 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 a response object with an IOBuffer large enough to read |
| + // every possible; |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 to be |
|
cbentzel
2011/06/02 21:27:13
bytes of response are to be read.
Why don't call
agayev
2011/06/02 22:33:26
Moving it outside this class will break the symmet
|
| + // 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_|. |
| + DnsQuery* const query_; |
|
cbentzel
2011/06/02 21:27:13
This can be
const DnsQuery* const query_;
agayev
2011/06/02 22:33:26
Done.
|
| + |
| + // 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_ |