Kea 2.7.7
ddns_params.cc
Go to the documentation of this file.
1// Copyright (C) 2014-2025 Internet Systems Consortium, Inc. ("ISC")
2//
3// This Source Code Form is subject to the terms of the Mozilla Public
4// License, v. 2.0. If a copy of the MPL was not distributed with this
5// file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7#include <config.h>
8
10#include <dhcpsrv/ddns_params.h>
11
12namespace isc {
13namespace dhcp {
14
15bool
17 if (!subnet_) {
18 return (false);
19 }
20
21 if (pool_) {
22 auto optional = pool_->getDdnsUpdateOnRenew();
23 if (!optional.unspecified()) {
24 return (optional.get());
25 }
26 }
27
28 return (subnet_->getDdnsUpdateOnRenew().get());
29}
30
31std::string
33 if (!subnet_) {
34 return ("check-with-dhcid");
35 }
36
37 if (pool_) {
38 auto optional = pool_->getDdnsConflictResolutionMode();
39 if (!optional.unspecified()) {
40 return (optional.get());
41 }
42 }
43
44 return (subnet_->getDdnsConflictResolutionMode().get());
45}
46
47
50 if (!subnet_) {
51 return (util::Optional<double>());
52 }
53
54 if (pool_) {
55 auto optional = pool_->getDdnsTtlPercent();
56 if (!optional.unspecified()) {
57 return (optional.get());
58 }
59 }
60
61 return (subnet_->getDdnsTtlPercent());
62}
63
66 if (!subnet_) {
67 return (util::Optional<uint32_t>());
68 }
69
70 if (pool_) {
71 auto optional = pool_->getDdnsTtl();
72 if (!optional.unspecified()) {
73 return (optional.get());
74 }
75 }
76
77 return (subnet_->getDdnsTtl());
78}
79
82 if (!subnet_) {
83 return (util::Optional<uint32_t>());
84 }
85
86 if (pool_) {
87 auto optional = pool_->getDdnsTtlMin();
88 if (!optional.unspecified()) {
89 return (optional.get());
90 }
91 }
92
93 return (subnet_->getDdnsTtlMin());
94}
95
98 if (!subnet_) {
99 return (util::Optional<uint32_t>());
100 }
101
102 if (pool_) {
103 auto optional = pool_->getDdnsTtlMax();
104 if (!optional.unspecified()) {
105 return (optional.get());
106 }
107 }
108
109 return (subnet_->getDdnsTtlMax());
110}
111
114 if (!subnet_) {
117 "DdnsParams::setPoolFromAddress called without a subnet");
118 }
119
120 pool_ = subnet_->getPool((address.isV4() ? Lease::TYPE_V4 : Lease::TYPE_NA),
121 address, false);
122 return (pool_);
123}
124
125} // namespace dhcp
126} // namespace isc
A generic exception that is thrown if a function is called in a prohibited way.
util::Optional< double > getTtlPercent() const
Returns percent of lease lifetime to use for TTL.
util::Optional< uint32_t > getTtl() const
Returns explicit TTL to use.
std::string getConflictResolutionMode() const
Returns the DDNS config resolution mode for kea-dhcp-ddns.
bool getUpdateOnRenew() const
Returns whether or not DNS should be updated when leases renew.
util::Optional< uint32_t > getTtlMax() const
Returns the maximum TTL to use.
PoolPtr setPoolFromAddress(const asiolink::IOAddress &address)
Sets the pool based on the current subnet and given address.
util::Optional< uint32_t > getTtlMin() const
Returns the minimum TTL to use.
A template representing an optional value.
Definition optional.h:36
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
boost::shared_ptr< Pool > PoolPtr
a pointer to either IPv4 or IPv6 Pool
Definition pool.h:726
Defines the logger used by the top-level component of kea-lfc.
@ TYPE_V4
IPv4 lease.
Definition lease.h:50
@ TYPE_NA
the lease contains non-temporary IPv6 address
Definition lease.h:47