|
@@ -17,6 +17,7 @@
|
|
#include <dhcpsrv/dhcpsrv_log.h>
|
|
#include <dhcpsrv/dhcpsrv_log.h>
|
|
#include <dhcpsrv/lease_file_loader.h>
|
|
#include <dhcpsrv/lease_file_loader.h>
|
|
#include <dhcpsrv/memfile_lease_mgr.h>
|
|
#include <dhcpsrv/memfile_lease_mgr.h>
|
|
|
|
+#include <dhcpsrv/database_connection.h>
|
|
#include <exceptions/exceptions.h>
|
|
#include <exceptions/exceptions.h>
|
|
#include <util/pid_file.h>
|
|
#include <util/pid_file.h>
|
|
#include <util/process_spawn.h>
|
|
#include <util/process_spawn.h>
|
|
@@ -220,21 +221,13 @@ LFCSetup::getExitStatus() const {
|
|
return (process_->getExitStatus(pid_));
|
|
return (process_->getExitStatus(pid_));
|
|
}
|
|
}
|
|
|
|
|
|
-std::string
|
|
|
|
-Memfile_LeaseMgr::getParameter(const std::string& name) const {
|
|
|
|
- ParameterMap::const_iterator param = parameters_.find(name);
|
|
|
|
- if (param == parameters_.end()) {
|
|
|
|
- isc_throw(BadValue, "Parameter " << name << " not found");
|
|
|
|
- }
|
|
|
|
- return (param->second);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-Memfile_LeaseMgr::Memfile_LeaseMgr(const ParameterMap& parameters): parameters_(parameters),
|
|
|
|
- lfc_setup_(new LFCSetup(boost::bind(&Memfile_LeaseMgr::lfcCallback, this),
|
|
|
|
- *getIOService()))
|
|
|
|
|
|
+Memfile_LeaseMgr::Memfile_LeaseMgr(const DatabaseConnection::ParameterMap& parameters):
|
|
|
|
+ lfc_setup_(new LFCSetup(boost::bind(&Memfile_LeaseMgr::lfcCallback, this),
|
|
|
|
+ *getIOService())),
|
|
|
|
+ conn_(parameters)
|
|
{
|
|
{
|
|
// Check the universe and use v4 file or v6 file.
|
|
// Check the universe and use v4 file or v6 file.
|
|
- std::string universe = getParameter("universe");
|
|
|
|
|
|
+ std::string universe = conn_.getParameter("universe");
|
|
if (universe == "4") {
|
|
if (universe == "4") {
|
|
std::string file4 = initLeaseFilePath(V4);
|
|
std::string file4 = initLeaseFilePath(V4);
|
|
if (!file4.empty()) {
|
|
if (!file4.empty()) {
|
|
@@ -696,7 +689,7 @@ std::string
|
|
Memfile_LeaseMgr::initLeaseFilePath(Universe u) {
|
|
Memfile_LeaseMgr::initLeaseFilePath(Universe u) {
|
|
std::string persist_val;
|
|
std::string persist_val;
|
|
try {
|
|
try {
|
|
- persist_val = getParameter("persist");
|
|
|
|
|
|
+ persist_val = conn_.getParameter("persist");
|
|
} catch (const Exception& ex) {
|
|
} catch (const Exception& ex) {
|
|
// If parameter persist hasn't been specified, we use a default value
|
|
// If parameter persist hasn't been specified, we use a default value
|
|
// 'yes'.
|
|
// 'yes'.
|
|
@@ -714,7 +707,7 @@ Memfile_LeaseMgr::initLeaseFilePath(Universe u) {
|
|
|
|
|
|
std::string lease_file;
|
|
std::string lease_file;
|
|
try {
|
|
try {
|
|
- lease_file = getParameter("name");
|
|
|
|
|
|
+ lease_file = conn_.getParameter("name");
|
|
} catch (const Exception& ex) {
|
|
} catch (const Exception& ex) {
|
|
lease_file = getDefaultLeaseFilePath(u);
|
|
lease_file = getDefaultLeaseFilePath(u);
|
|
}
|
|
}
|
|
@@ -800,7 +793,7 @@ void
|
|
Memfile_LeaseMgr::lfcSetup() {
|
|
Memfile_LeaseMgr::lfcSetup() {
|
|
std::string lfc_interval_str = "0";
|
|
std::string lfc_interval_str = "0";
|
|
try {
|
|
try {
|
|
- lfc_interval_str = getParameter("lfc-interval");
|
|
|
|
|
|
+ lfc_interval_str = conn_.getParameter("lfc-interval");
|
|
} catch (const std::exception& ex) {
|
|
} catch (const std::exception& ex) {
|
|
// Ignore and default to 0.
|
|
// Ignore and default to 0.
|
|
}
|
|
}
|