22 if (!config->contains(
"reservation-mode")) {
25 if (config->contains(
"reservations-global") ||
26 config->contains(
"reservations-in-subnet") ||
27 config->contains(
"reservations-out-of-pool")) {
29 " and one of 'reservations-global', 'reservations-in-subnet'"
30 " or 'reservations-out-of-pool' parameters");
32 std::string hr_mode =
getString(config,
"reservation-mode");
33 if ((hr_mode ==
"disabled") || (hr_mode ==
"off")) {
36 }
else if (hr_mode ==
"out-of-pool") {
40 }
else if (hr_mode ==
"global") {
43 }
else if (hr_mode ==
"all") {
52 config->remove(
"reservation-mode");
64 " and one of 'reservations-global', 'reservations-in-subnet'"
65 " or 'reservations-out-of-pool' parameters");
68 if ((hr_mode ==
"disabled") || (hr_mode ==
"off")) {
71 }
else if (hr_mode ==
"out-of-pool") {
75 }
else if (hr_mode ==
"global") {
78 }
else if (hr_mode ==
"all") {
94 bool has_renew = network_data->contains(
"renew-timer");
95 bool has_rebind = network_data->contains(
"rebind-timer");
100 renew =
getInteger(network_data,
"renew-timer");
103 << renew <<
") must be a positive number");
105 network->setT1(renew);
109 rebind =
getInteger(network_data,
"rebind-timer");
112 << rebind <<
") must be a positive number");
114 network->setT2(rebind);
117 if (has_renew && has_rebind && (renew > rebind)) {
122 .arg(network->getLabel())
129 if (network_data->contains(
"store-extended-info")) {
130 network->setStoreExtendedInfo(
getBoolean(network_data,
131 "store-extended-info"));
134 if (network_data->contains(
"reservations-global")) {
135 network->setReservationsGlobal(
getBoolean(network_data,
136 "reservations-global"));
139 if (network_data->contains(
"reservations-in-subnet")) {
140 network->setReservationsInSubnet(
getBoolean(network_data,
141 "reservations-in-subnet"));
144 if (network_data->contains(
"reservations-out-of-pool")) {
145 network->setReservationsOutOfPool(
getBoolean(network_data,
146 "reservations-out-of-pool"));
153 bool calculate_tee_times = network->getCalculateTeeTimes();
154 if (network_data->contains(
"calculate-tee-times")) {
155 calculate_tee_times =
getBoolean(network_data,
"calculate-tee-times");
156 network->setCalculateTeeTimes(calculate_tee_times);
160 if (network_data->contains(
"t2-percent")) {
161 t2_percent =
getDouble(network_data,
"t2-percent");
165 if (network_data->contains(
"t1-percent")) {
166 t1_percent =
getDouble(network_data,
"t1-percent");
168 if (calculate_tee_times) {
170 (t2_percent.
get() >= 1.0))) {
172 <<
" is invalid, it must be greater than 0.0 and less than 1.0");
176 (t1_percent.
get() >= 1.0))) {
178 <<
" is invalid it must be greater than 0.0 and less than 1.0");
182 (t1_percent.
get() >= t2_percent.
get())) {
184 <<
" is invalid, it must be less than t2-percent: "
185 << t2_percent.
get());
189 network->setT2Percent(t2_percent);
190 network->setT1Percent(t1_percent);
196 if (network_data->contains(
"cache-threshold")) {
197 double cache_threshold =
getDouble(network_data,
"cache-threshold");
198 if ((cache_threshold <= 0.0) || (cache_threshold >= 1.0)) {
200 <<
" is invalid, it must be greater than 0.0 and less than 1.0");
202 network->setCacheThreshold(cache_threshold);
205 if (network_data->contains(
"cache-max-age")) {
206 network->setCacheMaxAge(
getInteger(network_data,
"cache-max-age"));
214 if (network_data->contains(
"ddns-send-updates")) {
215 network->setDdnsSendUpdates(
getBoolean(network_data,
"ddns-send-updates"));
218 if (network_data->contains(
"ddns-override-no-update")) {
219 network->setDdnsOverrideNoUpdate(
getBoolean(network_data,
"ddns-override-no-update"));
222 if (network_data->contains(
"ddns-override-client-update")) {
223 network->setDdnsOverrideClientUpdate(
getBoolean(network_data,
"ddns-override-client-update"));
226 if (network_data->contains(
"ddns-replace-client-name")) {
229 (network_data,
"ddns-replace-client-name",
230 "ReplaceClientName mode"));
233 if (network_data->contains(
"ddns-generated-prefix")) {
234 network->setDdnsGeneratedPrefix(
getString(network_data,
"ddns-generated-prefix"));
237 if (network_data->contains(
"ddns-qualifying-suffix")) {
238 network->setDdnsQualifyingSuffix(
getString(network_data,
"ddns-qualifying-suffix"));
241 std::string hostname_char_set;
242 if (network_data->contains(
"hostname-char-set")) {
243 hostname_char_set =
getString(network_data,
"hostname-char-set");
244 network->setHostnameCharSet(hostname_char_set);
247 std::string hostname_char_replacement;
248 if (network_data->contains(
"hostname-char-replacement")) {
249 hostname_char_replacement =
getString(network_data,
"hostname-char-replacement");
250 network->setHostnameCharReplacement(hostname_char_replacement);
256 if (!hostname_char_set.empty()) {
259 hostname_char_replacement));
260 }
catch (
const std::exception& ex) {
262 <<
"' is not a valid regular expression");
266 if (network_data->contains(
"ddns-update-on-renew")) {
267 network->setDdnsUpdateOnRenew(
getBoolean(network_data,
"ddns-update-on-renew"));
270 if (network_data->contains(
"ddns-ttl-percent")) {
271 network->setDdnsTtlPercent(
getDouble(network_data,
"ddns-ttl-percent"));
275 if (network_data->contains(
"ddns-conflict-resolution-mode")) {
276 network->setDdnsConflictResolutionMode(
getString(network_data,
277 "ddns-conflict-resolution-mode"));
284 if (network_data->contains(
"allocator")) {
285 auto allocator_type =
getString(network_data,
"allocator");
286 if ((allocator_type !=
"iterative") && (allocator_type !=
"random") &&
287 (allocator_type !=
"flq")) {
291 network->setAllocatorType(allocator_type);
298 if (network_data->contains(
"pd-allocator")) {
299 auto allocator_type =
getString(network_data,
"pd-allocator");
300 if ((allocator_type !=
"iterative") && (allocator_type !=
"random") &&
301 (allocator_type !=
"flq")) {
305 network->setPdAllocatorType(allocator_type);
312 if (network_data->contains(
"offer-lifetime")) {
313 auto value =
getInteger(network_data,
"offer-lifetime");
316 << value <<
"' must be a positive number ("
317 <<
getPosition(
"offer-lifetime", network_data) <<
")");
320 network->setOfferLft(value);
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
static ElementPtr create(const Position &pos=ZERO_POSITION())
target_type getAndConvert(isc::data::ConstElementPtr scope, const std::string &name, const std::string &type_name)
Returns a converted value from a scope.
static const data::Element::Position & getPosition(const std::string &name, const data::ConstElementPtr parent)
Utility method that returns position of an element.
static double getDouble(const ConstElementPtr &scope, const std::string &name)
Returns a floating point parameter from a scope.
static std::string getString(isc::data::ConstElementPtr scope, const std::string &name)
Returns a string parameter from a scope.
const isc::util::Triplet< uint32_t > parseIntTriplet(const data::ConstElementPtr &scope, const std::string &name)
Parses an integer triplet.
static bool getBoolean(isc::data::ConstElementPtr scope, const std::string &name)
Returns a boolean parameter from a scope.
static int64_t getInteger(isc::data::ConstElementPtr scope, const std::string &name)
Returns an integer parameter from a scope.
void parseCacheParams(const data::ConstElementPtr &network_data, NetworkPtr &network)
Parses parameters related to lease cache settings.
void parseAllocatorParams(const data::ConstElementPtr &network_data, NetworkPtr &network)
Parses parameters pertaining to allocator selection.
void parseDdnsParams(const data::ConstElementPtr &network_data, NetworkPtr &network)
Parses parameters pertaining to DDNS behavior.
void parseCommon(const data::ConstElementPtr &network_data, NetworkPtr &network)
Parses common parameters.
static void moveReservationMode(isc::data::ElementPtr config)
Moves deprecated reservation-mode parameter to new reservations flags.
void parseTeePercents(const data::ConstElementPtr &network_data, NetworkPtr &network)
Parses parameters related to "percent" timers settings.
void parsePdAllocatorParams(const data::ConstElementPtr &network_data, Network6Ptr &network)
Parses parameters pertaining to prefix delegation allocator selection.
void parseOfferLft(const data::ConstElementPtr &network_data, Network4Ptr &network)
Parses offer-lifetime parameter (v4 only)
@ RESERVATIONS_OUT_OF_POOL
static ReplaceClientNameMode stringToReplaceClientNameMode(const std::string &mode_str)
Converts labels to ReplaceClientNameMode enum values.
ReplaceClientNameMode
Defines the client name replacement modes.
To be removed. Please use ConfigError instead.
T get() const
Retrieves the encapsulated value.
void unspecified(bool unspecified)
Modifies the flag that indicates whether the value is specified or unspecified.
Implements a regular expression based string scrubber.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
#define LOG_WARN(LOGGER, MESSAGE)
Macro to conveniently test warn output and log it.
boost::shared_ptr< const Element > ConstElementPtr
boost::shared_ptr< Element > ElementPtr
isc::log::Logger dhcpsrv_logger("dhcpsrv")
DHCP server library Logger.
boost::shared_ptr< Network4 > Network4Ptr
Pointer to the Network4 object.
const isc::log::MessageID DHCPSRV_CFGMGR_RENEW_GTR_REBIND
boost::shared_ptr< CfgGlobals > CfgGlobalsPtr
Non-const shared pointer to a CfgGlobals instance.
boost::shared_ptr< Network6 > Network6Ptr
Pointer to the Network6 object.
boost::shared_ptr< Network > NetworkPtr
Pointer to the Network object.
boost::shared_ptr< StringSanitizer > StringSanitizerPtr
Type representing the pointer to the StringSanitizer.
Defines the logger used by the top-level component of kea-lfc.