21 : message_(direction == INBOUND ?
40 return (message_.
getQid());
61 return (message_.
getRRCount(ddnsToDnsSection(section)));
66 return (message_.
beginSection(ddnsToDnsSection(section)));
71 return (message_.
endSection(ddnsToDnsSection(section)));
99 " of the DNS Update message, use setZone instead");
101 message_.
addRRset(ddnsToDnsSection(section), rrset);
112 " DNS Update message");
118 " must comprise exactly one record (RFC2136, section 2.3)");
120 message_.
toWire(renderer, tsig_context);
131 message_.
fromWire(received_data_buffer);
136 received_data, bytes_received);
158 zone_.reset(
new D2Zone(question->getName(), question->getClass()));
175 D2UpdateMessage::ddnsToDnsSection(
const UpdateMsgSection section) {
196 "unknown message section " << section);
200 D2UpdateMessage::validateResponse()
const {
207 isc_throw(NotUpdateMessage,
"received message is not a DDNS update,"
208 <<
" received message code is "
214 isc_throw(InvalidQRFlag,
"received message should have QR flag set,"
215 " to indicate that it is a RESPONSE message; the QR"
216 <<
" flag in received message is unset");
223 isc_throw(InvalidZoneSection,
"received message contains "
225 <<
" it should contain at most 1 record");
The Name class encapsulates DNS names.
const RRsetIterator endSection(const Section section) const
Return an iterator corresponding to the end of the given section (other than Question) of the message...
const Rcode & getRcode() const
Return the Response Code of the message.
void toWire(AbstractMessageRenderer &renderer, TSIGContext *tsig_ctx=NULL)
Render the message in wire formant into a message renderer object with (or without) TSIG...
uint16_t getId() const
Returns message ID.
Exception indicating that QR flag has invalid value.
const QuestionIterator beginQuestion() const
Return an iterator corresponding to the beginning of the Question section of the message.
The Question class encapsulates the common search key of DNS lookup, consisting of owner name...
const Name & getName() const
Returns the owner name of the Question.
static const Rcode & NOERROR()
A constant object for the NOERROR Rcode (see Rcode::NOERROR_CODE).
5: Dynamic update (RFC2136)
void toWire(dns::AbstractMessageRenderer &renderer, dns::TSIGContext *const tsig_ctx=NULL)
Encode outgoing message into wire format.
static const RRType & SOA()
qid_t getQid() const
Return the query ID given in the header section of the message.
const dns::RRsetIterator beginSection(const UpdateMsgSection section) const
Return iterators pointing to the beginning of the list of RRsets, which belong to the specified secti...
void clearSection(const Section section)
Remove all RRSets from the given Section.
boost::shared_ptr< D2Zone > D2ZonePtr
void setRcode(const Rcode &rcode)
Set the Response Code of the message.
QRFlag getQRFlag() const
Returns enum value indicating if the message is a REQUEST or RESPONSE.
DNS Response Codes (RCODEs) class.
void setHeaderFlag(const HeaderFlag flag, const bool on=true)
Set or clear the specified header flag bit in the header section.
void fromWire(const void *received_data, size_t bytes_received, dns::TSIGContext *const tsig_context=NULL)
Decode incoming message from the wire format.
const Opcode & getOpcode() const
Return the OPCODE given in the header section of the message.
The Message class encapsulates a standard DNS message.
void setRcode(const dns::Rcode &rcode)
Sets message RCode.
The RRClass class encapsulates DNS resource record classes.
Exception indicating that Zone section contains invalid content.
static const Opcode & UPDATE()
A constant object for the UPDATE Opcode.
void setZone(const dns::Name &zone, const dns::RRClass &rrclass)
Sets the Zone record.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
A standard DNS module exception that is thrown if a section iterator is being constructed for an inco...
void fromWire(isc::util::InputBuffer &buffer, ParseOptions options=PARSE_DEFAULT)
(Re)build a Message object from wire-format data.
The AbstractMessageRenderer class is an abstract base class that provides common interfaces for rende...
void addQuestion(QuestionPtr question)
Add a (pointer like object of) Question to the message.
void addRRset(const UpdateMsgSection section, const dns::RRsetPtr &rrset)
Adds an RRset to the specified section.
A generic exception that is thrown when an unexpected error condition occurs.
The D2Zone encapsulates the Zone section in DNS Update message.
bool getHeaderFlag(const HeaderFlag flag) const
Return whether the specified header flag bit is set in the header section.
D2UpdateMessage(const Direction direction=OUTBOUND)
Constructor used to create an instance of the DNS Update Message (either outgoing or incoming)...
QRFlag
Indicates whether DNS Update message is a REQUEST or RESPONSE.
Query (if cleared) or response (if set)
CodeValue getCode() const
Returns the Opcode code value.
const dns::RRsetIterator endSection(const UpdateMsgSection section) const
Return iterators pointing to the end of the list of RRsets, which belong to the specified section...
const RRClass & getClass() const
Returns the RR Type of the Question.
Defines the logger used by the top-level component of kea-dhcp-ddns.
const RRsetIterator beginSection(const Section section) const
Return an iterator corresponding to the beginning of the given section (other than Question) of the m...
SectionIterator is a templated class to provide standard-compatible iterators for Questions and RRset...
unsigned int getRRCount(const Section section) const
Returns the number of RRs contained in the given section.
void setOpcode(const Opcode &opcode)
Set the OPCODE of the header section of the message.
Section
Constants to specify sections of a DNS message.
std::string toText() const
Convert the TSIGError to a string.
UpdateMsgSection
Identifies sections in the DNS Update Message.
void setId(const uint16_t id)
Sets message ID.
const TSIGRecord * getTSIGRecord() const
Return, if any, the TSIG record contained in the received message.
void setQid(qid_t qid)
Set the query ID of the header section of the message.
Direction
Indicates if the D2UpdateMessage object encapsulates Inbound or Outbound message. ...
D2ZonePtr getZone() const
Returns a pointer to the object representing Zone record.
TSIGError verify(const TSIGRecord *const record, const void *const data, const size_t data_len)
Verify a DNS message.
const dns::Rcode & getRcode() const
Returns an object representing message RCode.
boost::shared_ptr< AbstractRRset > RRsetPtr
A pointer-like type pointing to an RRset object.
unsigned int getRRCount(const UpdateMsgSection section) const
Returns number of RRsets in the specified message section.
Exception indicating that a signed, inbound message failed to verify.
The Opcode class objects represent standard OPCODEs of the header section of DNS messages as defined ...
boost::shared_ptr< Question > QuestionPtr
A pointer-like type pointing to an Question object.
void addRRset(const Section section, RRsetPtr rrset)
Add a (pointer like object of) RRset to the given section of the message.
static const TSIGError & NOERROR()
A constant TSIG error object derived from Rcode::NOERROR()