13#include <boost/shared_ptr.hpp>
14#include <boost/foreach.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();
101 assert(pos0 < 65536);
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 unsigned int rrs_written = rrsetToWire<AbstractMessageRenderer>(
140 return (rrs_written);
206 const size_t pos0 = renderer.
getLength();
207 assert(pos0 < 65536);
215 renderer.
skip(
sizeof(uint16_t));
216 rdata->toWire(renderer);
220 if (limit > 0 && renderer.
getLength() > limit) {
263 return (impl_->
name_);
278 return (impl_->
ttl_);
324 rrlen += it->getCurrent().getLength();
326 assert(length + rrlen < 65536);
330 }
while (!it->isLast());
342 const unsigned int rrs_written = impl_->
toWire(renderer,
347 return (rrs_written);
362 return (rrsig_->getRdataCount());
373 const uint16_t rrsigs_length = rrsig_->getLength();
376 assert(length + rrsigs_length < 65536);
377 length += rrsigs_length;
387 return (rrs_written);
391 rrs_written += rrsig_->toWire(buffer);
394 return (rrs_written);
401 return (rrs_written);
405 rrs_written += rrsig_->toWire(renderer);
412 return (rrs_written);
420 BasicRdataIterator(
const std::vector<rdata::ConstRdataPtr>& datavector) :
421 datavector_(&datavector), it_(datavector_->begin()) {}
424 ~BasicRdataIterator() {}
427 virtual void first() {
428 it_ = datavector_->begin();
432 virtual void next() {
446 virtual bool isLast()
const {
447 return (it_ == datavector_->end());
452 const std::vector<rdata::ConstRdataPtr>* datavector_;
455 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 unsigned int 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 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 unsigned int getRdataCount() const =0
Returns the number of Rdata objects contained in the RRset.
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.
unsigned int toWire(AbstractMessageRenderer &renderer, size_t limit) const
BasicRRsetImpl(const Name &name, const RRClass &rrclass, const RRType &rrtype, const RRTTL &ttl)
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 unsigned int getRdataCount() const
Returns the number of Rdata objects contained in the RRset.
virtual void addRdata(rdata::ConstRdataPtr rdata)
Add an RDATA to the RRset (pointer version).
virtual unsigned int toWire(AbstractMessageRenderer &renderer) const
Render the RRset in the wire format with name compression and truncation handling.
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 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.
virtual unsigned int toWire(AbstractMessageRenderer &renderer) const
Render the RRset in the wire format with name compression and truncation handling.
RRset(const Name &name, const RRClass &rrclass, const RRType &rrtype, const RRTTL &ttl)
virtual unsigned int 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.
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.
boost::shared_ptr< AbstractRRset > RRsetPtr
A pointer-like type pointing to an RRset object.
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.