Kea 2.7.5
edns.h
Go to the documentation of this file.
1// Copyright (C) 2010-2024 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
9
10#include <util/buffer.h>
11
12#include <stdint.h>
13
14#include <boost/shared_ptr.hpp>
15
16#include <ostream>
17
18#include <dns/rdata.h>
19
20namespace isc {
21namespace dns {
22
23class EDNS;
24class Name;
25class AbstractMessageRenderer;
26class RRClass;
27class RRTTL;
28class RRType;
29class Rcode;
30
32typedef boost::shared_ptr<EDNS> EDNSPtr;
33
35typedef boost::shared_ptr<const EDNS> ConstEDNSPtr;
36
121class EDNS {
122public:
134
135
156 explicit EDNS(const uint8_t version = SUPPORTED_VERSION);
157
212 EDNS(const Name& name, const RRClass& rrclass, const RRType& rrtype,
213 const RRTTL& ttl, const rdata::Rdata& rdata);
215
219
220
223 uint8_t getVersion() const { return (version_); }
224
229 uint16_t getUDPSize() const { return (udp_size_); }
230
244 void setUDPSize(const uint16_t udp_size) { udp_size_ = udp_size; }
245
251 bool getDNSSECAwareness() const { return (dnssec_aware_); }
252
262 void setDNSSECAwareness(const bool is_aware) { dnssec_aware_ = is_aware; }
264
268
269
307 uint32_t toWire(AbstractMessageRenderer& renderer,
308 const uint8_t extended_rcode) const;
309
316 uint32_t toWire(isc::util::OutputBuffer& buffer,
317 const uint8_t extended_rcode) const;
318
340 std::string toText() const;
342
343 // TBD: This method is currently not implemented. We'll eventually need
344 // something like this.
345 //void addOption();
346
347public:
349 static const uint8_t SUPPORTED_VERSION = 0;
350private:
351 // We may eventually want to migrate to pimpl, especially when we support
352 // EDNS options. In this initial implementation, we keep it simple.
353 const uint8_t version_;
354 uint16_t udp_size_;
355 bool dnssec_aware_;
356};
357
414EDNS* createEDNSFromRR(const Name& name, const RRClass& rrclass,
415 const RRType& rrtype, const RRTTL& ttl,
416 const rdata::Rdata& rdata, uint8_t& extended_rcode);
417
428std::ostream& operator<<(std::ostream& os, const EDNS& edns);
429}
430}
431#endif // EDNS_H
int version()
returns Kea hooks version.
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:121
void setUDPSize(const uint16_t udp_size)
Specify the maximum payload size of UDP messages that use this EDNS.
Definition edns.h:244
EDNS(const uint8_t version=SUPPORTED_VERSION)
Constructor with the EDNS version.
Definition edns.cc:52
std::string toText() const
Convert the EDNS to a string.
Definition edns.cc:87
bool getDNSSECAwareness() const
Returns whether the message sender is DNSSEC aware.
Definition edns.h:251
void setDNSSECAwareness(const bool is_aware)
Specifies whether the sender of the message containing this EDNS is DNSSEC aware.
Definition edns.h:262
uint8_t getVersion() const
Returns the version of EDNS.
Definition edns.h:223
uint32_t toWire(AbstractMessageRenderer &renderer, const uint8_t extended_rcode) const
Render the EDNS in the wire format.
Definition edns.cc:128
uint16_t getUDPSize() const
Returns the maximum payload size of UDP messages for the sender of the message containing this EDNS.
Definition edns.h:229
static const uint8_t SUPPORTED_VERSION
The highest EDNS version this implementation supports.
Definition edns.h:349
The Name class encapsulates DNS names.
Definition name.h:219
The RRClass class encapsulates DNS resource record classes.
Definition rrclass.h:89
The RRTTL class encapsulates TTLs used in DNS resource records.
Definition rrttl.h:51
The RRType class encapsulates DNS resource record types.
Definition rrtype.h:96
The Rdata class is an abstract base class that provides a set of common interfaces to manipulate conc...
Definition rdata.h:120
The OutputBuffer class is a buffer abstraction for manipulating mutable data.
Definition buffer.h:343
ostream & operator<<(std::ostream &os, const EDNS &edns)
Insert the EDNS as a string into stream.
Definition edns.cc:163
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:149
boost::shared_ptr< const EDNS > ConstEDNSPtr
A pointer-like type pointing to an immutable EDNS object.
Definition edns.h:35
boost::shared_ptr< EDNS > EDNSPtr
A pointer-like type pointing to an EDNS object.
Definition edns.h:32
Defines the logger used by the top-level component of kea-lfc.