Kea
1.9.9-git
|
The MessageRenderer
is a concrete derived class of AbstractMessageRenderer
as a general purpose implementation of the renderer interfaces.
More...
#include <messagerenderer.h>
Classes | |
struct | MessageRendererImpl |
The MessageRendererImpl class is the actual implementation of MessageRenderer . More... | |
Public Member Functions | |
MessageRenderer () | |
virtual | ~MessageRenderer () |
virtual void | clear () |
Clear the internal buffer and other internal resources. More... | |
virtual CompressMode | getCompressMode () const |
Return the compression mode of the renderer class object. More... | |
virtual size_t | getLengthLimit () const |
Return the maximum length of rendered data that can fit in the corresponding DNS message without truncation. More... | |
virtual bool | isTruncated () const |
Return whether truncation has occurred while rendering. More... | |
virtual void | setCompressMode (CompressMode mode) |
This implementation does not allow this call in the middle of rendering (i.e. More... | |
virtual void | setLengthLimit (size_t len) |
Set the maximum length of rendered data that can fit in the corresponding DNS message without truncation. More... | |
virtual void | setTruncated () |
Mark the renderer to indicate truncation has occurred while rendering. More... | |
virtual void | writeName (const Name &name, bool compress=true) |
Write a Name object into the internal buffer in wire format, with or without name compression. More... | |
virtual void | writeName (const LabelSequence &ls, bool compress=true) |
Write a LabelSequence object into the internal buffer in wire format, with or without name compression. More... | |
Public Member Functions inherited from isc::dns::AbstractMessageRenderer | |
const void * | getData () const |
Return a pointer to the head of the data stored in the internal buffer. More... | |
size_t | getLength () const |
Return the length of data written in the internal buffer. More... | |
void | setBuffer (isc::util::OutputBuffer *buffer) |
Set or reset a temporary output buffer. More... | |
void | skip (size_t len) |
Insert a specified length of gap at the end of the buffer. More... | |
void | trim (size_t len) |
Trim the specified length of data from the end of the internal buffer. More... | |
void | writeUint8 (const uint8_t data) |
Write an unsigned 8-bit integer into the internal buffer. More... | |
void | writeUint16 (uint16_t data) |
Write an unsigned 16-bit integer in host byte order into the internal buffer in network byte order. More... | |
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 in network byte order. More... | |
void | writeUint32 (uint32_t data) |
Write an unsigned 32-bit integer in host byte order into the internal buffer in network byte order. More... | |
void | writeData (const void *data, size_t len) |
Copy an arbitrary length of data into the internal buffer of the renderer object. More... | |
virtual | ~AbstractMessageRenderer () |
The destructor. More... | |
Additional Inherited Members | |
Public Types inherited from isc::dns::AbstractMessageRenderer | |
enum | CompressMode { CASE_INSENSITIVE, CASE_SENSITIVE } |
Compression mode constants. More... | |
Protected Member Functions inherited from isc::dns::AbstractMessageRenderer | |
const isc::util::OutputBuffer & | getBuffer () const |
Return the output buffer we render into. More... | |
isc::util::OutputBuffer & | getBuffer () |
AbstractMessageRenderer () | |
The default constructor. More... | |
The MessageRenderer
is a concrete derived class of AbstractMessageRenderer
as a general purpose implementation of the renderer interfaces.
A MessageRenderer
object is constructed with a OutputBuffer
object, which is the buffer into which the rendered data will be written. Normally the buffer is expected to be empty on construction, but it doesn't have to be so; the renderer object will start rendering from the end of the buffer at the time of construction. However, if the pre-existing portion of the buffer contains DNS names, these names won't be considered for name compression.
Definition at line 356 of file messagerenderer.h.
isc::dns::MessageRenderer::MessageRenderer | ( | ) |
Definition at line 221 of file messagerenderer.cc.
|
virtual |
Definition at line 226 of file messagerenderer.cc.
|
virtual |
Clear the internal buffer and other internal resources.
This method can be used to re-initialize and reuse the renderer without constructing a new one.
Reimplemented from isc::dns::AbstractMessageRenderer.
Definition at line 231 of file messagerenderer.cc.
References isc::dns::MessageRenderer::MessageRendererImpl::BUCKETS, isc::dns::AbstractMessageRenderer::CASE_INSENSITIVE, isc::dns::AbstractMessageRenderer::clear(), isc::dns::MessageRenderer::MessageRendererImpl::compress_mode_, isc::dns::MessageRenderer::MessageRendererImpl::msglength_limit_, isc::dns::MessageRenderer::MessageRendererImpl::RESERVED_ITEMS, isc::dns::MessageRenderer::MessageRendererImpl::table_, and isc::dns::MessageRenderer::MessageRendererImpl::truncated_.
|
virtual |
Return the compression mode of the renderer class object.
This method never throws an exception.
Implements isc::dns::AbstractMessageRenderer.
Definition at line 272 of file messagerenderer.cc.
References isc::dns::MessageRenderer::MessageRendererImpl::compress_mode_.
|
virtual |
Return the maximum length of rendered data that can fit in the corresponding DNS message without truncation.
This method never throws an exception.
Implements isc::dns::AbstractMessageRenderer.
Definition at line 252 of file messagerenderer.cc.
References isc::dns::MessageRenderer::MessageRendererImpl::msglength_limit_.
|
virtual |
Return whether truncation has occurred while rendering.
Once the return value of this method is true
, it doesn't make sense to try rendering more data, although this class itself doesn't reject the attempt.
This method never throws an exception.
false
. Implements isc::dns::AbstractMessageRenderer.
Definition at line 262 of file messagerenderer.cc.
References isc::dns::MessageRenderer::MessageRendererImpl::truncated_.
|
virtual |
This implementation does not allow this call in the middle of rendering (i.e.
after at least one name is rendered) due to restriction specific to the internal implementation. Such attempts will result in an isc::InvalidParameter
exception.
This shouldn't be too restrictive in practice; there's no known practical case for such a mixed compression policy in a single message.
Implements isc::dns::AbstractMessageRenderer.
Definition at line 277 of file messagerenderer.cc.
References isc::dns::MessageRenderer::MessageRendererImpl::compress_mode_, isc::dns::AbstractMessageRenderer::getLength(), and isc_throw.
|
virtual |
Set the maximum length of rendered data that can fit in the corresponding DNS message without truncation.
This method never throws an exception.
len | The maximum length in bytes. |
Implements isc::dns::AbstractMessageRenderer.
Definition at line 257 of file messagerenderer.cc.
References isc::dns::MessageRenderer::MessageRendererImpl::msglength_limit_.
|
virtual |
Mark the renderer to indicate truncation has occurred while rendering.
This method never throws an exception.
Implements isc::dns::AbstractMessageRenderer.
Definition at line 267 of file messagerenderer.cc.
References isc::dns::MessageRenderer::MessageRendererImpl::truncated_.
|
virtual |
Write a Name
object into the internal buffer in wire format, with or without name compression.
If the optional parameter compress
is true
, this method tries to compress the name
if possible, searching the entire message that has been rendered. Otherwise name compression is omitted. Its default value is true
.
Note: even if compress
is true
, the position of the name
(and possibly its ancestor names) in the message is recorded and may be used for compressing subsequent names.
name | A Name object to be written. |
compress | A boolean indicating whether to enable name compression. |
Implements isc::dns::AbstractMessageRenderer.
Definition at line 360 of file messagerenderer.cc.
|
virtual |
Write a LabelSequence
object into the internal buffer in wire format, with or without name compression.
This is the same as the other version, which takes Name
instead of LabelSequence
, except for the parameter type. The passed LabelSequence
must be absolute.
ls | A LabelSequence object to be written. |
compress | A boolean indicating whether to enable name compression. |
Implements isc::dns::AbstractMessageRenderer.
Definition at line 286 of file messagerenderer.cc.
References isc::dns::MessageRenderer::MessageRendererImpl::addOffset(), isc::dns::AbstractMessageRenderer::CASE_SENSITIVE, isc::dns::MessageRenderer::MessageRendererImpl::compress_mode_, isc::dns::Name::COMPRESS_POINTER_MARK16, isc::dns::MessageRenderer::MessageRendererImpl::findOffset(), isc::dns::AbstractMessageRenderer::getBuffer(), isc::dns::LabelSequence::getData(), isc::dns::LabelSequence::getDataLength(), isc::dns::LabelSequence::getHash(), isc::dns::LabelSequence::getLabelCount(), isc::dns::AbstractMessageRenderer::getLength(), isc::dns::Name::MAX_COMPRESS_POINTER, isc::dns::MessageRenderer::MessageRendererImpl::NO_OFFSET, isc::dns::MessageRenderer::MessageRendererImpl::seq_hashes_, isc::dns::LabelSequence::stripLeft(), isc::dns::LabelSequence::stripRight(), isc::dns::AbstractMessageRenderer::writeData(), and isc::dns::AbstractMessageRenderer::writeUint16().