38 template<
typename LeasePtrType,
typename IdentifierType>
39 void queueNCRCommon(
const NameChangeType& chg_type,
const LeasePtrType& lease,
40 const IdentifierType& identifier,
const std::string& label,
41 const bool use_conflict_resolution =
true) {
44 if (lease->hostname_.empty() || (!lease->fqdn_fwd_ && !lease->fqdn_rev_)
49 .arg(lease->addr_.toText());
56 std::vector<uint8_t> hostname_wire;
66 lease->hostname_, lease->addr_.toText(),
67 dhcid, lease->cltt_ + ttl,
68 ttl, use_conflict_resolution));
72 .arg(chg_type ==
CHG_ADD ?
"add" :
"remove")
78 }
catch (
const std::exception& ex) {
81 .arg(chg_type ==
CHG_ADD ?
"add" :
"remove")
82 .arg(lease->addr_.toText())
98 ->getCfgSubnets4()->getSubnet(lease->subnet_id_);
101 use_cr = subnet->getDdnsUseConflictResolution();
105 if (lease->client_id_) {
106 queueNCRCommon(chg_type, lease, lease->client_id_->getClientId(),
112 queueNCRCommon(chg_type, lease, lease->hwaddr_,
125 ->getCfgSubnets6()->getSubnet(lease->subnet_id_);
128 use_cr = subnet->getDdnsUseConflictResolution();
131 queueNCRCommon(chg_type, lease, *(lease->duid_),
139 if (lease_lft < 1800) {
143 return (lease_lft / 3);
uint32_t calculateDdnsTtl(uint32_t lease_lft)
Calculates TTL for a DNS resource record based on lease life time.
const int DHCPSRV_DBG_TRACE_DETAIL_DATA
Additional information.
static std::string makeLabel(const HWAddrPtr &hwaddr, const ClientIdPtr &client_id, const uint32_t transid)
Returns text representation of the given packet identifiers.
NameChangeType
Defines the types of DNS updates that can be requested.
static CfgMgr & instance()
returns a single instance of Configuration Manager
boost::shared_ptr< Subnet4 > Subnet4Ptr
A pointer to a Subnet4 object.
static void writeFqdn(const std::string &fqdn, std::vector< uint8_t > &buf, const bool downcase=false)
Append FQDN into a buffer.
const isc::log::MessageID DHCPSRV_QUEUE_NCR_FAILED
#define LOG_ERROR(LOGGER, MESSAGE)
Macro to conveniently test error output and log it.
the lease contains IPv6 prefix (for prefix delegation)
SrvConfigPtr getCurrentCfg()
Returns a pointer to the current configuration.
boost::shared_ptr< NameChangeRequest > NameChangeRequestPtr
Defines a pointer to a NameChangeRequest.
void sendRequest(dhcp_ddns::NameChangeRequestPtr &ncr)
Send the given NameChangeRequests to kea-dhcp-ddns.
void queueNCR(const NameChangeType &chg_type, const Lease4Ptr &lease)
Creates name change request from the DHCPv4 lease.
boost::shared_ptr< Lease4 > Lease4Ptr
Pointer to a Lease4 structure.
const int DHCPSRV_DBG_TRACE_DETAIL
Additional information.
bool ddnsEnabled()
Convenience method for checking if DHCP-DDNS is enabled.
Defines the logger used by the top-level component of kea-dhcp-ddns.
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.
#define LOG_DEBUG(LOGGER, LEVEL, MESSAGE)
Macro to conveniently test debug output and log it.
const isc::log::MessageID DHCPSRV_QUEUE_NCR
D2ClientMgr & getD2ClientMgr()
Fetches the DHCP-DDNS manager.
isc::log::Logger dhcpsrv_logger("dhcpsrv")
DHCP server library Logger.
boost::shared_ptr< Subnet6 > Subnet6Ptr
A pointer to a Subnet6 object.
boost::shared_ptr< Lease6 > Lease6Ptr
Pointer to a Lease6 structure.
Represents a DHCP-DDNS client request.
Defines the D2ClientMgr class.
const isc::log::MessageID DHCPSRV_QUEUE_NCR_SKIP