22#include <boost/lexical_cast.hpp> 
   28using boost::lexical_cast;
 
   46const unsigned int VERSION_SHIFT = 16;
 
   47const unsigned int EXTRCODE_SHIFT = 24;
 
   48const uint32_t VERSION_MASK = 0x00ff0000;
 
   49const uint32_t EXTFLAG_DO = 0x00008000;
 
   54    udp_size_(
Message::DEFAULT_MAX_UDPSIZE),
 
   55    dnssec_aware_(false) {
 
   58                  "failed to construct EDNS: unsupported version: " <<
 
   59                  static_cast<unsigned int>(version_));
 
 
   65    version_((ttl.getValue() & VERSION_MASK) >> VERSION_SHIFT) {
 
   68                  "EDNS is being created with incompatible RR type: " 
   74                  static_cast<unsigned int>(version_));
 
   82    dnssec_aware_ = ((ttl.
getValue() & EXTFLAG_DO) != 0);
 
 
   88    string ret = 
"; EDNS: version: ";
 
   90    ret += lexical_cast<string>(
static_cast<int>(
getVersion()));
 
   95    ret += 
"; udp: " + lexical_cast<string>(
getUDPSize()) + 
"\n";
 
 
  103template <
typename Output>
 
  105toWireCommon(Output& output, 
const uint8_t 
version,
 
  106             const uint16_t udp_size, 
const bool dnssec_aware,
 
  107             const uint8_t extended_rcode) {
 
  109    uint32_t extrcode_flags = extended_rcode << EXTRCODE_SHIFT;
 
  110    extrcode_flags |= (
version << VERSION_SHIFT) & VERSION_MASK;
 
  112        extrcode_flags |= EXTFLAG_DO;
 
  121    edns_rrset->toWire(output);
 
  129             const uint8_t extended_rcode)
 const {
 
  137    return (toWireCommon(renderer, version_, udp_size_, dnssec_aware_,
 
 
  143             const uint8_t extended_rcode)
 const {
 
  144    return (toWireCommon(buffer, version_, udp_size_, dnssec_aware_,
 
 
  152                 uint8_t& extended_rcode) {
 
  157    extended_rcode = ttl.
getValue() >> EXTRCODE_SHIFT;
 
 
static const RRType & OPT()
A generic exception that is thrown if a parameter given to a method or function is considered invalid...
The AbstractMessageRenderer class is an abstract base class that provides common interfaces for rende...
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...
The EDNS class represents the EDNS OPT RR defined in RFC2671.
EDNS(const uint8_t version=SUPPORTED_VERSION)
Constructor with the EDNS version.
std::string toText() const
Convert the EDNS to a string.
bool getDNSSECAwareness() const
Returns whether the message sender is DNSSEC aware.
uint8_t getVersion() const
Returns the version of EDNS.
uint32_t toWire(AbstractMessageRenderer &renderer, const uint8_t extended_rcode) const
Render the EDNS in the wire format.
uint16_t getUDPSize() const
Returns the maximum payload size of UDP messages for the sender of the message containing this EDNS.
static const uint8_t SUPPORTED_VERSION
The highest EDNS version this implementation supports.
The Message class encapsulates a standard DNS message.
The Name class encapsulates DNS names.
static const Name & ROOT_NAME()
Root name (i.e. ".").
The RRClass class encapsulates DNS resource record classes.
uint16_t getCode() const
Returns the RR class code as a 16-bit unsigned integer.
The RRTTL class encapsulates TTLs used in DNS resource records.
uint32_t getValue() const
Returns the TTL value as a 32-bit unsigned integer.
The RRType class encapsulates DNS resource record types.
static const RRType & OPT()
The RRset class is a concrete derived class of BasicRRset which contains a pointer to an additional R...
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.
int version()
returns Kea hooks version.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
boost::shared_ptr< const Rdata > ConstRdataPtr
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.
EDNS * createEDNSFromRR(const Name &name, const RRClass &rrclass, const RRType &rrtype, const RRTTL &ttl, const Rdata &rdata, uint8_t &extended_rcode)
Create a new EDNS object from a set of RR parameters, also providing the extended RCODE value.
Defines the logger used by the top-level component of kea-lfc.