7#ifndef BASE_NETWORK_PARSER_H
8#define BASE_NETWORK_PARSER_H
175 template<
typename DdnsOwnerTypePtr>
177 DdnsOwnerTypePtr owner) {
179 if (config->contains(
"ddns-send-updates")) {
180 owner->setDdnsSendUpdates(
getBoolean(config,
"ddns-send-updates"));
183 if (config->contains(
"ddns-override-no-update")) {
184 owner->setDdnsOverrideNoUpdate(
getBoolean(config,
"ddns-override-no-update"));
187 if (config->contains(
"ddns-override-client-update")) {
188 owner->setDdnsOverrideClientUpdate(
getBoolean(config,
"ddns-override-client-update"));
191 if (config->contains(
"ddns-replace-client-name")) {
194 (config,
"ddns-replace-client-name",
195 "ReplaceClientName mode"));
198 if (config->contains(
"ddns-generated-prefix")) {
199 owner->setDdnsGeneratedPrefix(
getString(config,
"ddns-generated-prefix"));
202 if (config->contains(
"ddns-qualifying-suffix")) {
203 owner->setDdnsQualifyingSuffix(
getString(config,
"ddns-qualifying-suffix"));
206 std::string hostname_char_set;
207 if (config->contains(
"hostname-char-set")) {
208 hostname_char_set =
getString(config,
"hostname-char-set");
209 owner->setHostnameCharSet(hostname_char_set);
212 std::string hostname_char_replacement;
213 if (config->contains(
"hostname-char-replacement")) {
214 hostname_char_replacement =
getString(config,
"hostname-char-replacement");
215 owner->setHostnameCharReplacement(hostname_char_replacement);
221 if (!hostname_char_set.empty()) {
225 hostname_char_replacement));
226 }
catch (
const std::exception& ex) {
228 <<
"' is not a valid regular expression");
232 if (config->contains(
"ddns-update-on-renew")) {
233 owner->setDdnsUpdateOnRenew(
getBoolean(config,
"ddns-update-on-renew"));
236 bool has_ddns_ttl =
false;
237 uint32_t ddns_ttl = 0;
238 if (config->contains(
"ddns-ttl")) {
240 owner->setDdnsTtl(ddns_ttl);
244 if (config->contains(
"ddns-ttl-percent")) {
249 owner->setDdnsTtlPercent(
getDouble(config,
"ddns-ttl-percent"));
252 uint32_t ddns_ttl_min = 0;
253 if (config->contains(
"ddns-ttl-min")) {
258 ddns_ttl_min =
getInteger(config,
"ddns-ttl-min");
259 owner->setDdnsTtlMin(ddns_ttl_min);
262 if (config->contains(
"ddns-ttl-max")) {
267 uint32_t ddns_ttl_max =
getInteger(config,
"ddns-ttl-max");
268 if (ddns_ttl_max < ddns_ttl_min) {
270 <<
" must be greater than ddns-ttl-min: " << ddns_ttl_min);
273 owner->setDdnsTtlMax(ddns_ttl_max);
277 if (config->contains(
"ddns-conflict-resolution-mode")) {
278 owner->setDdnsConflictResolutionMode(
getString(config,
279 "ddns-conflict-resolution-mode"));
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
target_type getAndConvert(isc::data::ConstElementPtr scope, const std::string &name, const std::string &type_name)
Returns a converted value from a scope.
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.
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.
Common configuration parser for shared networks and subnets.
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.
static void getClientClassesElem(data::ConstElementPtr params, ClassAdderFunc adder_func)
Fetches the element for either 'client-classes' or deprecated 'client-class'.
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.
std::function< void(const isc::dhcp::ClientClass &)> ClassAdderFunc
void parseDdnsParameters(const data::ConstElementPtr &config, DdnsOwnerTypePtr owner)
Parses parameters pertaining to DDNS behavior.
static void getAdditionalClassesElem(data::ConstElementPtr params, ClassAdderFunc adder_func)
Fetches the element for either 'evaluate-additional-classes' or deprecated 'require-client-classes'.
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)
static ReplaceClientNameMode stringToReplaceClientNameMode(const std::string &mode_str)
Converts labels to ReplaceClientNameMode enum values.
ReplaceClientNameMode
Defines the client name replacement modes.
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
std::string ClientClass
Defines a single class name.
boost::shared_ptr< Network4 > Network4Ptr
Pointer to the Network4 object.
boost::shared_ptr< Network6 > Network6Ptr
Pointer to the Network6 object.
boost::shared_ptr< Network > NetworkPtr
Pointer to the Network object.
std::unique_ptr< StringSanitizer > StringSanitizerPtr
Type representing the pointer to the StringSanitizer.
Defines the logger used by the top-level component of kea-lfc.