Kea 2.5.8
rdata.cc File Reference
#include <config.h>
#include <exceptions/exceptions.h>
#include <exceptions/isc_assert.h>
#include <dns/name.h>
#include <dns/messagerenderer.h>
#include <dns/master_lexer.h>
#include <dns/rdata.h>
#include <dns/rrparamregistry.h>
#include <dns/rrtype.h>
#include <util/buffer.h>
#include <util/encode/encode.h>
#include <boost/lexical_cast.hpp>
#include <boost/shared_ptr.hpp>
#include <algorithm>
#include <cctype>
#include <string>
#include <sstream>
#include <iomanip>
#include <ios>
#include <ostream>
#include <vector>
#include <stdint.h>
#include <string.h>
+ Include dependency graph for rdata.cc:

Go to the source code of this file.

Classes

struct  isc::dns::rdata::generic::GenericImpl
 

Namespaces

namespace  isc
 Defines the logger used by the top-level component of kea-lfc.
 
namespace  isc::dns
 
namespace  isc::dns::rdata
 
namespace  isc::dns::rdata::generic
 

Functions

std::ostream & isc::dns::rdata::generic::operator<< (std::ostream &os, const Generic &rdata)
 Insert the name as a string into stream.
 
Parameterized Polymorphic RDATA Factories

This set of global functions provide a unified interface to create an Rdata object in a parameterized polymorphic way, that is, these functions take a pair of RRType and RRClass objects and data specific to that pair, and create an object of the corresponding concrete derived class of Rdata.

These will be useful when parsing/constructing a DNS message or parsing a master file, where information for a specific type of RDATA is given but the resulting object, once created, should better be used in a polymorphic way.

For example, if a master file parser encounters an NS RR

example.com. 3600 IN NS ns.example.com.

it stores the text fragments "IN", "NS", and "ns.example.com." in std::string objects class_txt, type_txt, and nsname_txt, respectively, then it would create a new RdataPtr object as follows:

RdataPtr rdata = createRdata(RRType(type_txt), RRClass(class_txt),
nsname_txt);
The RRClass class encapsulates DNS resource record classes.
Definition: rrclass.h:89
The RRType class encapsulates DNS resource record types.
Definition: rrtype.h:96
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.
Definition: rdata.cc:54
boost::shared_ptr< Rdata > RdataPtr
The RdataPtr type is a pointer-like type, pointing to an object of some concrete derived class of Rda...

On success, rdata will point to an object of the generic::NS class that internally holds a domain name of "ns.example.com."

Internally, these functions uses the corresponding RRParamRegistry::createRdata methods of the RRParamRegistry. See also the description on these methods for related notes.

int isc::dns::rdata::compareNames (const Name &n1, const Name &n2)
 Gives relative ordering of two names in terms of DNSSEC RDATA ordering.
 
RdataPtr isc::dns::rdata::createRdata (const RRType &rrtype, const RRClass &rrclass, const Rdata &source)
 Create RDATA of a given pair of RR type and class, copying of another RDATA of same kind.
 
RdataPtr isc::dns::rdata::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.
 
RdataPtr isc::dns::rdata::createRdata (const RRType &rrtype, const RRClass &rrclass, isc::util::InputBuffer &buff, size_t len)
 Create RDATA of a given pair of RR type and class from wire-format data.
 
RdataPtr isc::dns::rdata::createRdata (const RRType &rrtype, const RRClass &rrclass, MasterLexer &lexer, const Name *origin, MasterLoader::Options options, MasterLoaderCallbacks &callbacks)
 Create RDATA of a given pair of RR type and class using the master lexer.