18using namespace isc::dns;
21 : message_(direction ==
INBOUND ?
40 return (message_.getQid());
51 return (message_.getRcode());
56 message_.setRcode(rcode);
61 return (message_.getRRCount(ddnsToDnsSection(section)));
66 return (message_.beginSection(ddnsToDnsSection(section)));
71 return (message_.endSection(ddnsToDnsSection(section)));
84 message_.addQuestion(question);
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()));
175D2UpdateMessage::ddnsToDnsSection(
const UpdateMsgSection section) {
196 "unknown message section " << section);
200D2UpdateMessage::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");
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
A generic exception that is thrown when an unexpected error condition occurs.
D2ZonePtr getZone() const
Returns a pointer to the object representing Zone record.
void setId(const uint16_t id)
Sets message ID.
UpdateMsgSection
Identifies sections in the DNS Update Message.
QRFlag
Indicates whether DNS Update message is a REQUEST or RESPONSE.
unsigned int getRRCount(const UpdateMsgSection section) const
Returns number of RRsets in the specified message section.
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 fromWire(const void *received_data, size_t bytes_received, dns::TSIGContext *const tsig_context=NULL)
Decode incoming message from the wire format.
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.
void toWire(dns::AbstractMessageRenderer &renderer, dns::TSIGContext *const tsig_ctx=NULL)
Encode outgoing message into wire format.
Direction
Indicates if the D2UpdateMessage object encapsulates Inbound or Outbound message.
QRFlag getQRFlag() const
Returns enum value indicating if the message is a REQUEST or RESPONSE.
void setRcode(const dns::Rcode &rcode)
Sets message RCode.
D2UpdateMessage(const Direction direction=OUTBOUND)
Constructor used to create an instance of the DNS Update Message (either outgoing or incoming).
uint16_t getId() const
Returns message ID.
void addRRset(const UpdateMsgSection section, const dns::RRsetPtr &rrset)
Adds an RRset to the specified section.
void setZone(const dns::Name &zone, const dns::RRClass &rrclass)
Sets the Zone record.
const dns::Rcode & getRcode() const
Returns an object representing message RCode.
D2Zone(const dns::Name &name, const dns::RRClass &rrclass)
Constructor from Name and RRClass.
Exception indicating that QR flag has invalid value.
Exception indicating that Zone section contains invalid content.
Exception indicating that a signed, inbound message failed to verify.
The AbstractMessageRenderer class is an abstract base class that provides common interfaces for rende...
A standard DNS module exception that is thrown if a section iterator is being constructed for an inco...
The Message class encapsulates a standard DNS message.
Section
Constants to specify sections of a DNS message.
const Opcode & getOpcode() const
Return the OPCODE given in the header section of the message.
The Name class encapsulates DNS names.
static const Opcode & UPDATE()
A constant object for the UPDATE Opcode.
Opcode(const uint8_t code)
Constructor from the code value.
CodeValue getCode() const
Returns the Opcode code value.
@ UPDATE_CODE
5: Dynamic update (RFC2136)
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.
const RRClass & getClass() const
Returns the RR Type of the Question.
The RRClass class encapsulates DNS resource record classes.
static const RRType & SOA()
DNS Response Codes (RCODEs) class.
static const Rcode & NOERROR()
A constant object for the NOERROR Rcode (see Rcode::NOERROR_CODE).
virtual TSIGError verify(const TSIGRecord *const record, const void *const data, const size_t data_len)
Verify a DNS message.
static const TSIGError & NOERROR()
A constant TSIG error object derived from Rcode::NOERROR().
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
boost::shared_ptr< D2Zone > D2ZonePtr
boost::shared_ptr< Question > QuestionPtr
A pointer-like type pointing to an Question object.
boost::shared_ptr< AbstractRRset > RRsetPtr
A pointer-like type pointing to an RRset object.
SectionIterator< RRsetPtr > RRsetIterator
Defines the logger used by the top-level component of kea-lfc.