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

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: respond to 2nd review 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
« no previous file with comments | « net/base/net_log_event_type_list.h ('k') | net/dns/dns_response.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
102 // Constructs response from |data|. Used for testing purposes only! 101
102 // Constructs a response buffer of given length. Used for TCP transactions.
103 explicit DnsResponse(size_t length);
104
105 // Constructs a response from |data|. Used for testing purposes only!
103 DnsResponse(const void* data, size_t length, size_t answer_offset); 106 DnsResponse(const void* data, size_t length, size_t answer_offset);
107
104 ~DnsResponse(); 108 ~DnsResponse();
105 109
106 // Internal buffer accessor into which actual bytes of response will be 110 // Internal buffer accessor into which actual bytes of response will be
107 // read. 111 // read.
108 IOBufferWithSize* io_buffer() { return io_buffer_.get(); } 112 IOBufferWithSize* io_buffer() { return io_buffer_.get(); }
109 113
110 // Returns false if the packet is shorter than the header or does not match 114 // Assuming the internal buffer holds |nbytes| bytes, returns true iff the
111 // |query| id or question. 115 // packet matches the |query| id and question.
112 bool InitParse(int nbytes, const DnsQuery& query); 116 bool InitParse(int nbytes, const DnsQuery& query);
113 117
114 // Returns true if response is valid, that is, after successful InitParse. 118 // Returns true if response is valid, that is, after successful InitParse.
115 bool IsValid() const; 119 bool IsValid() const;
116 120
117 // All of the methods below are valid only if the response is valid. 121 // All of the methods below are valid only if the response is valid.
118 122
119 // Accessors for the header. 123 // Accessors for the header.
120 uint16 flags() const; // excluding rcode 124 uint16 flags() const; // excluding rcode
121 uint8 rcode() const; 125 uint8 rcode() const;
(...skipping 25 matching lines...) Expand all
147 // Iterator constructed after InitParse positioned at the answer section. 151 // Iterator constructed after InitParse positioned at the answer section.
148 // It is never updated afterwards, so can be used in accessors. 152 // It is never updated afterwards, so can be used in accessors.
149 DnsRecordParser parser_; 153 DnsRecordParser parser_;
150 154
151 DISALLOW_COPY_AND_ASSIGN(DnsResponse); 155 DISALLOW_COPY_AND_ASSIGN(DnsResponse);
152 }; 156 };
153 157
154 } // namespace net 158 } // namespace net
155 159
156 #endif // NET_DNS_DNS_RESPONSE_H_ 160 #endif // NET_DNS_DNS_RESPONSE_H_
OLDNEW
« no previous file with comments | « net/base/net_log_event_type_list.h ('k') | net/dns/dns_response.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698