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

[3978] Tentative leases-reclaim command

This commit is contained in:
Francis Dupont
2015-10-16 23:01:33 +02:00
parent 8f5ca179e1
commit 008b74a6ff
4 changed files with 54 additions and 0 deletions

View File

@@ -107,6 +107,16 @@ ControlledDhcpv4Srv::processCommand(const string& command,
}
}
ConstElementPtr
ControlledDhcpv4Srv::commandLeasesReclaimHandler(const string&, ConstElementPtr args) {
server_->alloc_engine_->reclaimExpiredLeases4(0, 0, true);
ConstElementPtr answer = isc::config::createAnswer(0,
"Leases successfully reclaimed/");
return (answer);
}
isc::data::ConstElementPtr
ControlledDhcpv4Srv::processConfig(isc::data::ConstElementPtr config) {
@@ -212,6 +222,9 @@ ControlledDhcpv4Srv::ControlledDhcpv4Srv(uint16_t port /*= DHCP4_SERVER_PORT*/)
/// @todo: register config-reload (see CtrlDhcpv4Srv::commandConfigReloadHandler)
/// @todo: register libreload (see CtrlDhcpv4Srv::commandLibReloadHandler)
CommandMgr::instance().registerCommand("leases-reclaim",
boost::bind(&ControlledDhcpv4Srv::commandLeasesReclaimHandler, this, _1, _2));
// Register statistic related commands
CommandMgr::instance().registerCommand("statistic-get",
boost::bind(&StatsMgr::statisticGetHandler, _1, _2));
@@ -251,6 +264,7 @@ ControlledDhcpv4Srv::~ControlledDhcpv4Srv() {
// Deregister any registered commands
CommandMgr::instance().deregisterCommand("shutdown");
CommandMgr::instance().deregisterCommand("leases-reclaim");
CommandMgr::instance().deregisterCommand("statistic-get");
CommandMgr::instance().deregisterCommand("statistic-reset");
CommandMgr::instance().deregisterCommand("statistic-remove");

View File

@@ -151,6 +151,19 @@ private:
isc::data::ConstElementPtr args);
/// @brief handler for processing 'leases-reclaim' command
///
/// This handler processes leases-reclaim command, which triggers
/// the leases reclamation immediately
///
/// @param command (parameter ignored)
/// @param args (parameter ignored)
///
/// @return status of the command
isc::data::ConstElementPtr
commandLeasesReclaimHandler(const std::string& command,
isc::data::ConstElementPtr args);
/// @brief Reclaims expired IPv4 leases and reschedules timer.
///
/// This is a wrapper method for @c AllocEngine::reclaimExpiredLeases4.

View File

@@ -69,6 +69,16 @@ ControlledDhcpv6Srv::commandConfigReloadHandler(const string&, ConstElementPtr a
return (processConfig(args));
}
ConstElementPtr
ControlledDhcpv6Srv::commandLeasesReclaimHandler(const string&, ConstElementPtr args) {
server_->alloc_engine_->reclaimExpiredLeases6(0, 0, true);
ConstElementPtr answer = isc::config::createAnswer(0,
"Leases successfully reclaimed/");
return (answer);
}
isc::data::ConstElementPtr
ControlledDhcpv6Srv::processCommand(const std::string& command,
isc::data::ConstElementPtr args) {
@@ -208,6 +218,9 @@ ControlledDhcpv6Srv::ControlledDhcpv6Srv(uint16_t port)
/// @todo: register config-reload (see CtrlDhcpv4Srv::commandConfigReloadHandler)
/// @todo: register libreload (see CtrlDhcpv4Srv::commandLibReloadHandler)
CommandMgr::instance().registerCommand("leases-reclaim",
boost::bind(&ControlledDhcpv6Srv::commandLeasesReclaimHandler, this, _1, _2));
// Register statistic related commands
CommandMgr::instance().registerCommand("statistic-get",
boost::bind(&StatsMgr::statisticGetHandler, _1, _2));
@@ -247,6 +260,7 @@ ControlledDhcpv6Srv::~ControlledDhcpv6Srv() {
// Deregister any registered commands
CommandMgr::instance().deregisterCommand("shutdown");
CommandMgr::instance().deregisterCommand("leases-reclaim");
CommandMgr::instance().deregisterCommand("statistic-get");
CommandMgr::instance().deregisterCommand("statistic-reset");
CommandMgr::instance().deregisterCommand("statistic-remove");

View File

@@ -150,6 +150,19 @@ private:
commandConfigReloadHandler(const std::string& command,
isc::data::ConstElementPtr args);
/// @brief handler for processing 'leases-reclaim' command
///
/// This handler processes leases-reclaim command, which triggers
/// the leases reclamation immediately
///
/// @param command (parameter ignored)
/// @param args (parameter ignored)
///
/// @return status of the command
isc::data::ConstElementPtr
commandLeasesReclaimHandler(const std::string& command,
isc::data::ConstElementPtr args);
/// @brief Reclaims expired IPv6 leases and reschedules timer.
///
/// This is a wrapper method for @c AllocEngine::reclaimExpiredLeases6.