7#ifndef MESSAGERENDERER_H
8#define MESSAGERENDERER_H
12#include <boost/noncopyable.hpp>
141 return (buffer_->getData());
146 return (buffer_->getLength());
264 virtual void clear();
270 buffer_->writeUint8(data);
278 buffer_->writeUint16(data);
292 buffer_->writeUint16At(data, pos);
300 buffer_->writeUint32(data);
311 buffer_->writeData(data, len);
357 public boost::noncopyable {
381 virtual void clear();
382 virtual void writeName(
const Name& name,
bool compress =
true);
387 std::unique_ptr<MessageRendererImpl> impl_;
The AbstractMessageRenderer class is an abstract base class that provides common interfaces for rende...
AbstractMessageRenderer()
The default constructor.
virtual void setTruncated()=0
Mark the renderer to indicate truncation has occurred while rendering.
virtual void setLengthLimit(size_t len)=0
Set the maximum length of rendered data that can fit in the corresponding DNS message without truncat...
void trim(size_t len)
Trim the specified length of data from the end of the internal buffer.
virtual void writeName(const LabelSequence &ls, bool compress=true)=0
Write a LabelSequence object into the internal buffer in wire format, with or without name compressio...
size_t getLength() const
Return the length of data written in the internal buffer.
virtual void clear()
Clear the internal buffer and other internal resources.
virtual size_t getLengthLimit() const =0
Return the maximum length of rendered data that can fit in the corresponding DNS message without trun...
virtual void setCompressMode(CompressMode mode)=0
Set the compression mode of the renderer class object.
const void * getData() const
Return a pointer to the head of the data stored in the internal buffer.
virtual ~AbstractMessageRenderer()
The destructor.
virtual CompressMode getCompressMode() const =0
Return the compression mode of the renderer class object.
virtual bool isTruncated() const =0
Return whether truncation has occurred while rendering.
const isc::util::OutputBuffer & getBuffer() const
Return the output buffer we render into.
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 ...
virtual void writeName(const Name &name, bool compress=true)=0
Write a Name object into the internal buffer in wire format, with or without name compression.
void writeUint16(uint16_t data)
Write an unsigned 16-bit integer in host byte order into the internal buffer in network byte order.
CompressMode
Compression mode constants.
@ CASE_SENSITIVE
Compress names case-sensitive manner.
@ CASE_INSENSITIVE
Compress names case-insensitive manner (default)
void setBuffer(isc::util::OutputBuffer *buffer)
Set or reset a temporary output buffer.
void writeUint8(const uint8_t data)
Write an unsigned 8-bit integer into the internal buffer.
void writeUint32(uint32_t data)
Write an unsigned 32-bit integer in host byte order into the internal buffer in network byte order.
void writeData(const void *data, size_t len)
Copy an arbitrary length of data into the internal buffer of the renderer object.
isc::util::OutputBuffer & getBuffer()
Light-weight Accessor to Name data.
The MessageRenderer is a concrete derived class of AbstractMessageRenderer as a general purpose imple...
virtual CompressMode getCompressMode() const
Return the compression mode of the renderer class object.
virtual void setLengthLimit(size_t len)
Set the maximum length of rendered data that can fit in the corresponding DNS message without truncat...
virtual void clear()
Clear the internal buffer and other internal resources.
virtual ~MessageRenderer()
virtual void setTruncated()
Mark the renderer to indicate truncation has occurred while rendering.
virtual bool isTruncated() const
Return whether truncation has occurred while rendering.
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.
virtual size_t getLengthLimit() const
Return the maximum length of rendered data that can fit in the corresponding DNS message without trun...
virtual void setCompressMode(CompressMode mode)
This implementation does not allow this call in the middle of rendering (i.e.
The Name class encapsulates DNS names.
The OutputBuffer class is a buffer abstraction for manipulating mutable data.
Defines the logger used by the top-level component of kea-lfc.
The MessageRendererImpl class is the actual implementation of MessageRenderer.