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

Side by Side Diff: net/dns/dns_response.h

Issue 11567031: [net/dns] Handle TC bit on DNS response in DnsTransaction. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add test for timeout and fix timeout logic Created 8 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef NET_DNS_DNS_RESPONSE_H_ 5 #ifndef NET_DNS_DNS_RESPONSE_H_
6 #define NET_DNS_DNS_RESPONSE_H_ 6 #define NET_DNS_DNS_RESPONSE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 DNS_NAME_MISMATCH, // Got an address but no ordered chain of CNAMEs 88 DNS_NAME_MISMATCH, // Got an address but no ordered chain of CNAMEs
89 // leads there. 89 // leads there.
90 DNS_SIZE_MISMATCH, // Got an address but size does not match. 90 DNS_SIZE_MISMATCH, // Got an address but size does not match.
91 DNS_CNAME_AFTER_ADDRESS, // Found CNAME after an address record. 91 DNS_CNAME_AFTER_ADDRESS, // Found CNAME after an address record.
92 DNS_ADDRESS_TTL_MISMATCH, // OBSOLETE. No longer used. 92 DNS_ADDRESS_TTL_MISMATCH, // OBSOLETE. No longer used.
93 DNS_NO_ADDRESSES, // OBSOLETE. No longer used. 93 DNS_NO_ADDRESSES, // OBSOLETE. No longer used.
94 // Only add new values here. 94 // Only add new values here.
95 DNS_PARSE_RESULT_MAX, // Bounding value for histograms. 95 DNS_PARSE_RESULT_MAX, // Bounding value for histograms.
96 }; 96 };
97 97
98 // Constructs an object with an IOBuffer large enough to read 98 // Constructs a response buffer large enough to store one byte more than
99 // one byte more than largest possible response, to detect malformed 99 // largest possible response, to detect malformed responses.
100 // responses.
101 DnsResponse(); 100 DnsResponse();
101 // Construct a response buffer of given length. Used for TCP transactions.
mmenke 2012/12/19 16:44:09 nit: For consistency, should start all constructo
szym 2012/12/19 23:35:56 Done.
102 explicit DnsResponse(size_t length);
102 // Constructs response from |data|. Used for testing purposes only! 103 // Constructs response from |data|. Used for testing purposes only!
103 DnsResponse(const void* data, size_t length, size_t answer_offset); 104 DnsResponse(const void* data, size_t length, size_t answer_offset);
104 ~DnsResponse(); 105 ~DnsResponse();
105 106
106 // Internal buffer accessor into which actual bytes of response will be 107 // Internal buffer accessor into which actual bytes of response will be
107 // read. 108 // read.
108 IOBufferWithSize* io_buffer() { return io_buffer_.get(); } 109 IOBufferWithSize* io_buffer() { return io_buffer_.get(); }
109 110
110 // Returns false if the packet is shorter than the header or does not match 111 // Assuming the internal buffer holds |nbytes| bytes, returns true iff the
111 // |query| id or question. 112 // packet matches the |query| id and question.
112 bool InitParse(int nbytes, const DnsQuery& query); 113 bool InitParse(int nbytes, const DnsQuery& query);
113 114
114 // Returns true if response is valid, that is, after successful InitParse. 115 // Returns true if response is valid, that is, after successful InitParse.
115 bool IsValid() const; 116 bool IsValid() const;
116 117
117 // All of the methods below are valid only if the response is valid. 118 // All of the methods below are valid only if the response is valid.
118 119
119 // Accessors for the header. 120 // Accessors for the header.
120 uint16 flags() const; // excluding rcode 121 uint16 flags() const; // excluding rcode
121 uint8 rcode() const; 122 uint8 rcode() const;
(...skipping 25 matching lines...) Expand all
147 // Iterator constructed after InitParse positioned at the answer section. 148 // Iterator constructed after InitParse positioned at the answer section.
148 // It is never updated afterwards, so can be used in accessors. 149 // It is never updated afterwards, so can be used in accessors.
149 DnsRecordParser parser_; 150 DnsRecordParser parser_;
150 151
151 DISALLOW_COPY_AND_ASSIGN(DnsResponse); 152 DISALLOW_COPY_AND_ASSIGN(DnsResponse);
152 }; 153 };
153 154
154 } // namespace net 155 } // namespace net
155 156
156 #endif // NET_DNS_DNS_RESPONSE_H_ 157 #endif // NET_DNS_DNS_RESPONSE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698