Kea 1.5.0
edns.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 EDNS_H
8#define EDNS_H 1
9
10#include <stdint.h>
11
12#include <boost/shared_ptr.hpp>
13
14#include <ostream>
15
16#include <dns/rdata.h>
17
18namespace isc {
19namespace util {
20class OutputBuffer;
21}
22
23namespace dns {
24
25class EDNS;
26class Name;
27class AbstractMessageRenderer;
28class RRClass;
29class RRTTL;
30class RRType;
31class Rcode;
32
34typedef boost::shared_ptr<EDNS> EDNSPtr;
35
37typedef boost::shared_ptr<const EDNS> ConstEDNSPtr;
38
123class EDNS {
124public:
136
137
158 explicit EDNS(const uint8_t version = SUPPORTED_VERSION);
159
214 EDNS(const Name& name, const RRClass& rrclass, const RRType& rrtype,
215 const RRTTL& ttl, const rdata::Rdata& rdata);
217
221
222
225 uint8_t getVersion() const { return (version_); }
226
231 uint16_t getUDPSize() const { return (udp_size_); }
232
246 void setUDPSize(const uint16_t udp_size) { udp_size_ = udp_size; }
247
253 bool getDNSSECAwareness() const { return (dnssec_aware_); }
254
264 void setDNSSECAwareness(const bool is_aware) { dnssec_aware_ = is_aware; }
266
270
271
309 unsigned int toWire(AbstractMessageRenderer& renderer,
310 const uint8_t extended_rcode) const;
311
318 unsigned int toWire(isc::util::OutputBuffer& buffer,
319 const uint8_t extended_rcode) const;
320
342 std::string toText() const;
344
345 // TBD: This method is currently not implemented. We'll eventually need
346 // something like this.
347 //void addOption();
348
349public:
351 static const uint8_t SUPPORTED_VERSION = 0;
352private:
353 // We may eventually want to migrate to pimpl, especially when we support
354 // EDNS options. In this initial implementation, we keep it simple.
355 const uint8_t version_;
356 uint16_t udp_size_;
357 bool dnssec_aware_;
358};
359
416EDNS* createEDNSFromRR(const Name& name, const RRClass& rrclass,
417 const RRType& rrtype, const RRTTL& ttl,
418 const rdata::Rdata& rdata, uint8_t& extended_rcode);
419
430std::ostream& operator<<(std::ostream& os, const EDNS& edns);
431}
432}
433#endif // EDNS_H
434
435// Local Variables:
436// mode: c++
437// End:
The AbstractMessageRenderer class is an abstract base class that provides common interfaces for rende...
The EDNS class represents the EDNS OPT RR defined in RFC2671.
Definition: edns.h:123
void setUDPSize(const uint16_t udp_size)
Specify the maximum payload size of UDP messages that use this EDNS.
Definition: edns.h:246
std::string toText() const
Convert the EDNS to a string.
Definition: edns.cc:92
bool getDNSSECAwareness() const
Returns whether the message sender is DNSSEC aware.
Definition: edns.h:253
void setDNSSECAwareness(const bool is_aware)
Specifies whether the sender of the message containing this EDNS is DNSSEC aware.
Definition: edns.h:264
uint8_t getVersion() const
Returns the version of EDNS.
Definition: edns.h:225
uint16_t getUDPSize() const
Returns the maximum payload size of UDP messages for the sender of the message containing this EDNS.
Definition: edns.h:231
unsigned int toWire(AbstractMessageRenderer &renderer, const uint8_t extended_rcode) const
Render the EDNS in the wire format.
Definition: edns.cc:134
static const uint8_t SUPPORTED_VERSION
The highest EDNS version this implementation supports.
Definition: edns.h:351
The Name class encapsulates DNS names.
Definition: name.h:223
The RRClass class encapsulates DNS resource record classes.
Definition: rrclass.h:98
The RRTTL class encapsulates TTLs used in DNS resource records.
Definition: rrttl.h:55
The RRType class encapsulates DNS resource record types.
Definition: rrtype.h:106
The Rdata class is an abstract base class that provides a set of common interfaces to manipulate conc...
Definition: rdata.h:123
The OutputBuffer class is a buffer abstraction for manipulating mutable data.
Definition: buffer.h:294
int version()
returns Kea hooks version.
ostream & operator<<(std::ostream &os, const EDNS &edns)
Insert the EDNS as a string into stream.
Definition: edns.cc:172
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.
Definition: edns.cc:157
boost::shared_ptr< const EDNS > ConstEDNSPtr
A pointer-like type pointing to an immutable EDNS object.
Definition: edns.h:37
boost::shared_ptr< EDNS > EDNSPtr
A pointer-like type pointing to an EDNS object.
Definition: edns.h:34
Defines the logger used by the top-level component of kea-dhcp-ddns.