160 const std::string& name);
172 const std::string& name);
186 const std::string& name, T& output_value) {
187 auto min = std::numeric_limits<T>::min();
188 auto max = std::numeric_limits<T>::max();
191 if (ivalue < min || ivalue > max) {
193 "'" << name <<
"' : " << ivalue <<
" is out of range,"
194 <<
" must be >= " << min <<
" and <= " << max);
197 output_value =
static_cast<T
>(ivalue);
214 const std::string& name,
215 int64_t min, int64_t max);
227 const std::string& name);
253 const std::string& name);
267 template <
typename int_type> int_type
269 const std::string& name) {
271 if ((val_int < std::numeric_limits<int_type>::min()) ||
272 (val_int > std::numeric_limits<int_type>::max())) {
274 "out of range value (" << val_int
275 <<
") specified for parameter '" << name
278 return (
static_cast<int_type
>(val_int));
293 template <
typename target_type,
294 target_type convert(
const std::string&)> target_type
296 const std::string& name,
297 const std::string& type_name) {
298 std::string str =
getString(scope, name);
300 return (convert(str));
301 }
catch (
const std::exception&) {
303 "invalid " << type_name <<
" (" << str
304 <<
") specified for parameter '" << name
319 const std::string& name) {
332 const std::string& name) {
359 const std::string& name);
The IOAddress class represents an IP addresses (version agnostic).
types
The types that an Element can hold.
static void checkKeywords(const SimpleKeywords &keywords, isc::data::ConstElementPtr scope)
Checks acceptable keywords with their expected type.
target_type getAndConvert(isc::data::ConstElementPtr scope, const std::string &name, const std::string &type_name)
Returns a converted value from a scope.
static size_t setListDefaults(isc::data::ConstElementPtr list, const SimpleDefaults &default_values)
Sets the default values for all entries in a list.
static const data::Element::Position & getPosition(const std::string &name, const data::ConstElementPtr parent)
Utility method that returns position of an element.
uint8_t getUint8(ConstElementPtr scope, const std::string &name)
Get an uint8_t value.
static double getDouble(const ConstElementPtr &scope, const std::string &name)
Returns a floating point parameter from a scope.
static void checkRequired(const SimpleRequiredKeywords &required, isc::data::ConstElementPtr scope)
Checks that all required keywords are present.
static isc::asiolink::IOAddress getAddress(const ConstElementPtr &scope, const std::string &name)
Returns a IOAddress parameter from a scope.
static std::string getString(isc::data::ConstElementPtr scope, const std::string &name)
Returns a string parameter from a scope.
uint32_t getUint32(isc::data::ConstElementPtr scope, const std::string &name)
Returns a value converted to uint32_t.
static void rangeCheckedInteger(isc::data::ConstElementPtr scope, const std::string &name, T &output_value)
Fetches a range-checked integer parameter from a scope.
const isc::util::Triplet< uint32_t > parseIntTriplet(const data::ConstElementPtr &scope, const std::string &name)
Parses an integer triplet.
int_type getIntType(isc::data::ConstElementPtr scope, const std::string &name)
Returns an integer value with range checking from a scope.
static bool getBoolean(isc::data::ConstElementPtr scope, const std::string &name)
Returns a boolean parameter from a scope.
uint16_t getUint16(isc::data::ConstElementPtr scope, const std::string &name)
Returns a value converted to uint16_t.
static size_t deriveParams(isc::data::ConstElementPtr parent, isc::data::ElementPtr child, const ParamsList ¶ms)
Derives (inherits) parameters from parent scope to a child.
static int64_t getInteger(isc::data::ConstElementPtr scope, const std::string &name)
Returns an integer parameter from a scope.
static size_t setDefaults(isc::data::ElementPtr scope, const SimpleDefaults &default_values)
Sets the default values.
To be removed. Please use ConfigError instead.
This template specifies a parameter value.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
std::vector< std::string > SimpleRequiredKeywords
This specifies all required keywords.
std::vector< std::string > ParamsList
This defines a list of all parameters that are derived (or inherited) between contexts.
boost::shared_ptr< const Element > ConstElementPtr
std::vector< SimpleDefault > SimpleDefaults
This specifies all default values in a given scope (e.g. a subnet).
boost::shared_ptr< Element > ElementPtr
std::map< std::string, isc::data::Element::types > SimpleKeywords
This specifies all accepted keywords with their types.
Defines the logger used by the top-level component of kea-lfc.
Represents the position of the data element within a configuration string.
const isc::data::Element::types type_
SimpleDefault(const char *name, isc::data::Element::types type, const char *value)