Kea  1.9.9-git
isc::dhcp_ddns::NameChangeRequest Class Reference

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

#include <ncr_msg.h>

Public Member Functions

 NameChangeRequest ()
 Default Constructor. More...
 
 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 bool conflict_resolution=true)
 Constructor. More...
 
NameChangeType getChangeType () const
 Fetches the request change type. More...
 
const D2DhcidgetDhcid () const
 Fetches the request DHCID. More...
 
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. More...
 
const std::string getFqdn () const
 Fetches the request FQDN. More...
 
std::string getIpAddress () const
 Fetches the request IP address string. More...
 
const asiolink::IOAddressgetIpIoAddress () const
 Fetches the request IP address as an IOAddress. More...
 
uint64_t getLeaseExpiresOn () const
 Fetches the request lease expiration. More...
 
std::string getLeaseExpiresOnStr () const
 Fetches the request lease expiration as string. More...
 
uint32_t getLeaseLength () const
 Fetches the request lease length. More...
 
std::string getRequestId () const
 Fetches the request ID. More...
 
NameChangeStatus getStatus () const
 Fetches the request status. More...
 
bool isForwardChange () const
 Checks forward change flag. More...
 
bool isReverseChange () const
 Checks reverse change flag. More...
 
bool isV4 () const
 Returns true if the lease address is a IPv4 lease. More...
 
bool isV6 () const
 Returns true if the lease address is a IPv6 lease. More...
 
bool operator!= (const NameChangeRequest &b)
 
bool operator== (const NameChangeRequest &b)
 
void setChangeType (const NameChangeType value)
 Sets the change type to the given value. More...
 
void setChangeType (isc::data::ConstElementPtr element)
 Sets the change type to the value of the given Element. More...
 
void setConflictResolution (const bool value)
 Sets the conflict resolution flag to the given value. More...
 
void setConflictResolution (isc::data::ConstElementPtr element)
 Sets the conflict resolution flag to the value of the given Element. More...
 
void setDhcid (const std::string &value)
 Sets the DHCID based on the given string value. More...
 
void setDhcid (isc::data::ConstElementPtr element)
 Sets the DHCID based on the value of the given Element. More...
 
void setForwardChange (const bool value)
 Sets the forward change flag to the given value. More...
 
void setForwardChange (isc::data::ConstElementPtr element)
 Sets the forward change flag to the value of the given Element. More...
 
void setFqdn (const std::string &value)
 Sets the FQDN to the given value. More...
 
void setFqdn (isc::data::ConstElementPtr element)
 Sets the FQDN to the value of the given Element. More...
 
void setIpAddress (const std::string &value)
 Sets the IP address to the given value. More...
 
void setIpAddress (isc::data::ConstElementPtr element)
 Sets the IP address to the value of the given Element. More...
 
void setLeaseExpiresOn (const std::string &value)
 Sets the lease expiration based on the given string. More...
 
void setLeaseExpiresOn (isc::data::ConstElementPtr element)
 Sets the lease expiration based on the given Element. More...
 
void setLeaseLength (const uint32_t value)
 Sets the lease length to the given value. More...
 
void setLeaseLength (isc::data::ConstElementPtr element)
 Sets the lease length to the value of the given Element. More...
 
void setReverseChange (const bool value)
 Sets the reverse change flag to the given value. More...
 
void setReverseChange (isc::data::ConstElementPtr element)
 Sets the reverse change flag to the value of the given Element. More...
 
void setStatus (const NameChangeStatus value)
 Sets the request status to the given value. More...
 
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. More...
 
std::string toJSON () const
 Instance method for marshalling the contents of the request into a string of JSON text. More...
 
std::string toText () const
 Returns a text rendition of the contents of the request. More...
 
bool useConflictResolution () const
 Checks if conflict resolution is enabled. More...
 
void validateContent ()
 Validates the content of a populated request. More...
 

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. More...
 
static NameChangeRequestPtr fromJSON (const std::string &json)
 Static method for creating a NameChangeRequest from a string containing a JSON rendition of a request. More...
 

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 227 of file ncr_msg.h.

Constructor & Destructor Documentation

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 200 of file ncr_msg.cc.

Referenced by fromJSON().

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 bool  conflict_resolution = true 
)

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_resolutionindicates whether or not conflict resolution (per RFC 4703) is enabled.

Definition at line 207 of file ncr_msg.cc.

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

+ Here is the call graph for this function:

Member Function Documentation

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 232 of file ncr_msg.cc.

References isc::dhcp_ddns::FMT_JSON, fromJSON(), isc_throw, isc::util::InputBuffer::readUint16(), isc::util::InputBuffer::readVector(), and isc::Exception::what().

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

+ Here is the call graph for this function:

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 296 of file ncr_msg.cc.

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

Referenced by fromFormat().

+ Here is the call graph for this function:

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

Fetches the request change type.

Returns
the change type

Definition at line 437 of file ncr_msg.h.

Referenced by toJSON().

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

Fetches the request DHCID.

Returns
a reference to the request's D2Dhcid

Definition at line 562 of file ncr_msg.h.

Referenced by toJSON().

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 411 of file ncr_msg.cc.

References isc_throw.

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

Fetches the request FQDN.

Returns
a string containing the FQDN

Definition at line 501 of file ncr_msg.h.

Referenced by toJSON().

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 521 of file ncr_msg.h.

References isc::asiolink::IOAddress::toText().

Referenced by toJSON().

+ Here is the call graph for this function:

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 528 of file ncr_msg.h.

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 603 of file ncr_msg.h.

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 541 of file ncr_msg.cc.

References isc::util::timeToText64().

Referenced by toJSON(), and toText().

+ Here is the call graph for this function:

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

Fetches the request lease length.

Returns
an integer containing the lease length

Definition at line 643 of file ncr_msg.h.

Referenced by toJSON().

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 595 of file ncr_msg.h.

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

+ Here is the call graph for this function:

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

Fetches the request status.

Returns
the request status as a NameChangeStatus

Definition at line 685 of file ncr_msg.h.

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 457 of file ncr_msg.h.

Referenced by toJSON().

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 479 of file ncr_msg.h.

Referenced by toJSON().

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 535 of file ncr_msg.h.

References isc::asiolink::IOAddress::isV4().

+ Here is the call graph for this function:

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 542 of file ncr_msg.h.

References isc::asiolink::IOAddress::isV6().

+ Here is the call graph for this function:

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

Definition at line 665 of file ncr_msg.cc.

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

Definition at line 652 of file ncr_msg.cc.

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 426 of file ncr_msg.cc.

Referenced by setChangeType().

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 432 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:

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

Sets the conflict resolution flag to the given value.

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

Definition at line 594 of file ncr_msg.cc.

Referenced by setConflictResolution().

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

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

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

Definition at line 599 of file ncr_msg.cc.

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

+ Here is the call graph for this function:

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 531 of file ncr_msg.cc.

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

Referenced by setDhcid().

+ Here is the call graph for this function:

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 536 of file ncr_msg.cc.

References setDhcid().

+ Here is the call graph for this function:

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 454 of file ncr_msg.cc.

Referenced by setForwardChange().

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 459 of file ncr_msg.cc.

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

+ Here is the call graph for this function:

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 502 of file ncr_msg.cc.

References isc_throw, isc::dns::Name::toText(), and isc::Exception::what().

Referenced by NameChangeRequest(), and setFqdn().

+ Here is the call graph for this function:

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 497 of file ncr_msg.cc.

References setFqdn().

+ Here is the call graph for this function:

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 514 of file ncr_msg.cc.

References isc_throw.

Referenced by NameChangeRequest(), and setIpAddress().

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 525 of file ncr_msg.cc.

References setIpAddress().

+ Here is the call graph for this function:

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 546 of file ncr_msg.cc.

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

Referenced by setLeaseExpiresOn().

+ Here is the call graph for this function:

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 557 of file ncr_msg.cc.

References setLeaseExpiresOn().

+ Here is the call graph for this function:

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 563 of file ncr_msg.cc.

Referenced by setLeaseLength().

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 568 of file ncr_msg.cc.

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

+ Here is the call graph for this function:

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 475 of file ncr_msg.cc.

Referenced by setReverseChange().

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 480 of file ncr_msg.cc.

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

+ Here is the call graph for this function:

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 615 of file ncr_msg.cc.

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 272 of file ncr_msg.cc.

References isc::dhcp_ddns::FMT_JSON, isc_throw, toJSON(), isc::util::OutputBuffer::writeData(), and isc::util::OutputBuffer::writeUint16().

+ Here is the call graph for this function:

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 366 of file ncr_msg.cc.

References getChangeType(), getDhcid(), getFqdn(), getIpAddress(), getLeaseExpiresOnStr(), getLeaseLength(), isForwardChange(), isReverseChange(), isc::dhcp_ddns::D2Dhcid::toStr(), and useConflictResolution().

Referenced by toFormat().

+ Here is the call graph for this function:

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 620 of file ncr_msg.cc.

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

+ Here is the call graph for this function:

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

Checks if conflict resolution is enabled.

Returns
a true if the conflict resolution is enabled.

Definition at line 663 of file ncr_msg.h.

Referenced by toJSON().

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 390 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: