21 if (!config->contains(
"reservation-mode")) {
24 if (config->contains(
"reservations-global") ||
25 config->contains(
"reservations-in-subnet") ||
26 config->contains(
"reservations-out-of-pool")) {
28 " and one of 'reservations-global', 'reservations-in-subnet'"
29 " or 'reservations-out-of-pool' parameters");
31 std::string hr_mode =
getString(config,
"reservation-mode");
32 if ((hr_mode ==
"disabled") || (hr_mode ==
"off")) {
35 }
else if (hr_mode ==
"out-of-pool") {
39 }
else if (hr_mode ==
"global") {
42 }
else if (hr_mode ==
"all") {
51 config->remove(
"reservation-mode");
63 " and one of 'reservations-global', 'reservations-in-subnet'"
64 " or 'reservations-out-of-pool' parameters");
67 if ((hr_mode ==
"disabled") || (hr_mode ==
"off")) {
70 }
else if (hr_mode ==
"out-of-pool") {
74 }
else if (hr_mode ==
"global") {
77 }
else if (hr_mode ==
"all") {
93 bool has_renew = network_data->contains(
"renew-timer");
94 bool has_rebind = network_data->contains(
"rebind-timer");
99 renew =
getInteger(network_data,
"renew-timer");
102 << renew <<
") must be a positive number");
104 network->setT1(renew);
108 rebind =
getInteger(network_data,
"rebind-timer");
111 << rebind <<
") must be a positive number");
113 network->setT2(rebind);
116 if (has_renew && has_rebind && (renew > rebind)) {
118 <<
") is greater than the value of rebind-timer ("
124 if (network_data->contains(
"store-extended-info")) {
125 network->setStoreExtendedInfo(
getBoolean(network_data,
126 "store-extended-info"));
129 if (network_data->contains(
"reservations-global")) {
130 network->setReservationsGlobal(
getBoolean(network_data,
131 "reservations-global"));
134 if (network_data->contains(
"reservations-in-subnet")) {
135 network->setReservationsInSubnet(
getBoolean(network_data,
136 "reservations-in-subnet"));
139 if (network_data->contains(
"reservations-out-of-pool")) {
140 network->setReservationsOutOfPool(
getBoolean(network_data,
141 "reservations-out-of-pool"));
148 bool calculate_tee_times = network->getCalculateTeeTimes();
149 if (network_data->contains(
"calculate-tee-times")) {
150 calculate_tee_times =
getBoolean(network_data,
"calculate-tee-times");
151 network->setCalculateTeeTimes(calculate_tee_times);
155 if (network_data->contains(
"t2-percent")) {
156 t2_percent =
getDouble(network_data,
"t2-percent");
160 if (network_data->contains(
"t1-percent")) {
161 t1_percent =
getDouble(network_data,
"t1-percent");
163 if (calculate_tee_times) {
165 (t2_percent.
get() >= 1.0))) {
167 <<
" is invalid, it must be greater than 0.0 and less than 1.0");
171 (t1_percent.
get() >= 1.0))) {
173 <<
" is invalid it must be greater than 0.0 and less than 1.0");
177 (t1_percent.
get() >= t2_percent.
get())) {
179 <<
" is invalid, it must be less than t2-percent: "
180 << t2_percent.
get());
184 network->setT2Percent(t2_percent);
185 network->setT1Percent(t1_percent);
191 if (network_data->contains(
"cache-threshold")) {
192 double cache_threshold =
getDouble(network_data,
"cache-threshold");
193 if ((cache_threshold <= 0.0) || (cache_threshold >= 1.0)) {
195 <<
" is invalid, it must be greater than 0.0 and less than 1.0");
197 network->setCacheThreshold(cache_threshold);
200 if (network_data->contains(
"cache-max-age")) {
201 network->setCacheMaxAge(
getInteger(network_data,
"cache-max-age"));
209 if (network_data->contains(
"ddns-send-updates")) {
210 network->setDdnsSendUpdates(
getBoolean(network_data,
"ddns-send-updates"));
213 if (network_data->contains(
"ddns-override-no-update")) {
214 network->setDdnsOverrideNoUpdate(
getBoolean(network_data,
"ddns-override-no-update"));
217 if (network_data->contains(
"ddns-override-client-update")) {
218 network->setDdnsOverrideClientUpdate(
getBoolean(network_data,
"ddns-override-client-update"));
221 if (network_data->contains(
"ddns-replace-client-name")) {
224 (network_data,
"ddns-replace-client-name",
225 "ReplaceClientName mode"));
228 if (network_data->contains(
"ddns-generated-prefix")) {
229 network->setDdnsGeneratedPrefix(
getString(network_data,
"ddns-generated-prefix"));
232 if (network_data->contains(
"ddns-qualifying-suffix")) {
233 network->setDdnsQualifyingSuffix(
getString(network_data,
"ddns-qualifying-suffix"));
236 std::string hostname_char_set;
237 if (network_data->contains(
"hostname-char-set")) {
238 hostname_char_set =
getString(network_data,
"hostname-char-set");
239 network->setHostnameCharSet(hostname_char_set);
242 std::string hostname_char_replacement;
243 if (network_data->contains(
"hostname-char-replacement")) {
244 hostname_char_replacement =
getString(network_data,
"hostname-char-replacement");
245 network->setHostnameCharReplacement(hostname_char_replacement);
251 if (!hostname_char_set.empty()) {
254 hostname_char_replacement));
255 }
catch (
const std::exception& ex) {
257 <<
"' is not a valid regular expression");
261 if (network_data->contains(
"ddns-update-on-renew")) {
262 network->setDdnsUpdateOnRenew(
getBoolean(network_data,
"ddns-update-on-renew"));
265 if (network_data->contains(
"ddns-use-conflict-resolution")) {
266 network->setDdnsUseConflictResolution(
getBoolean(network_data,
"ddns-use-conflict-resolution"));
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 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.
@ 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.
boost::shared_ptr< const Element > ConstElementPtr
boost::shared_ptr< Element > ElementPtr
boost::shared_ptr< CfgGlobals > CfgGlobalsPtr
Non-const shared pointer to a CfgGlobals instance.
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.