2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-30 21:45:37 +00:00

[5097] Migrated (checkpoint as user-context are missing in flex/bison)

This commit is contained in:
Francis Dupont
2017-01-12 01:14:50 +01:00
parent 91a546c3f1
commit 3e674fdaf2
4 changed files with 163 additions and 258 deletions

View File

@@ -58,12 +58,8 @@ public:
/// @brief Constructor.
///
/// @param param_name name of the parameter. Note, it is passed through
/// but unused, parameter is currently always "Dhcp4/subnet4[X]/pool"
/// @param pools storage container in which to store the parsed pool
/// upon "commit"
Pool4Parser(const std::string& param_name, PoolStoragePtr pools)
:PoolParser(param_name, pools, AF_INET) {
/// @param pools storage container in which to store the parsed pool.
Pool4Parser(PoolStoragePtr pools) : PoolParser(pools) {
}
protected:
@@ -90,15 +86,26 @@ protected:
}
};
class Pools4ListParser : public PoolsListParser {
/// @brief Specialization of the pool list parser for DHCPv4
class Pools4ListParser : PoolsListParser {
public:
Pools4ListParser(const std::string& dummy, PoolStoragePtr pools)
:PoolsListParser(dummy, pools) {
/// @brief Constructor.
///
/// @param pools storage container in which to store the parsed pool.
Pools4ListParser(PoolStoragePtr pools) : PoolsListParser(pools) {
}
protected:
virtual ParserPtr poolParserMaker(PoolStoragePtr storage) {
return (ParserPtr(new Pool4Parser("pool", storage)));
/// @brief parses the actual structure
///
/// This method parses the actual list of pools.
///
/// @param pools_list a list of pool structures
/// @throw isc::dhcp::DhcpConfigError when pool parsing fails
void parse(isc::data::ConstElementPtr pools_list) {
BOOST_FOREACH(ConstElementPtr pool, pools_list->listValue()) {
Pool4Parser parser(pools_);
parser.parse(pool, AF_INET);
}
}
};
@@ -123,6 +130,13 @@ public:
///
/// @param subnet A new subnet being configured.
void build(ConstElementPtr subnet) {
/// Parse Pools first.
ConstElementPtr pools = subnet->get("pools");
if (pools) {
Pools4ListParser parser(pools_);
parser.parse(pools);
}
SubnetConfigParser::build(subnet);
if (subnet_) {
@@ -186,9 +200,8 @@ protected:
(config_id.compare("next-server") == 0) ||
(config_id.compare("reservation-mode") == 0)) {
parser = new StringParser(config_id, string_values_);
} else if (config_id.compare("pools") == 0) {
parser = new Pools4ListParser(config_id, pools_);
// relay has been converted to SimpleParser already.
// pools has been converted to SimpleParser already.
// relay has been converted to SimpleParser already.
// option-data has been converted to SimpleParser already.
} else if (config_id.compare("match-client-id") == 0) {
parser = new BooleanParser(config_id, boolean_values_);