38template<
typename LeasePtrType,
typename IdentifierType>
39void queueNCRCommon(
const NameChangeType& chg_type,
const LeasePtrType& lease,
43 if (lease->hostname_.empty() || (!lease->fqdn_fwd_ && !lease->fqdn_rev_)
48 .arg(lease->addr_.toText());
56 auto mode = subnet->getDdnsConflictResolutionMode();
61 ddns_ttl_percent = subnet->getDdnsTtlPercent();
66 std::vector<uint8_t> hostname_wire;
76 lease->hostname_, lease->addr_.toText(),
77 dhcid, lease->cltt_ + ttl,
78 ttl, conflict_resolution_mode));
82 .arg(chg_type ==
CHG_ADD ?
"add" :
"remove")
88 }
catch (
const std::exception& ex) {
91 .arg(chg_type ==
CHG_ADD ?
"add" :
"remove")
92 .arg(lease->addr_.toText())
107 ->getCfgSubnets4()->getSubnet(lease->subnet_id_);
110 if (lease->client_id_) {
111 queueNCRCommon(chg_type, lease, lease->client_id_->getClientId(),
116 queueNCRCommon(chg_type, lease, lease->hwaddr_,
128 ->getCfgSubnets6()->getSubnet(lease->subnet_id_);
129 queueNCRCommon(chg_type, lease, *(lease->duid_),
136 if (!ddns_ttl_percent.unspecified() && (ddns_ttl_percent.get() > 0.0)) {
137 uint32_t new_lft =
static_cast<uint32_t
>(round(ddns_ttl_percent.get() * lease_lft));
143 .arg(ddns_ttl_percent.get())
150 if (lease_lft < 1800) {
154 return (lease_lft / 3);
static CfgMgr & instance()
returns a single instance of Configuration Manager
static void writeFqdn(const std::string &fqdn, std::vector< uint8_t > &buf, const bool downcase=false)
Append FQDN into a buffer.
static std::string makeLabel(const HWAddrPtr &hwaddr, const ClientIdPtr &client_id, const uint32_t transid)
Returns text representation of the given packet identifiers.
static std::string makeLabel(const DuidPtr duid, const uint32_t transid, const HWAddrPtr &hwaddr)
Returns text representation of the given packet identifiers.
Container class for handling the DHCID value within a NameChangeRequest.
Represents a DHCP-DDNS client request.
A template representing an optional value.
Defines the D2ClientMgr class.
#define LOG_ERROR(LOGGER, MESSAGE)
Macro to conveniently test error output and log it.
#define LOG_DEBUG(LOGGER, LEVEL, MESSAGE)
Macro to conveniently test debug output and log it.
ConflictResolutionMode StringToConflictResolutionMode(const std::string &mode_str)
Function which converts string to ConflictResolutionMode enum values.
boost::shared_ptr< NameChangeRequest > NameChangeRequestPtr
Defines a pointer to a NameChangeRequest.
NameChangeType
Defines the types of DNS updates that can be requested.
const int DHCPSRV_DBG_TRACE_DETAIL_DATA
Additional information.
isc::log::Logger dhcpsrv_logger("dhcpsrv")
DHCP server library Logger.
uint32_t calculateDdnsTtl(uint32_t lease_lft, const util::Optional< double > &ddns_ttl_percent)
Calculates TTL for a DNS resource record based on lease life time.
boost::shared_ptr< Subnet4 > Subnet4Ptr
A pointer to a Subnet4 object.
const isc::log::MessageID DHCPSRV_QUEUE_NCR
void queueNCR(const NameChangeType &chg_type, const Lease4Ptr &lease)
Creates name change request from the DHCPv4 lease.
boost::shared_ptr< Lease6 > Lease6Ptr
Pointer to a Lease6 structure.
boost::shared_ptr< Subnet6 > Subnet6Ptr
A pointer to a Subnet6 object.
const isc::log::MessageID DHCPSRV_QUEUE_NCR_FAILED
const int DHCPSRV_DBG_TRACE_DETAIL
Additional information.
const isc::log::MessageID DHCPSRV_DDNS_TTL_PERCENT_TOO_SMALL
const isc::log::MessageID DHCPSRV_QUEUE_NCR_SKIP
boost::shared_ptr< Network > NetworkPtr
Pointer to the Network object.
boost::shared_ptr< Lease4 > Lease4Ptr
Pointer to a Lease4 structure.
Defines the logger used by the top-level component of kea-lfc.
@ TYPE_PD
the lease contains IPv6 prefix (for prefix delegation)