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 (limited) record format (http://www.ietf.org/rfc/rfc3845.txt and |
| 186 // http://www.rfc-editor.org/rfc/rfc6762.txt): |
| 187 // next-domain (ignored): A domain name. |
| 188 // one bit-map: |
| 189 // - one byte zeroed out to represent the zeroth window |
| 190 // - one byte from 0-32 representing the length of the bitmap in bytes |
| 191 // - the bitmap, each bit representing whether or not the record |
| 192 // corresponding to the bit number exists for that domain. |
| 193 class NET_EXPORT_PRIVATE NsecRecordRdata : public RecordRdata { |
| 194 public: |
| 195 static const uint16 kType = dns_protocol::kTypeNSEC; |
| 196 |
| 197 virtual ~NsecRecordRdata(); |
| 198 static scoped_ptr<NsecRecordRdata> Create(const base::StringPiece& data, |
| 199 const DnsRecordParser& parser); |
| 200 virtual bool IsEqual(const RecordRdata* other) const OVERRIDE; |
| 201 virtual uint16 Type() const OVERRIDE; |
| 202 |
| 203 const std::vector<uint8>& bitmap() { return bitmap_; } |
| 204 |
| 205 // Returns bit i-th bit in the bitmap, where bits withing a byte are organized |
| 206 // most to least significant. |
| 207 bool GetBit(unsigned i); |
| 208 |
| 209 private: |
| 210 NsecRecordRdata(); |
| 211 |
| 212 std::vector<uint8> bitmap_; |
| 213 |
| 214 DISALLOW_COPY_AND_ASSIGN(NsecRecordRdata); |
| 215 }; |
| 216 |
| 217 |
184 } // namespace net | 218 } // namespace net |
185 | 219 |
186 #endif // NET_DNS_RECORD_RDATA_H_ | 220 #endif // NET_DNS_RECORD_RDATA_H_ |
OLD | NEW |