diff options
Diffstat (limited to 'src/bin/dhcp6/ctrl_dhcp6_srv.cc')
-rw-r--r-- | src/bin/dhcp6/ctrl_dhcp6_srv.cc | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/src/bin/dhcp6/ctrl_dhcp6_srv.cc b/src/bin/dhcp6/ctrl_dhcp6_srv.cc index ab0fd5095d..10363c30b8 100644 --- a/src/bin/dhcp6/ctrl_dhcp6_srv.cc +++ b/src/bin/dhcp6/ctrl_dhcp6_srv.cc @@ -16,6 +16,7 @@ #include <dhcp6/json_config_parser.h> #include <hooks/hooks_manager.h> #include <stats/stats_mgr.h> +#include <cfgrpt/config_report.h> using namespace isc::config; using namespace isc::data; @@ -212,6 +213,24 @@ ControlledDhcpv6Srv::commandSetConfigHandler(const string&, ConstElementPtr +ControlledDhcpv6Srv::commandVersionGetHandler(const string&, ConstElementPtr) { + ElementPtr extended = Element::create(Dhcpv6Srv::getVersion(true)); + ElementPtr arguments = Element::createMap(); + arguments->set("extended", extended); + ConstElementPtr answer = isc::config::createAnswer(0, + Dhcpv6Srv::getVersion(false), + arguments); + return (answer); +} + +ConstElementPtr +ControlledDhcpv6Srv::commandBuildReportHandler(const string&, ConstElementPtr) { + ConstElementPtr answer = + isc::config::createAnswer(0, isc::detail::getConfigReport()); + return (answer); +} + +ConstElementPtr ControlledDhcpv6Srv::commandLeasesReclaimHandler(const string&, ConstElementPtr args) { int status_code = 1; @@ -268,6 +287,12 @@ ControlledDhcpv6Srv::processCommand(const std::string& command, } else if (command == "config-get") { return (srv->commandConfigGetHandler(command, args)); + } else if (command == "version-get") { + return (srv->commandVersionGetHandler(command, args)); + + } else if (command == "build-report") { + return (srv->commandBuildReportHandler(command, args)); + } else if (command == "leases-reclaim") { return (srv->commandLeasesReclaimHandler(command, args)); @@ -427,6 +452,9 @@ ControlledDhcpv6Srv::ControlledDhcpv6Srv(uint16_t port) // These are the commands always supported by the DHCPv6 server. // Please keep the list in alphabetic order. + CommandMgr::instance().registerCommand("build-report", + boost::bind(&ControlledDhcpv6Srv::commandBuildReportHandler, this, _1, _2)); + CommandMgr::instance().registerCommand("config-get", boost::bind(&ControlledDhcpv6Srv::commandConfigGetHandler, this, _1, _2)); @@ -447,6 +475,9 @@ ControlledDhcpv6Srv::ControlledDhcpv6Srv(uint16_t port) CommandMgr::instance().registerCommand("shutdown", boost::bind(&ControlledDhcpv6Srv::commandShutdownHandler, this, _1, _2)); + CommandMgr::instance().registerCommand("version-get", + boost::bind(&ControlledDhcpv6Srv::commandVersionGetHandler, this, _1, _2)); + // Register statistic related commands CommandMgr::instance().registerCommand("statistic-get", boost::bind(&StatsMgr::statisticGetHandler, _1, _2)); @@ -485,10 +516,11 @@ ControlledDhcpv6Srv::~ControlledDhcpv6Srv() { CommandMgr::instance().closeCommandSocket(); // Deregister any registered commands (please keep in alphabetic order) + CommandMgr::instance().deregisterCommand("build-report"); CommandMgr::instance().deregisterCommand("config-get"); CommandMgr::instance().deregisterCommand("config-write"); - CommandMgr::instance().deregisterCommand("libreload"); CommandMgr::instance().deregisterCommand("leases-reclaim"); + CommandMgr::instance().deregisterCommand("libreload"); CommandMgr::instance().deregisterCommand("set-config"); CommandMgr::instance().deregisterCommand("shutdown"); CommandMgr::instance().deregisterCommand("statistic-get"); @@ -497,6 +529,7 @@ ControlledDhcpv6Srv::~ControlledDhcpv6Srv() { CommandMgr::instance().deregisterCommand("statistic-remove-all"); CommandMgr::instance().deregisterCommand("statistic-reset"); CommandMgr::instance().deregisterCommand("statistic-reset-all"); + CommandMgr::instance().deregisterCommand("version-get"); } catch (...) { // Don't want to throw exceptions from the destructor. The server |