| OLD | NEW |
| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 const char* cur_; | 74 const char* cur_; |
| 75 }; | 75 }; |
| 76 | 76 |
| 77 // Buffer-holder for the DNS response allowing easy access to the header fields | 77 // Buffer-holder for the DNS response allowing easy access to the header fields |
| 78 // and resource records. After reading into |io_buffer| must call InitParse to | 78 // and resource records. After reading into |io_buffer| must call InitParse to |
| 79 // position the RR parser. | 79 // position the RR parser. |
| 80 class NET_EXPORT_PRIVATE DnsResponse { | 80 class NET_EXPORT_PRIVATE DnsResponse { |
| 81 public: | 81 public: |
| 82 // Possible results from ParseToAddressList. | 82 // Possible results from ParseToAddressList. |
| 83 enum Result { | 83 enum Result { |
| 84 DNS_SUCCESS = 0, | 84 DNS_PARSE_OK = 0, |
| 85 DNS_MALFORMED_RESPONSE, // DnsRecordParser failed before the end of | 85 DNS_MALFORMED_RESPONSE, // DnsRecordParser failed before the end of |
| 86 // packet. | 86 // packet. |
| 87 DNS_MALFORMED_CNAME, // Could not parse CNAME out of RRDATA. | 87 DNS_MALFORMED_CNAME, // Could not parse CNAME out of RRDATA. |
| 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, // TTL of all address records are not identical. | 92 DNS_ADDRESS_TTL_MISMATCH, // TTL of all address records are not identical. |
| 93 DNS_NO_ADDRESSES, // No address records found. | 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 an object with an IOBuffer large enough to read |
| 99 // one byte more than largest possible response, to detect malformed | 99 // one byte more than largest possible response, to detect malformed |
| 100 // responses. | 100 // responses. |
| 101 DnsResponse(); | 101 DnsResponse(); |
| 102 // Constructs response from |data|. Used for testing purposes only! | 102 // Constructs response from |data|. Used for testing purposes only! |
| 103 DnsResponse(const void* data, size_t length, size_t answer_offset); | 103 DnsResponse(const void* data, size_t length, size_t answer_offset); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 // Iterator constructed after InitParse positioned at the answer section. | 147 // Iterator constructed after InitParse positioned at the answer section. |
| 148 // It is never updated afterwards, so can be used in accessors. | 148 // It is never updated afterwards, so can be used in accessors. |
| 149 DnsRecordParser parser_; | 149 DnsRecordParser parser_; |
| 150 | 150 |
| 151 DISALLOW_COPY_AND_ASSIGN(DnsResponse); | 151 DISALLOW_COPY_AND_ASSIGN(DnsResponse); |
| 152 }; | 152 }; |
| 153 | 153 |
| 154 } // namespace net | 154 } // namespace net |
| 155 | 155 |
| 156 #endif // NET_DNS_DNS_RESPONSE_H_ | 156 #endif // NET_DNS_DNS_RESPONSE_H_ |
| OLD | NEW |