Kea: rdatafields.h Source File

| Kea 2.2.0

rdatafields.h
Go to the documentation of this file.
1// Copyright (C) 2010-2015 Internet Systems Consortium, Inc. ("ISC")
2//
3// This Source Code Form is subject to the terms of the Mozilla Public
4// License, v. 2.0. If a copy of the MPL was not distributed with this
5// file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7#ifndef RDATAFIELDS_H
8#define RDATAFIELDS_H 1
9
10#include <stdint.h>
11
12#include <cstddef>
13
14namespace isc {
15namespace util {
16class OutputBuffer;
17}
18namespace dns {
19class AbstractMessageRenderer;
20
21namespace rdata {
22class Rdata;
23
83
151 class RdataFields {
152public:
159 enum Type {
160 DATA,
161 COMPRESSIBLE_NAME,
162 INCOMPRESSIBLE_NAME
163 };
164
206 struct FieldSpec {
207 FieldSpec(Type type_param, uint16_t len_param) :
208 type(type_param), len(len_param)
209 {}
210 Type type;
211 uint16_t len;
212 };
213
220
221private:
222 RdataFields(const RdataFields& source);
223 RdataFields& operator=(const RdataFields& source);
224
225public:
247 RdataFields(const Rdata& rdata);
248
295 RdataFields(const void* fields, const unsigned int fields_length,
296 const void* data, const size_t data_length);
297
299 ~RdataFields();
301
305
306
310 unsigned int getDataLength() const { return (data_length_); }
311
317 const void* getData() const { return (data_); }
318
323 unsigned int getFieldSpecDataSize() const { return (nfields_ *
324 sizeof (*fields_)); }
325
331 unsigned int getFieldCount() const { return (nfields_); }
332
353 const void* getFieldSpecData() const {
354 return (fields_);
355 }
356
371 FieldSpec getFieldSpec(const unsigned int field_id) const;
373
377
378
389 void toWire(AbstractMessageRenderer& renderer) const;
390
398 void toWire(isc::util::OutputBuffer& buffer) const;
400
401private:
402 const FieldSpec* fields_;
403 unsigned int nfields_;
404 const uint8_t* data_;
405 size_t data_length_;
406
407 // hide further details within the implementation and don't create vectors
408 // every time we don't need them.
409 struct RdataFieldsDetail;
410 RdataFieldsDetail* detail_;
411};
412}
413}
414}
415#endif // RDATAFIELDS_H
416
417// Local Variables:
418// mode: c++
419// End:
isc::dns::AbstractMessageRenderer
The AbstractMessageRenderer class is an abstract base class that provides common interfaces for rende...
Definition: messagerenderer.h:68
isc::dns::rdata::RdataFields
A low-level, RR type-independent representation of DNS RDATA.
Definition: rdatafields.h:151
isc::dns::rdata::RdataFields::getData
const void * getData() const
Return a pointer to the RDATA encoded in the RdataFields.
Definition: rdatafields.h:317
isc::dns::rdata::RdataFields::~RdataFields
~RdataFields()
The destructor.
Definition: rdatafields.cc:178
isc::dns::rdata::RdataFields::getFieldSpec
FieldSpec getFieldSpec(const unsigned int field_id) const
Return the specification of the field identified by the given index.
Definition: rdatafields.cc:183
isc::dns::rdata::RdataFields::getFieldSpecData
const void * getFieldSpecData() const
Return a pointer to a sequence of FieldSpec for the RdataFields.
Definition: rdatafields.h:353
isc::dns::rdata::RdataFields::getFieldSpecDataSize
unsigned int getFieldSpecDataSize() const
Return the number of bytes the buffer returned by getFieldSpecData() will occupy.
Definition: rdatafields.h:323
isc::dns::rdata::RdataFields::getFieldCount
unsigned int getFieldCount() const
Return the number of specs fields.
Definition: rdatafields.h:331
isc::dns::rdata::RdataFields::Type
Type
Types of RdataFields fields.
Definition: rdatafields.h:159
isc::dns::rdata::RdataFields::INCOMPRESSIBLE_NAME
@ INCOMPRESSIBLE_NAME
A domain name that shouldn't be compressed.
Definition: rdatafields.h:162
isc::dns::rdata::RdataFields::DATA
@ DATA
Plain data.
Definition: rdatafields.h:160
isc::dns::rdata::RdataFields::COMPRESSIBLE_NAME
@ COMPRESSIBLE_NAME
A domain name subject to name compression.
Definition: rdatafields.h:161
isc::dns::rdata::RdataFields::getDataLength
unsigned int getDataLength() const
Return the length of the entire RDATA encoded in the RdataFields in bytes.
Definition: rdatafields.h:310
isc::dns::rdata::RdataFields::toWire
void toWire(AbstractMessageRenderer &renderer) const
Render the RdataFields in the wire format with name compression.
Definition: rdatafields.cc:191
isc::dns::rdata::Rdata
The Rdata class is an abstract base class that provides a set of common interfaces to manipulate conc...
Definition: rdata.h:123
isc::util::OutputBuffer
The OutputBuffer class is a buffer abstraction for manipulating mutable data.
Definition: buffer.h:294
isc
Defines the logger used by the top-level component of kea-lfc.
Definition: agent_parser.cc:143
isc::dns::rdata::RdataFields::FieldSpec
Structure that specifies a single RdataFields field.
Definition: rdatafields.h:206
isc::dns::rdata::RdataFields::FieldSpec::type
Type type
The type of the field.
Definition: rdatafields.h:210
isc::dns::rdata::RdataFields::FieldSpec::FieldSpec
FieldSpec(Type type_param, uint16_t len_param)
Definition: rdatafields.h:207
isc::dns::rdata::RdataFields::FieldSpec::len
uint16_t len
The length of the field in bytes.
Definition: rdatafields.h:211