blob: 2011912a781e858ab5627647143514a48b3af677 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
// Copyright (C) 2015-2023 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#ifndef NCR_GENERATOR_H
#define NCR_GENERATOR_H
#include <dhcp_ddns/ncr_msg.h>
#include <dhcpsrv/lease.h>
#include <util/optional.h>
namespace isc {
namespace dhcp {
/// @brief Creates name change request from the DHCPv4 lease.
///
/// This function creates name change request from the information contained
/// in the DHCPv4 lease. If the client identifier is present in the lease,
/// this identifier is used to compute the DHCID, otherwise the HW address
/// is used.
///
/// This function is exception safe. On failure, it logs an error.
///
/// @param chg_type Type of the name change request
/// @param lease Pointer to the lease.
void queueNCR(const dhcp_ddns::NameChangeType& chg_type, const Lease4Ptr& lease);
/// @brief Creates name change request from the DHCPv6 lease.
///
/// This function creates name change request from the information contained
/// in the DHCPv6 lease. The DUID is used to compute the DHCID for the name
/// change request.
///
/// This function will skip sending the NCR if the lease type is a delegated
/// prefix.
///
/// This function is exception safe. On failure, it logs an error.
///
/// @param chg_type Type of the name change request
/// @param lease Pointer to the lease.
void queueNCR(const dhcp_ddns::NameChangeType& chg_type, const Lease6Ptr& lease);
/// @brief Calculates TTL for a DNS resource record based on lease life time.
///
/// If the parameter, ddns_ttl_percent is greater than zero, it is used to calculate
/// the TTL directly:
///
/// TTL = (lease life time * ddns-ttl-percent)
///
/// Otherwise it is calculated as per RFC 4702 Section 5:
///
/// TTL = ((lease life time / 3) < 10 minutes) ? 10 minutes : (lease life time / 3)
///
/// @param lease_life_time valid life time of the lease
/// @param ddns_ttl_percent optional percentage to use in calculation
///
/// @return the calculated TTL.
uint32_t calculateDdnsTtl(uint32_t lease_life_time,
const util::Optional<double>& ddns_ttl_percent
= util::Optional<double>());
} // end of isc::dhcp namespace
} // end of isc namespace
#endif // NCR_GENERATOR_H
|