Kea 2.7.5
isc::dhcp_ddns::NameChangeRequest Class Reference

Represents a DHCP-DDNS client request. More...

#include <ncr_msg.h>

Public Member Functions

 NameChangeRequest ()
 Default Constructor.
 
 NameChangeRequest (const NameChangeType change_type, const bool forward_change, const bool reverse_change, const std::string &fqdn, const std::string &ip_address, const D2Dhcid &dhcid, const uint64_t lease_expires_on, const uint32_t lease_length, const ConflictResolutionMode conflict_resolution_mode=CHECK_WITH_DHCID)
 Constructor.
 
NameChangeType getChangeType () const
 Fetches the request change type.
 
ConflictResolutionMode getConflictResolutionMode () const
 Fetches the conflict resolution mode.
 
const D2DhcidgetDhcid () const
 Fetches the request DHCID.
 
isc::data::ConstElementPtr getElement (const std::string &name, const ElementMap &element_map) const
 Given a name, finds and returns an element from a map of elements.
 
const std::string getFqdn () const
 Fetches the request FQDN.
 
std::string getIpAddress () const
 Fetches the request IP address string.
 
const asiolink::IOAddressgetIpIoAddress () const
 Fetches the request IP address as an IOAddress.
 
uint64_t getLeaseExpiresOn () const
 Fetches the request lease expiration.
 
std::string getLeaseExpiresOnStr () const
 Fetches the request lease expiration as string.
 
uint32_t getLeaseLength () const
 Fetches the request lease length.
 
std::string getRequestId () const
 Fetches the request ID.
 
NameChangeStatus getStatus () const
 Fetches the request status.
 
bool isForwardChange () const
 Checks forward change flag.
 
bool isReverseChange () const
 Checks reverse change flag.
 
bool isV4 () const
 Returns true if the lease address is a IPv4 lease.
 
bool isV6 () const
 Returns true if the lease address is a IPv6 lease.
 
bool operator!= (const NameChangeRequest &b) const
 
bool operator== (const NameChangeRequest &b) const
 
void setChangeType (const NameChangeType value)
 Sets the change type to the given value.
 
void setChangeType (isc::data::ConstElementPtr element)
 Sets the change type to the value of the given Element.
 
void setConflictResolutionMode (const ConflictResolutionMode value)
 Sets the conflict resolution mode to the given value.
 
void setConflictResolutionMode (isc::data::ConstElementPtr element)
 Sets the conflict resolution mode to the value of the given Element.
 
void setDhcid (const std::string &value)
 Sets the DHCID based on the given string value.
 
void setDhcid (isc::data::ConstElementPtr element)
 Sets the DHCID based on the value of the given Element.
 
void setForwardChange (const bool value)
 Sets the forward change flag to the given value.
 
void setForwardChange (isc::data::ConstElementPtr element)
 Sets the forward change flag to the value of the given Element.
 
void setFqdn (const std::string &value)
 Sets the FQDN to the given value.
 
void setFqdn (isc::data::ConstElementPtr element)
 Sets the FQDN to the value of the given Element.
 
void setIpAddress (const std::string &value)
 Sets the IP address to the given value.
 
void setIpAddress (isc::data::ConstElementPtr element)
 Sets the IP address to the value of the given Element.
 
void setLeaseExpiresOn (const std::string &value)
 Sets the lease expiration based on the given string.
 
void setLeaseExpiresOn (isc::data::ConstElementPtr element)
 Sets the lease expiration based on the given Element.
 
void setLeaseLength (const uint32_t value)
 Sets the lease length to the given value.
 
void setLeaseLength (isc::data::ConstElementPtr element)
 Sets the lease length to the value of the given Element.
 
void setReverseChange (const bool value)
 Sets the reverse change flag to the given value.
 
void setReverseChange (isc::data::ConstElementPtr element)
 Sets the reverse change flag to the value of the given Element.
 
void setStatus (const NameChangeStatus value)
 Sets the request status to the given value.
 
void toFormat (const NameChangeFormat format, isc::util::OutputBuffer &buffer) const
 Instance method for marshalling the contents of the request into the given buffer in the given format.
 
std::string toJSON () const
 Instance method for marshalling the contents of the request into a string of JSON text.
 
std::string toText () const
 Returns a text rendition of the contents of the request.
 
void translateUseConflictResolution (isc::data::ConstElementPtr element)
 Sets the conflict resolution mode based on the value of the given boolean Element.
 
void validateContent ()
 Validates the content of a populated request.
 

Static Public Member Functions

static NameChangeRequestPtr fromFormat (const NameChangeFormat format, isc::util::InputBuffer &buffer)
 Static method for creating a NameChangeRequest from a buffer containing a marshalled request in a given format.
 
static NameChangeRequestPtr fromJSON (const std::string &json)
 Static method for creating a NameChangeRequest from a string containing a JSON rendition of a request.
 

Detailed Description

Represents a DHCP-DDNS client request.

This class is used by DHCP-DDNS clients (e.g. DHCP4, DHCP6) to request DNS updates. Each message contains a single DNS change (either an add/update or a remove) for a single FQDN. It provides marshalling services for moving instances to and from the wire. Currently, the only format supported is JSON detailed here isc::dhcp_ddns::NameChangeRequest::fromJSON The class provides an interface such that other formats can be readily supported.

Definition at line 254 of file ncr_msg.h.

Constructor & Destructor Documentation

◆ NameChangeRequest() [1/2]

isc::dhcp_ddns::NameChangeRequest::NameChangeRequest ( )

Default Constructor.

Todo
Currently, fromWire makes use of the ability to create an empty NameChangeRequest and then builds it bit by bit. This means that it is technically possible to create one and attempt to use in ways other than intended and its invalid content may or may not be handled gracefully by consuming code. It might be wise to revisit this structuring such that we do not use a default constructor and only allow valid instantiations.

Definition at line 265 of file ncr_msg.cc.

Referenced by fromJSON().

◆ NameChangeRequest() [2/2]

isc::dhcp_ddns::NameChangeRequest::NameChangeRequest ( const NameChangeType change_type,
const bool forward_change,
const bool reverse_change,
const std::string & fqdn,
const std::string & ip_address,
const D2Dhcid & dhcid,
const uint64_t lease_expires_on,
const uint32_t lease_length,
const ConflictResolutionMode conflict_resolution_mode = CHECK_WITH_DHCID )

Constructor.

Full constructor, which provides parameters for all of the class members, except status.

Parameters
change_typethe type of change (Add or Update)
forward_changeindicates if this change should be sent to forward DNS servers.
reverse_changeindicates if this change should be sent to reverse DNS servers.
fqdnthe domain name whose pointer record(s) should be updated.
ip_addressthe ip address leased to the given FQDN.
dhcidthe lease client's unique DHCID.
lease_expires_ona timestamp containing the date/time the lease expires.
lease_lengththe amount of time in seconds for which the lease is valid (TTL).
conflict_resolution_modeconflict resolution mode to use, defaults to CHECK_WITH_DHCID. (per RFC 4703) is enabled.

Definition at line 273 of file ncr_msg.cc.

References setFqdn(), setIpAddress(), and validateContent().

+ Here is the call graph for this function:

Member Function Documentation

◆ fromFormat()

NameChangeRequestPtr isc::dhcp_ddns::NameChangeRequest::fromFormat ( const NameChangeFormat format,
isc::util::InputBuffer & buffer )
static

Static method for creating a NameChangeRequest from a buffer containing a marshalled request in a given format.

When the format is:

JSON: The buffer is expected to contain a two byte unsigned integer which specified the length of the JSON text; followed by the JSON text itself. This method attempts to extract "length" characters from the buffer. This data is used to create a character string that is than treated as JSON which is then parsed into the data needed to create a request instance.

(NOTE currently only JSON is supported.)

Parameters
formatindicates the data format to use
bufferis the input buffer containing the marshalled request
Returns
a pointer to the new NameChangeRequest
Exceptions
NcrMessageErrorif an error occurs creating new request.

Definition at line 299 of file ncr_msg.cc.

References isc::dhcp_ddns::FMT_JSON, fromJSON(), isc_throw, and isc::Exception::what().

Referenced by isc::dhcp_ddns::NameChangeUDPListener::receiveCompletionHandler().

+ Here is the call graph for this function:

◆ fromJSON()

NameChangeRequestPtr isc::dhcp_ddns::NameChangeRequest::fromJSON ( const std::string & json)
static

Static method for creating a NameChangeRequest from a string containing a JSON rendition of a request.

The JSON expected is described below. Note that a request must be enclosed within curly brackets "{..}" and that whitespace is optional (it is used in the following examples for clarity).

{
"change-type" : <integer>,
"forward-change" : <boolean>,
"reverse-change" : <boolean>,
"fqdn" : "<fqdn>",
"ip-address" : "<address>",
"dhcid" : "<hex_string>",
"lease-expires-on" : "<yyyymmddHHMMSS>",
"lease-length" : <secs>,
"use-conflict-resolution": <boolean>
}
  • change-type - indicates whether this request is to add or update DNS entries or to remove them. The value is an integer and is 0 for add/update and 1 for remove.
  • forward-change - indicates whether the forward (name to address) DNS zone should be updated. The value is a string representing a boolean. It is "true" if the zone should be updated and "false" if not. (Unlike the keyword, the boolean value is case-insensitive.)
  • reverse-change - indicates whether the reverse (address to name) DNS zone should be updated. The value is a string representing a boolean. It is "true" if the zone should be updated and "false" if not. (Unlike the keyword, the boolean value is case-insensitive.)
  • fqdn - fully qualified domain name such as "myhost.example.com.". (Note that a trailing dot will be appended if not supplied.)
  • ip-address - the IPv4 or IPv6 address of the client. The value is a string representing the IP address (e.g. "192.168.0.1" or "2001:db8:1::2").
  • dhcid - identification of the DHCP client to whom the IP address has been leased. The value is a string containing an even number of hexadecimal digits without delimiters such as "2C010203040A7F8E3D" (case insensitive).
  • lease-expires-on - the date and time on which the lease expires. The value is a string of the form "yyyymmddHHMMSS" where:
    • yyyy - four digit year
    • mm - month of year (1-12),
    • dd - day of the month (1-31),
    • HH - hour of the day (0-23)
    • MM - minutes of the hour (0-59)
    • SS - seconds of the minute (0-59)
  • lease-length - the length of the lease in seconds. This is an integer and may range between 1 and 4294967295 (2^32 - 1) inclusive.
  • use-conflict-resolution - when true, follow RFC 4703 which uses DHCID records to prohibit multiple clients from updating an FQDN

Examples:

Removal of an IPv4 address from the forward DNS zone only:

{
"change-type" : 1,
"forward-change" : true,
"reverse-change" : false,
"fqdn" : "myhost.example.com.",
"ip-address" : "192.168.2.1" ,
"dhcid" : "010203040A7F8E3D" ,
"lease-expires-on" : "20130121132405",
"lease-length" : 1300,
"use-conflict-resolution": true
}

Addition of an IPv6 address to both forward and reverse DNS zones:

{
"change-type" : 0,
"forward-change" : true,
"reverse-change" : true,
"fqdn" : "someother.example.com.",
"ip-address" : "2001::db8:1::2",
"dhcid" : "010203040A7F8E3D" , "
"lease-expires-on" : "20130121132405",
"lease-length" : 27400,
"use-conflict-resolution": true
}
Parameters
jsonis a string containing the JSON text
Returns
a pointer to the new NameChangeRequest
Exceptions
NcrMessageErrorif an error occurs creating new request.

Definition at line 363 of file ncr_msg.cc.

References NameChangeRequest(), isc::dhcp_ddns::CHECK_WITH_DHCID, isc::data::Element::fromJSON(), isc_throw, and isc::Exception::what().

Referenced by fromFormat().

+ Here is the call graph for this function:

◆ getChangeType()

NameChangeType isc::dhcp_ddns::NameChangeRequest::getChangeType ( ) const
inline

Fetches the request change type.

Returns
the change type

Definition at line 465 of file ncr_msg.h.

Referenced by toJSON().

◆ getConflictResolutionMode()

ConflictResolutionMode isc::dhcp_ddns::NameChangeRequest::getConflictResolutionMode ( ) const
inline

Fetches the conflict resolution mode.

Returns
a true if the conflict resolution is enabled.

Definition at line 691 of file ncr_msg.h.

Referenced by toJSON(), and toText().

◆ getDhcid()

const D2Dhcid & isc::dhcp_ddns::NameChangeRequest::getDhcid ( ) const
inline

Fetches the request DHCID.

Returns
a reference to the request's D2Dhcid

Definition at line 590 of file ncr_msg.h.

Referenced by toJSON().

◆ getElement()

isc::data::ConstElementPtr isc::dhcp_ddns::NameChangeRequest::getElement ( const std::string & name,
const ElementMap & element_map ) const

Given a name, finds and returns an element from a map of elements.

Parameters
nameis the name of the desired element
element_mapis the map of elements to search
Returns
a pointer to the element if located
Exceptions
NcrMessageErrorif the element cannot be found within the map

Definition at line 485 of file ncr_msg.cc.

References isc_throw.

◆ getFqdn()

const std::string isc::dhcp_ddns::NameChangeRequest::getFqdn ( ) const
inline

Fetches the request FQDN.

Returns
a string containing the FQDN

Definition at line 529 of file ncr_msg.h.

Referenced by toJSON().

◆ getIpAddress()

std::string isc::dhcp_ddns::NameChangeRequest::getIpAddress ( ) const
inline

Fetches the request IP address string.

Returns
a string containing the IP address

Definition at line 549 of file ncr_msg.h.

Referenced by toJSON().

◆ getIpIoAddress()

const asiolink::IOAddress & isc::dhcp_ddns::NameChangeRequest::getIpIoAddress ( ) const
inline

Fetches the request IP address as an IOAddress.

Returns
a asiolink::IOAddress containing the IP address

Definition at line 556 of file ncr_msg.h.

◆ getLeaseExpiresOn()

uint64_t isc::dhcp_ddns::NameChangeRequest::getLeaseExpiresOn ( ) const
inline

Fetches the request lease expiration.

Returns
the lease expiration as the number of seconds since the (00:00:00 January 1, 1970)

Definition at line 631 of file ncr_msg.h.

◆ getLeaseExpiresOnStr()

std::string isc::dhcp_ddns::NameChangeRequest::getLeaseExpiresOnStr ( ) const

Fetches the request lease expiration as string.

The format of the string returned is:

YYYYMMDDHHmmSS

Example: 18:54:54 June 26, 2013 would be: 20130626185455 NOTE This is always UTC time.

Returns
a ISO date-time string of the lease expiration.

Definition at line 615 of file ncr_msg.cc.

References isc::util::timeToText64().

Referenced by toJSON(), and toText().

+ Here is the call graph for this function:

◆ getLeaseLength()

uint32_t isc::dhcp_ddns::NameChangeRequest::getLeaseLength ( ) const
inline

Fetches the request lease length.

Returns
an integer containing the lease length

Definition at line 671 of file ncr_msg.h.

Referenced by toJSON().

◆ getRequestId()

std::string isc::dhcp_ddns::NameChangeRequest::getRequestId ( ) const
inline

Fetches the request ID.

Todo
Currently this is the DHCID, in the future we may add a unique ID per request to allow for correlating messages and events between the DHCP servers and the D2 server. If we do that we shall also need to add or update other functions to: set the request ID, add it to the JSON strings, etc. The primary purpose of this function is to provide a consistent way to identify requests for logging purposes.
Returns
a string with the request's request ID (currently DHCID)

Definition at line 623 of file ncr_msg.h.

◆ getStatus()

NameChangeStatus isc::dhcp_ddns::NameChangeRequest::getStatus ( ) const
inline

Fetches the request status.

Returns
the request status as a NameChangeStatus

Definition at line 725 of file ncr_msg.h.

◆ isForwardChange()

bool isc::dhcp_ddns::NameChangeRequest::isForwardChange ( ) const
inline

Checks forward change flag.

Returns
a true if the forward change flag is true.

Definition at line 485 of file ncr_msg.h.

Referenced by toJSON().

◆ isReverseChange()

bool isc::dhcp_ddns::NameChangeRequest::isReverseChange ( ) const
inline

Checks reverse change flag.

Returns
a true if the reverse change flag is true.

Definition at line 507 of file ncr_msg.h.

Referenced by toJSON().

◆ isV4()

bool isc::dhcp_ddns::NameChangeRequest::isV4 ( ) const
inline

Returns true if the lease address is a IPv4 lease.

Returns
boolean true if the lease address family is AF_INET.

Definition at line 563 of file ncr_msg.h.

◆ isV6()

bool isc::dhcp_ddns::NameChangeRequest::isV6 ( ) const
inline

Returns true if the lease address is a IPv6 lease.

Returns
boolean true if the lease address family is AF_INET6.

Definition at line 570 of file ncr_msg.h.

◆ operator!=()

bool isc::dhcp_ddns::NameChangeRequest::operator!= ( const NameChangeRequest & b) const

Definition at line 749 of file ncr_msg.cc.

◆ operator==()

bool isc::dhcp_ddns::NameChangeRequest::operator== ( const NameChangeRequest & b) const

Definition at line 736 of file ncr_msg.cc.

◆ setChangeType() [1/2]

void isc::dhcp_ddns::NameChangeRequest::setChangeType ( const NameChangeType value)

Sets the change type to the given value.

Parameters
valueis the NameChangeType value to assign to the request.

Definition at line 500 of file ncr_msg.cc.

Referenced by setChangeType().

◆ setChangeType() [2/2]

void isc::dhcp_ddns::NameChangeRequest::setChangeType ( isc::data::ConstElementPtr element)

Sets the change type to the value of the given Element.

Parameters
elementis an integer Element containing the change type value.
Exceptions
NcrMessageErrorif the element is not an integer Element or contains an invalid value.

Definition at line 506 of file ncr_msg.cc.

References isc::dhcp_ddns::CHG_ADD, isc::dhcp_ddns::CHG_REMOVE, isc_throw, setChangeType(), and isc::Exception::what().

+ Here is the call graph for this function:

◆ setConflictResolutionMode() [1/2]

void isc::dhcp_ddns::NameChangeRequest::setConflictResolutionMode ( const ConflictResolutionMode value)

Sets the conflict resolution mode to the given value.

Parameters
valuecontains the new value to assign to the conflict resolution mode

Definition at line 680 of file ncr_msg.cc.

Referenced by setConflictResolutionMode(), and translateUseConflictResolution().

◆ setConflictResolutionMode() [2/2]

void isc::dhcp_ddns::NameChangeRequest::setConflictResolutionMode ( isc::data::ConstElementPtr element)

Sets the conflict resolution mode to the value of the given Element.

Parameters
elementis a enum Element containing the conflict resolution mode value.
Exceptions
NcrMessageErrorif the element is not an enum Element.

Definition at line 685 of file ncr_msg.cc.

References isc_throw, setConflictResolutionMode(), isc::dhcp_ddns::StringToConflictResolutionMode(), and isc::Exception::what().

+ Here is the call graph for this function:

◆ setDhcid() [1/2]

void isc::dhcp_ddns::NameChangeRequest::setDhcid ( const std::string & value)

Sets the DHCID based on the given string value.

Parameters
valueis a string of hexadecimal digits. The format is simply a contiguous stream of digits, with no delimiters. For example a string containing "14A3" converts to a byte array containing: 0x14, 0xA3.
Exceptions
NcrMessageErrorif the input data contains non-digits or there is an odd number of digits.

Definition at line 605 of file ncr_msg.cc.

References isc::dhcp_ddns::D2Dhcid::fromStr().

+ Here is the call graph for this function:

◆ setDhcid() [2/2]

void isc::dhcp_ddns::NameChangeRequest::setDhcid ( isc::data::ConstElementPtr element)

Sets the DHCID based on the value of the given Element.

Parameters
elementis a string Element containing the string of hexadecimal digits. (See setDhcid(std::string&) above.)
Exceptions
NcrMessageErrorif the input data contains non-digits or there is an odd number of digits.

Definition at line 610 of file ncr_msg.cc.

References setDhcid().

Referenced by setDhcid().

+ Here is the call graph for this function:

◆ setForwardChange() [1/2]

void isc::dhcp_ddns::NameChangeRequest::setForwardChange ( const bool value)

Sets the forward change flag to the given value.

Parameters
valuecontains the new value to assign to the forward change flag

Definition at line 528 of file ncr_msg.cc.

Referenced by setForwardChange().

◆ setForwardChange() [2/2]

void isc::dhcp_ddns::NameChangeRequest::setForwardChange ( isc::data::ConstElementPtr element)

Sets the forward change flag to the value of the given Element.

Parameters
elementis a boolean Element containing the forward change flag value.
Exceptions
NcrMessageErrorif the element is not a boolean Element

Definition at line 533 of file ncr_msg.cc.

References isc_throw, setForwardChange(), and isc::Exception::what().

+ Here is the call graph for this function:

◆ setFqdn() [1/2]

void isc::dhcp_ddns::NameChangeRequest::setFqdn ( const std::string & value)

Sets the FQDN to the given value.

Parameters
valuecontains the new value to assign to the FQDN

Definition at line 576 of file ncr_msg.cc.

References isc_throw.

Referenced by NameChangeRequest(), and setFqdn().

◆ setFqdn() [2/2]

void isc::dhcp_ddns::NameChangeRequest::setFqdn ( isc::data::ConstElementPtr element)

Sets the FQDN to the value of the given Element.

Parameters
elementis a string Element containing the FQDN
Exceptions
NcrMessageErrorif the element is not a string Element

Definition at line 571 of file ncr_msg.cc.

References setFqdn().

+ Here is the call graph for this function:

◆ setIpAddress() [1/2]

void isc::dhcp_ddns::NameChangeRequest::setIpAddress ( const std::string & value)

Sets the IP address to the given value.

Parameters
valuecontains the new value to assign to the IP address

Definition at line 588 of file ncr_msg.cc.

References isc_throw.

Referenced by NameChangeRequest(), and setIpAddress().

◆ setIpAddress() [2/2]

void isc::dhcp_ddns::NameChangeRequest::setIpAddress ( isc::data::ConstElementPtr element)

Sets the IP address to the value of the given Element.

Parameters
elementis a string Element containing the IP address
Exceptions
NcrMessageErrorif the element is not a string Element

Definition at line 599 of file ncr_msg.cc.

References setIpAddress().

+ Here is the call graph for this function:

◆ setLeaseExpiresOn() [1/2]

void isc::dhcp_ddns::NameChangeRequest::setLeaseExpiresOn ( const std::string & value)

Sets the lease expiration based on the given string.

Parameters
valueis an date-time string from which to set the lease expiration. The format of the input is:

YYYYMMDDHHmmSS

Example: 18:54:54 June 26, 2013 would be: 20130626185455 NOTE This is always UTC time.

Exceptions
NcrMessageErrorif the ISO string is invalid.

Definition at line 620 of file ncr_msg.cc.

References isc_throw, and isc::util::timeFromText64().

Referenced by setLeaseExpiresOn().

+ Here is the call graph for this function:

◆ setLeaseExpiresOn() [2/2]

void isc::dhcp_ddns::NameChangeRequest::setLeaseExpiresOn ( isc::data::ConstElementPtr element)

Sets the lease expiration based on the given Element.

Parameters
elementis string Element containing a date-time string.
Exceptions
NcrMessageErrorif the element is not a string Element, or if the element value is an invalid date-time string.

Definition at line 631 of file ncr_msg.cc.

References setLeaseExpiresOn().

+ Here is the call graph for this function:

◆ setLeaseLength() [1/2]

void isc::dhcp_ddns::NameChangeRequest::setLeaseLength ( const uint32_t value)

Sets the lease length to the given value.

Parameters
valuecontains the new value to assign to the lease length

Definition at line 637 of file ncr_msg.cc.

Referenced by setLeaseLength().

◆ setLeaseLength() [2/2]

void isc::dhcp_ddns::NameChangeRequest::setLeaseLength ( isc::data::ConstElementPtr element)

Sets the lease length to the value of the given Element.

Parameters
elementis a integer Element containing the lease length
Exceptions
NcrMessageErrorif the element is not a string Element

Definition at line 642 of file ncr_msg.cc.

References isc_throw, setLeaseLength(), and isc::Exception::what().

+ Here is the call graph for this function:

◆ setReverseChange() [1/2]

void isc::dhcp_ddns::NameChangeRequest::setReverseChange ( const bool value)

Sets the reverse change flag to the given value.

Parameters
valuecontains the new value to assign to the reverse change flag

Definition at line 549 of file ncr_msg.cc.

Referenced by setReverseChange().

◆ setReverseChange() [2/2]

void isc::dhcp_ddns::NameChangeRequest::setReverseChange ( isc::data::ConstElementPtr element)

Sets the reverse change flag to the value of the given Element.

Parameters
elementis a boolean Element containing the reverse change flag value.
Exceptions
NcrMessageErrorif the element is not a boolean Element

Definition at line 554 of file ncr_msg.cc.

References isc_throw, setReverseChange(), and isc::Exception::what().

+ Here is the call graph for this function:

◆ setStatus()

void isc::dhcp_ddns::NameChangeRequest::setStatus ( const NameChangeStatus value)

Sets the request status to the given value.

Parameters
valuecontains the new value to assign to request status

Definition at line 698 of file ncr_msg.cc.

◆ toFormat()

void isc::dhcp_ddns::NameChangeRequest::toFormat ( const NameChangeFormat format,
isc::util::OutputBuffer & buffer ) const

Instance method for marshalling the contents of the request into the given buffer in the given format.

When the format is:

JSON: Upon completion, the buffer will contain a two byte unsigned integer which specifies the length of the JSON text; followed by the JSON text itself. The JSON text contains the names and values for all the request data needed to reassemble the request on the receiving end. The JSON text in the buffer is NOT null-terminated. The format is identical that described under isc::dhcp_ddns::NameChangeRequest::fromJSON

(NOTE currently only JSON is supported.)

Parameters
formatindicates the data format to use
bufferis the output buffer to which the request should be marshalled.

Definition at line 339 of file ncr_msg.cc.

References isc::dhcp_ddns::FMT_JSON, isc_throw, and toJSON().

+ Here is the call graph for this function:

◆ toJSON()

std::string isc::dhcp_ddns::NameChangeRequest::toJSON ( ) const

Instance method for marshalling the contents of the request into a string of JSON text.

Returns
a string containing the JSON rendition of the request

Definition at line 439 of file ncr_msg.cc.

References isc::dhcp_ddns::ConflictResolutionModeToString(), getChangeType(), getConflictResolutionMode(), getDhcid(), getFqdn(), getIpAddress(), getLeaseExpiresOnStr(), getLeaseLength(), isForwardChange(), and isReverseChange().

Referenced by toFormat().

+ Here is the call graph for this function:

◆ toText()

std::string isc::dhcp_ddns::NameChangeRequest::toText ( ) const

Returns a text rendition of the contents of the request.

This method is primarily for logging purposes.

Returns
a string containing the text.

Definition at line 703 of file ncr_msg.cc.

References isc::dhcp_ddns::CHG_ADD, isc::dhcp_ddns::CHG_REMOVE, isc::dhcp_ddns::ConflictResolutionModeToString(), getConflictResolutionMode(), getLeaseExpiresOnStr(), and isc::dhcp_ddns::D2Dhcid::toStr().

+ Here is the call graph for this function:

◆ translateUseConflictResolution()

void isc::dhcp_ddns::NameChangeRequest::translateUseConflictResolution ( isc::data::ConstElementPtr element)

Sets the conflict resolution mode based on the value of the given boolean Element.

This function is used to translate use-conflict-resolution sent by older versions of Kea.

Parameters
elementis a boolean Element containing the conflict resolution flag value.
Exceptions
NcrMessageErrorif the element is not a boolean Element

Definition at line 668 of file ncr_msg.cc.

References isc::dhcp_ddns::CHECK_WITH_DHCID, isc_throw, isc::dhcp_ddns::NO_CHECK_WITH_DHCID, setConflictResolutionMode(), and isc::Exception::what().

+ Here is the call graph for this function:

◆ validateContent()

void isc::dhcp_ddns::NameChangeRequest::validateContent ( )

Validates the content of a populated request.

This method is used by both the full constructor and from-wire marshalling to ensure that the request is content valid. Currently it enforces the following rules:

  • FQDN must not be blank.
  • The IP address must be a valid address.
  • The DHCID must not be blank.
  • The lease expiration date must be a valid date/time.
  • That at least one of the two direction flags, forward change and reverse change is true.
Todo
This is an initial implementation which provides a minimal amount of validation. FQDN, DHCID, and IP Address members are all currently strings, these may be replaced with richer classes.
Exceptions
NcrMessageErrorif the request content violates any of the validation rules.

Definition at line 464 of file ncr_msg.cc.

References isc::dhcp_ddns::D2Dhcid::getBytes(), and isc_throw.

Referenced by NameChangeRequest().

+ Here is the call graph for this function:

The documentation for this class was generated from the following files: