21#include <boost/shared_ptr.hpp>
58 it->getCurrent().toText() +
"\n";
60 }
while (!it->isLast());
75rrsetToWire(
const AbstractRRset& rrset, T& output,
const size_t limit) {
88 rrset.getName().toWire(output);
89 rrset.getType().toWire(output);
90 rrset.getClass().toWire(output);
91 rrset.getTTL().toWire(output);
92 output.writeUint16(0);
100 const size_t pos0 = output.getLength();
103 rrset.getName().toWire(output);
104 rrset.getType().toWire(output);
105 rrset.getClass().toWire(output);
106 rrset.getTTL().toWire(output);
108 const size_t pos = output.getLength();
109 output.skip(
sizeof(uint16_t));
110 it->getCurrent().toWire(output);
111 output.writeUint16At(output.getLength() - pos -
sizeof(uint16_t), pos);
113 if (limit > 0 && output.getLength() > limit) {
115 output.trim(output.getLength() - pos0);
121 }
while (!it->isLast());
130 return (rrsetToWire<OutputBuffer>(*
this, buffer, 0));
135 const uint32_t rrs_written = rrsetToWire<AbstractMessageRenderer>(
136 *
this, renderer, renderer.getLengthLimit());
138 renderer.setTruncated();
140 return (rrs_written);
148 return (
getType() == other.getType() &&
149 getName() == other.getName() &&
155 os << rrset.toText();
196 renderer.writeUint16(0);
206 const size_t pos0 = renderer.getLength();
214 const size_t pos = renderer.getLength();
215 renderer.skip(
sizeof(uint16_t));
216 rdata->toWire(renderer);
217 renderer.writeUint16At(renderer.getLength() - pos -
sizeof(uint16_t),
220 if (limit > 0 && renderer.getLength() > limit) {
222 renderer.trim(renderer.getLength() - pos0);
241 impl_->rdatalist_.push_back(rdata);
256 return (impl_->rdatalist_.size());
261 return (impl_->name_);
266 return (impl_->rrclass_);
271 return (impl_->rrtype_);
276 return (impl_->ttl_);
303 length +=
getName().getLength();
317 rrlen +=
getName().getLength();
322 rrlen += it->getCurrent().getLength();
328 }
while (!it->isLast());
340 const uint32_t rrs_written = impl_->toWire(renderer,
341 renderer.getLengthLimit());
342 if (impl_->rdatalist_.size() > rrs_written) {
343 renderer.setTruncated();
345 return (rrs_written);
359 return (rrsig_->getRdataCount());
370 const uint16_t rrsigs_length = rrsig_->getLength();
374 length += rrsigs_length;
384 return (rrs_written);
388 rrs_written += rrsig_->toWire(buffer);
391 return (rrs_written);
398 return (rrs_written);
402 rrs_written += rrsig_->toWire(renderer);
405 renderer.setTruncated();
409 return (rrs_written);
417 BasicRdataIterator(
const std::vector<rdata::ConstRdataPtr>& datavector) :
418 datavector_(&datavector), it_(datavector_->begin()) {
422 ~BasicRdataIterator() {
426 virtual void first() {
427 it_ = datavector_->begin();
431 virtual void next() {
445 virtual bool isLast()
const {
446 return (it_ == datavector_->end());
451 const std::vector<rdata::ConstRdataPtr>* datavector_;
454 std::vector<rdata::ConstRdataPtr>::const_iterator it_;
The AbstractMessageRenderer class is an abstract base class that provides common interfaces for rende...
The AbstractRRset class is an abstract base class that models a DNS RRset.
virtual uint32_t toWire(AbstractMessageRenderer &renderer) const =0
Render the RRset in the wire format with name compression and truncation handling.
virtual const RRType & getType() const =0
Returns the RR Type of the RRset.
virtual uint32_t getRdataCount() const =0
Returns the number of Rdata objects contained in the RRset.
virtual std::string toText() const =0
Convert the RRset to a string.
virtual bool isSameKind(const AbstractRRset &other) const
Check whether two RRsets are of the same kind.
virtual RRsetPtr getRRsig() const =0
Return pointer to this RRset's RRSIG RRset.
virtual const Name & getName() const =0
Returns the owner name of the RRset.
virtual const RRTTL & getTTL() const =0
Returns the TTL of the RRset.
virtual RdataIteratorPtr getRdataIterator() const =0
Return an iterator to go through all RDATA stored in the RRset.
virtual void addRdata(rdata::ConstRdataPtr rdata)=0
Add an RDATA to the RRset (pointer version).
virtual const RRClass & getClass() const =0
Returns the RR Class of the RRset.
This encapsulates the actual implementation of the BasicRRset class.
BasicRRsetImpl(const Name &name, const RRClass &rrclass, const RRType &rrtype, const RRTTL &ttl)
uint32_t toWire(AbstractMessageRenderer &renderer, size_t limit) const
vector< ConstRdataPtr > rdatalist_
The BasicRRset class is a concrete derived class of AbstractRRset that defines a straightforward RRse...
virtual RdataIteratorPtr getRdataIterator() const
Return an iterator to go through all RDATA stored in the BasicRRset.
virtual const RRTTL & getTTL() const
Returns the TTL of the RRset.
virtual void addRdata(rdata::ConstRdataPtr rdata)
Add an RDATA to the RRset (pointer version).
virtual uint32_t getRdataCount() const
Returns the number of Rdata objects contained in the RRset.
virtual ~BasicRRset()
The destructor.
virtual void setTTL(const RRTTL &ttl)
Updates the TTL of the RRset.
virtual const RRType & getType() const
Returns the RR Type of the RRset.
virtual uint16_t getLength() const
Get the wire format length of the BasicRRset.
virtual const RRClass & getClass() const
Returns the RR Class of the RRset.
virtual const Name & getName() const
Returns the owner name of the RRset.
virtual uint32_t toWire(AbstractMessageRenderer &renderer) const
Render the RRset in the wire format with name compression and truncation handling.
virtual std::string toText() const
Convert the RRset to a string.
A standard DNS module exception that is thrown if an RRset object does not contain any RDATA where re...
The Name class encapsulates DNS names.
void toWire(AbstractMessageRenderer &renderer) const
Render the Name in the wire format with compression.
The RRClass class encapsulates DNS resource record classes.
static const RRClass & ANY()
static const RRClass & NONE()
void toWire(AbstractMessageRenderer &renderer) const
Render the RRClass in the wire format.
The RRTTL class encapsulates TTLs used in DNS resource records.
void toWire(AbstractMessageRenderer &renderer) const
Render the RRTTL in the wire format.
The RRType class encapsulates DNS resource record types.
void toWire(AbstractMessageRenderer &renderer) const
Render the RRType in the wire format.
virtual uint16_t getLength() const
Get the wire format length of the RRset.
RRset(const Name &name, const RRClass &rrclass, const RRType &rrtype, const RRTTL &ttl)
virtual uint32_t toWire(AbstractMessageRenderer &renderer) const
Render the RRset in the wire format with name compression and truncation handling.
virtual uint32_t getRRsigDataCount() const
Returns the number of RRSIG records associated with the RRset.
The RdataIterator class is an abstract base class that provides an interface for accessing RDATA obje...
The Rdata class is an abstract base class that provides a set of common interfaces to manipulate conc...
The OutputBuffer class is a buffer abstraction for manipulating mutable data.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
#define isc_throw_assert(expr)
Replacement for assert() that throws if the expression is false.
boost::shared_ptr< const Rdata > ConstRdataPtr
RdataPtr createRdata(const RRType &rrtype, const RRClass &rrclass, const std::string &rdata_string)
Create RDATA of a given pair of RR type and class from a string.
ostream & operator<<(std::ostream &os, const EDNS &edns)
Insert the EDNS as a string into stream.
boost::shared_ptr< RdataIterator > RdataIteratorPtr
A pointer-like type point to an RdataIterator object.
Defines the logger used by the top-level component of kea-lfc.