} else if (config_id.compare("match-client-id") == 0) {
parser = new BooleanParser(config_id, globalContext()->boolean_values_);
// control-socket has been converted to SimpleParser already.
- } else if (config_id.compare("expired-leases-processing") == 0) {
- parser = new ExpirationConfigParser();
+ // expired-leases-processing has been converted to SimpleParser already.
} else if (config_id.compare("client-classes") == 0) {
parser = new ClientClassDefListParser(config_id, globalContext());
// host-reservation-identifiers have been converted to SimpleParser already.
continue;
}
+ if (config_pair.first == "expired-leases-processing") {
+ ExpirationConfigParser parser;
+ parser.parse(config_pair.second);
+ continue;
+ }
+
ParserPtr parser(createGlobalDhcp4ConfigParser(config_pair.first,
config_pair.second));
LOG_DEBUG(dhcp4_logger, DBG_DHCP4_DETAIL, DHCP4_PARSER_CREATED)
} else if (config_id.compare("relay-supplied-options") == 0) {
parser = new RSOOListConfigParser(config_id);
// control-socket has been converted to SimpleParser.
- } else if (config_id.compare("expired-leases-processing") == 0) {
- parser = new ExpirationConfigParser();
+ // expired-leases-processing has been converted to SimpleParser.
} else if (config_id.compare("client-classes") == 0) {
parser = new ClientClassDefListParser(config_id, globalContext());
} else if (config_id.compare("server-id") == 0) {
continue;
}
+ if (config_pair.first == "expired-leases-processing") {
+ ExpirationConfigParser parser;
+ parser.parse(config_pair.second);
+ continue;
+ }
+
ParserPtr parser(createGlobal6DhcpConfigParser(config_pair.first,
config_pair.second));
LOG_DEBUG(dhcp6_logger, DBG_DHCP6_DETAIL, DHCP6_PARSER_CREATED)
-// Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2015,2017 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <dhcpsrv/cfg_expiration.h>
#include <dhcpsrv/cfgmgr.h>
#include <dhcpsrv/parsers/expiration_config_parser.h>
+#include <dhcpsrv/parsers/dhcp_parsers.h>
#include <boost/foreach.hpp>
using namespace isc::data;
namespace isc {
namespace dhcp {
-ExpirationConfigParser::ExpirationConfigParser()
- : DhcpConfigParser() {
-}
-
void
-ExpirationConfigParser::build(ConstElementPtr expiration_config) {
+ExpirationConfigParser::parse(ConstElementPtr expiration_config) {
CfgExpirationPtr cfg = CfgMgr::instance().getStagingCfg()->getCfgExpiration();
BOOST_FOREACH(ConfigPair config_element, expiration_config->mapValue()) {
}
}
-void
-ExpirationConfigParser::commit() {
- // Nothing to do.
-}
-
} // end of namespace isc::dhcp
} // end of namespace isc
-// Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2015,2017 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#ifndef EXPIRATION_CONFIG_PARSER_H
#define EXPIRATION_CONFIG_PARSER_H
-#include <dhcpsrv/parsers/dhcp_config_parser.h>
+#include <cc/data.h>
+#include <cc/simple_parser.h>
namespace isc {
namespace dhcp {
/// those that aren't specified.
///
/// The parser checks if the values of the specified parameters are within
-/// the allowed ranges and throws exception if they are. Each parameter
+/// the allowed ranges and throws exception if they aren't. Each parameter
/// has a corresponding maximum value defined in the @c CfgExpiration class.
/// None of them may be negative.
-class ExpirationConfigParser : public DhcpConfigParser {
+class ExpirationConfigParser : public isc::data::SimpleParser {
public:
- /// @brief Constructor
- ExpirationConfigParser();
+ /// @brief Destructor.
+ virtual ~ExpirationConfigParser() { }
/// @brief Parses parameters in the JSON map, pertaining to the processing
/// of the expired leases.
///
- /// @param value pointer to the content of parsed values
+ /// @param expiration_config pointer to the content of parsed values
///
/// @throw DhcpConfigError if unknown parameter specified or the
/// parameter contains invalid value..
- virtual void build(isc::data::ConstElementPtr value);
-
- /// @brief Does nothing.
- virtual void commit();
+ void parse(isc::data::ConstElementPtr expiration_config);
};
-// Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2015,2017 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <dhcpsrv/cfgmgr.h>
#include <dhcpsrv/cfg_expiration.h>
#include <dhcpsrv/parsers/expiration_config_parser.h>
+#include <dhcpsrv/parsers/dhcp_parsers.h>
#include <gtest/gtest.h>
#include <sstream>
#include <stdint.h>
// Parse the configuration. This may emit exceptions.
ExpirationConfigParser parser;
- parser.build(config_element);
+ parser.parse(config_element);
// No exception so return configuration.
return (CfgMgr::instance().getStagingCfg()->getCfgExpiration());
// Parse the configuration. It should throw exception.
ExpirationConfigParser parser;
- EXPECT_THROW(parser.build(config_element), DhcpConfigError);
+ EXPECT_THROW(parser.parse(config_element), DhcpConfigError);
}
} // end of anonymous namespace