OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_RECORD_RDATA_H_ | 5 #ifndef NET_DNS_RECORD_RDATA_H_ |
6 #define NET_DNS_RECORD_RDATA_H_ | 6 #define NET_DNS_RECORD_RDATA_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 const std::vector<std::string>& texts() const { return texts_; } | 174 const std::vector<std::string>& texts() const { return texts_; } |
175 | 175 |
176 private: | 176 private: |
177 TxtRecordRdata(); | 177 TxtRecordRdata(); |
178 | 178 |
179 std::vector<std::string> texts_; | 179 std::vector<std::string> texts_; |
180 | 180 |
181 DISALLOW_COPY_AND_ASSIGN(TxtRecordRdata); | 181 DISALLOW_COPY_AND_ASSIGN(TxtRecordRdata); |
182 }; | 182 }; |
183 | 183 |
| 184 // Only the subset of the NSEC record format required by mDNS is supported. |
| 185 // Nsec record format is described in http://www.ietf.org/rfc/rfc3845.txt and |
| 186 // the limited version required for mDNS described in |
| 187 // http://www.rfc-editor.org/rfc/rfc6762.txt Section 6.1. |
| 188 class NET_EXPORT_PRIVATE NsecRecordRdata : public RecordRdata { |
| 189 public: |
| 190 static const uint16 kType = dns_protocol::kTypeNSEC; |
| 191 |
| 192 virtual ~NsecRecordRdata(); |
| 193 static scoped_ptr<NsecRecordRdata> Create(const base::StringPiece& data, |
| 194 const DnsRecordParser& parser); |
| 195 virtual bool IsEqual(const RecordRdata* other) const OVERRIDE; |
| 196 virtual uint16 Type() const OVERRIDE; |
| 197 |
| 198 // Length of the bitmap in bits. |
| 199 unsigned bitmap_length() const { return bitmap_.size() * 8; } |
| 200 |
| 201 // Returns bit i-th bit in the bitmap, where bits withing a byte are organized |
| 202 // most to least significant. If it is set, a record with rrtype i exists for |
| 203 // the domain name of this nsec record. |
| 204 bool GetBit(unsigned i) const; |
| 205 |
| 206 private: |
| 207 NsecRecordRdata(); |
| 208 |
| 209 std::vector<uint8> bitmap_; |
| 210 |
| 211 DISALLOW_COPY_AND_ASSIGN(NsecRecordRdata); |
| 212 }; |
| 213 |
| 214 |
184 } // namespace net | 215 } // namespace net |
185 | 216 |
186 #endif // NET_DNS_RECORD_RDATA_H_ | 217 #endif // NET_DNS_RECORD_RDATA_H_ |
OLD | NEW |