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) {
92 output.writeUint16(0);
100 const size_t pos0 = output.getLength();
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>(
140 return (rrs_written);
206 const size_t pos0 = renderer.
getLength();
215 renderer.
skip(
sizeof(uint16_t));
216 rdata->toWire(renderer);
220 if (limit > 0 && renderer.
getLength() > limit) {
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_);
322 rrlen += it->getCurrent().getLength();
328 }
while (!it->isLast());
340 const uint32_t rrs_written = impl_->toWire(renderer,
342 if (impl_->rdatalist_.size() > rrs_written) {
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);
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...
virtual void setTruncated()=0
Mark the renderer to indicate truncation has occurred while rendering.
void trim(size_t len)
Trim the specified length of data from the end of the internal buffer.
size_t getLength() const
Return the length of data written in the internal buffer.
virtual size_t getLengthLimit() const =0
Return the maximum length of rendered data that can fit in the corresponding DNS message without trun...
void skip(size_t len)
Insert a specified length of gap at the end of the buffer.
void writeUint16At(uint16_t data, size_t pos)
Write an unsigned 16-bit integer in host byte order at the specified position of the internal buffer ...
void writeUint16(uint16_t data)
Write an unsigned 16-bit integer in host byte order into the internal buffer in network byte order.
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.
std::string toText(bool omit_final_dot=false) const
Convert the Name to a string.
void toWire(AbstractMessageRenderer &renderer) const
Render the Name in the wire format with compression.
size_t getLength() const
Gets the length of the Name in its wire format.
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.
const std::string toText() const
Convert the RRClass to a string.
The RRTTL class encapsulates TTLs used in DNS resource records.
void toWire(AbstractMessageRenderer &renderer) const
Render the RRTTL in the wire format.
const std::string toText() const
Convert the RRTTL to a string.
The RRType class encapsulates DNS resource record types.
void toWire(AbstractMessageRenderer &renderer) const
Render the RRType in the wire format.
const std::string toText() const
Convert the RRType to a string.
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.