|
@@ -20,10 +20,12 @@
|
|
|
#include <dhcp4/json_config_parser.h>
|
|
|
#include <dhcpsrv/cfgmgr.h>
|
|
|
#include <config/command_mgr.h>
|
|
|
+#include <stats/stats_mgr.h>
|
|
|
|
|
|
using namespace isc::data;
|
|
|
using namespace isc::hooks;
|
|
|
using namespace isc::config;
|
|
|
+using namespace isc::stats;
|
|
|
using namespace std;
|
|
|
|
|
|
namespace isc {
|
|
@@ -168,16 +170,29 @@ ControlledDhcpv4Srv::ControlledDhcpv4Srv(uint16_t port /*= DHCP4_SERVER_PORT*/)
|
|
|
|
|
|
// Register supported commands in CommandMgr
|
|
|
CommandMgr::instance().registerCommand("shutdown",
|
|
|
- boost::bind(&ControlledDhcpv4Srv::commandShutdownHandler, this, _1, _2));
|
|
|
+ boost::bind(&ControlledDhcpv4Srv::commandShutdownHandler, this, _1, _2));
|
|
|
|
|
|
/// @todo: register config-reload (see CtrlDhcpv4Srv::commandConfigReloadHandler)
|
|
|
/// @todo: register libreload (see CtrlDhcpv4Srv::commandLibReloadHandler)
|
|
|
- /// @todo: register statistic-get (see StatsMgr::get(name))
|
|
|
- /// @todo: register statistic-reset (see StatsMgr::reset(name))
|
|
|
- /// @todo: register statistic-get-all (see StatsMgr::getAll())
|
|
|
- /// @todo: register statistic-reset-all (see StatsMgr::resetAll())
|
|
|
- /// @todo: register statistic-remove (see StatsMgr::del(name))
|
|
|
- /// @todo: register statistic-remove-all (see StatsMgr::removeAll())
|
|
|
+
|
|
|
+ // Register statistic related commands
|
|
|
+ CommandMgr::instance().registerCommand("statistic-get",
|
|
|
+ boost::bind(&StatsMgr::statisticGetHandler, _1, _2));
|
|
|
+
|
|
|
+ CommandMgr::instance().registerCommand("statistic-reset",
|
|
|
+ boost::bind(&StatsMgr::statisticResetHandler, _1, _2));
|
|
|
+
|
|
|
+ CommandMgr::instance().registerCommand("statistic-remove",
|
|
|
+ boost::bind(&StatsMgr::statisticRemoveHandler, _1, _2));
|
|
|
+
|
|
|
+ CommandMgr::instance().registerCommand("statistic-get-all",
|
|
|
+ boost::bind(&StatsMgr::statisticGetAllHandler, _1, _2));
|
|
|
+
|
|
|
+ CommandMgr::instance().registerCommand("statistic-reset-all",
|
|
|
+ boost::bind(&StatsMgr::statisticResetAllHandler, _1, _2));
|
|
|
+
|
|
|
+ CommandMgr::instance().registerCommand("statistic-remove-all",
|
|
|
+ boost::bind(&StatsMgr::statisticRemoveAllHandler, _1, _2));
|
|
|
}
|
|
|
|
|
|
void ControlledDhcpv4Srv::shutdown() {
|
|
@@ -193,6 +208,12 @@ ControlledDhcpv4Srv::~ControlledDhcpv4Srv() {
|
|
|
|
|
|
// Deregister any registered commands
|
|
|
CommandMgr::instance().deregisterCommand("shutdown");
|
|
|
+ CommandMgr::instance().deregisterCommand("statistic-get");
|
|
|
+ CommandMgr::instance().deregisterCommand("statistic-reset");
|
|
|
+ CommandMgr::instance().deregisterCommand("statistic-remove");
|
|
|
+ CommandMgr::instance().deregisterCommand("statistic-get-all");
|
|
|
+ CommandMgr::instance().deregisterCommand("statistic-reset-all");
|
|
|
+ CommandMgr::instance().deregisterCommand("statistic-remove-all");
|
|
|
|
|
|
server_ = NULL; // forget this instance. Noone should call any handlers at
|
|
|
// this stage.
|