Kea 2.7.6
|
Parser for the configuration of interfaces. More...
#include <ifaces_config_parser.h>
Public Member Functions | |
IfacesConfigParser (const uint16_t protocol, bool test_mode) | |
Constructor. | |
void | parse (const CfgIfacePtr &config, const isc::data::ConstElementPtr &values) |
Parses content of the "interfaces-config". | |
Public Member Functions inherited from isc::data::SimpleParser | |
uint16_t | getUint16 (isc::data::ConstElementPtr scope, const std::string &name) |
Returns a value converted to uint16_t. | |
uint32_t | getUint32 (isc::data::ConstElementPtr scope, const std::string &name) |
Returns a value converted to uint32_t. | |
uint8_t | getUint8 (ConstElementPtr scope, const std::string &name) |
Get an uint8_t value. | |
const isc::util::Triplet< uint32_t > | parseIntTriplet (const data::ConstElementPtr &scope, const std::string &name) |
Parses an integer triplet. | |
Additional Inherited Members | |
Static Public Member Functions inherited from isc::data::SimpleParser | |
static void | checkKeywords (const SimpleKeywords &keywords, isc::data::ConstElementPtr scope) |
Checks acceptable keywords with their expected type. | |
static void | checkRequired (const SimpleRequiredKeywords &required, isc::data::ConstElementPtr scope) |
Checks that all required keywords are present. | |
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 isc::asiolink::IOAddress | getAddress (const ConstElementPtr &scope, const std::string &name) |
Returns a IOAddress parameter from a scope. | |
static bool | getBoolean (isc::data::ConstElementPtr scope, const std::string &name) |
Returns a boolean parameter from a scope. | |
static double | getDouble (const ConstElementPtr &scope, const std::string &name) |
Returns a floating point parameter from a scope. | |
static int64_t | getInteger (isc::data::ConstElementPtr scope, const std::string &name) |
Returns an integer parameter from a scope. | |
static int64_t | getInteger (isc::data::ConstElementPtr scope, const std::string &name, int64_t min, int64_t max) |
Returns an integer parameter from a scope and checks its range. | |
static const data::Element::Position & | getPosition (const std::string &name, const data::ConstElementPtr parent) |
Utility method that returns position of an element. | |
static std::string | getString (isc::data::ConstElementPtr scope, const std::string &name) |
Returns a string parameter from a scope. | |
static size_t | setDefaults (isc::data::ElementPtr scope, const SimpleDefaults &default_values) |
Sets the default values. | |
static size_t | setListDefaults (isc::data::ConstElementPtr list, const SimpleDefaults &default_values) |
Sets the default values for all entries in a list. | |
Protected Member Functions inherited from isc::data::SimpleParser | |
template<typename target_type , target_type convert> | |
target_type | getAndConvert (isc::data::ConstElementPtr scope, const std::string &name, const std::string &type_name) |
Returns a converted value from a scope. | |
template<typename int_type > | |
int_type | getIntType (isc::data::ConstElementPtr scope, const std::string &name) |
Returns an integer value with range checking from a scope. | |
Parser for the configuration of interfaces.
This parser parses the "interfaces-config" parameter which holds the full configuration of the DHCP server with respect to the use of interfaces, DHCP traffic sockets and alike.
This parser is used in both DHCPv4 and DHCPv6. Derived parsers are not needed.
Definition at line 26 of file ifaces_config_parser.h.
isc::dhcp::IfacesConfigParser::IfacesConfigParser | ( | const uint16_t | protocol, |
bool | test_mode ) |
Constructor.
In test mode only the configuration is checked. In particular sockets are not opened or closed.
protocol | AF_INET for DHCPv4 and AF_INET6 for DHCPv6. |
test_mode | True if in test mode, False if not. |
Definition at line 35 of file ifaces_config_parser.cc.
void isc::dhcp::IfacesConfigParser::parse | ( | const CfgIfacePtr & | config, |
const isc::data::ConstElementPtr & | values ) |
Parses content of the "interfaces-config".
config | parsed structures will be stored here |
values | pointer to the content of parsed values |
DhcpConfigError | if the interface names and/or addresses are invalid. |
Definition at line 40 of file ifaces_config_parser.cc.
References isc::dhcp::IfaceMgr::clearIfaces(), isc::dhcp::IfaceMgr::detectIfaces(), isc::dhcp::DHCPSRV_CFGMGR_SOCKET_TYPE_DEFAULT, isc::dhcp::dhcpsrv_logger, isc::data::SimpleParser::getBoolean(), isc::dhcp::IfaceMgr::instance(), isc_throw, LOG_INFO, and isc::dhcp::CfgIface::textToOutboundIface().
Referenced by isc::dhcp::configureDhcp4Server(), and isc::dhcp::configureDhcp6Server().