#include <config.h>
#include <config/command_mgr.h>
+#include <config/http_command_mgr.h>
#include <d2/d2_controller.h>
#include <d2/d2_process.h>
#include <d2/parser_context.h>
void
D2Controller::deregisterCommands() {
try {
- // Close the command socket (if it exists).
+ // Close command sockets.
CommandMgr::instance().closeCommandSocket();
+ HttpCommandMgr::instance().close();
// Deregister any registered commands (please keep in alphabetic order)
CommandMgr::instance().deregisterCommand(BUILD_REPORT_COMMAND);
#include <asiolink/io_service_mgr.h>
#include <cc/command_interpreter.h>
#include <config/command_mgr.h>
+#include <config/http_command_mgr.h>
#include <d2/d2_controller.h>
#include <d2/d2_process.h>
#include <d2srv/d2_cfg_mgr.h>
void
D2Process::init() {
- // CommandMgr uses IO service to run asynchronous socket operations.
+ // CommandMgrs use IO service to run asynchronous socket operations.
isc::config::CommandMgr::instance().setIOService(getIOService());
+ isc::config::HttpCommandMgr::instance().setIOService(getIOService());
};
void
// service is stopped it will return immediately with a cnt of zero.
cnt = getIOService()->runOne();
}
+ config::HttpCommandMgr::instance().garbageCollectListeners();
return (cnt);
}
// Commit the new socket configuration.
current_control_socket_ = sock_cfg;
+
+ // HTTP control socket is simpler: just (re)configure it.
+
+ // Get new config.
+ HttpCommandConfigPtr http_config =
+ getD2CfgMgr()->getHttpControlSocketInfo();
+ HttpCommandMgr::instance().configure(http_config);
}
} // namespace isc::d2
#include <cc/command_interpreter.h>
#include <cc/data.h>
#include <config/command_mgr.h>
+#include <config/http_command_mgr.h>
#include <cryptolink/crypto_hash.h>
#include <dhcp/libdhcp++.h>
#include <dhcp4/ctrl_dhcp4_srv.h>
// TimerMgr uses IO service to run asynchronous timers.
TimerMgr::instance()->setIOService(getIOService());
- // CommandMgr uses IO service to run asynchronous socket operations.
+ // CommandMgr's use IO service to run asynchronous socket operations.
CommandMgr::instance().setIOService(getIOService());
+ HttpCommandMgr::instance().setIOService(getIOService());
// DatabaseConnection uses IO service to run asynchronous timers.
DatabaseConnection::setIOService(getIOService());
cleanup();
- // Close the command socket (if it exists).
+ // Close command sockets.
CommandMgr::instance().closeCommandSocket();
+ HttpCommandMgr::instance().close();
// Deregister any registered commands (please keep in alphabetic order)
CommandMgr::instance().deregisterCommand("build-report");
#include <kea_version.h>
#include <asiolink/io_service_mgr.h>
+#include <config/http_command_mgr.h>
#include <dhcp/dhcp4.h>
#include <dhcp/duid.h>
#include <dhcp/hwaddr.h>
// Handle events registered by hooks using external IOService objects.
IOServiceMgr::instance().pollIOServices();
getIOService()->poll();
+ config::HttpCommandMgr::instance().garbageCollectListeners();
} catch (const std::exception& e) {
// General catch-all exception that are not caught by more specific
// catches. This one is for exceptions derived from std::exception.
#include <asiolink/io_service_mgr.h>
#include <cc/command_interpreter.h>
#include <config/command_mgr.h>
+#include <config/http_command_mgr.h>
#include <database/dbaccess_parser.h>
#include <database/backend_selector.h>
#include <database/server_selector.h>
#include <netinet/in.h>
#include <vector>
-using namespace std;
-using namespace isc;
+using namespace isc::asiolink;
+using namespace isc::config;
using namespace isc::data;
using namespace isc::dhcp;
-using namespace isc::asiolink;
using namespace isc::hooks;
using namespace isc::process;
-using namespace isc::config;
using namespace isc::util;
+using namespace isc;
+using namespace std;
namespace {
// receive the configuration result.
if (!sock_cfg || !current_sock_cfg || sock_changed) {
// Close the existing socket (if any).
- isc::config::CommandMgr::instance().closeCommandSocket();
+ CommandMgr::instance().closeCommandSocket();
if (sock_cfg) {
// This will create a control socket and install the external
// socket in IfaceMgr. That socket will be monitored when
// Dhcp4Srv::receivePacket() calls IfaceMgr::receive4() and
// callback in CommandMgr will be called, if necessary.
- isc::config::CommandMgr::instance().openCommandSocket(sock_cfg);
+ CommandMgr::instance().openCommandSocket(sock_cfg);
}
}
+
+ // HTTP control socket is simpler: just (re)configure it.
+
+ // Get new config.
+ HttpCommandConfigPtr http_config =
+ CfgMgr::instance().getStagingCfg()->getHttpControlSocketInfo();
+ HttpCommandMgr::instance().configure(http_config);
}
/// @brief Process a DHCPv4 confguration and return an answer stating if the
#include <cc/command_interpreter.h>
#include <cc/data.h>
#include <config/command_mgr.h>
+#include <config/http_command_mgr.h>
#include <cryptolink/crypto_hash.h>
#include <dhcp/libdhcp++.h>
#include <dhcp6/ctrl_dhcp6_srv.h>
// TimerMgr uses IO service to run asynchronous timers.
TimerMgr::instance()->setIOService(getIOService());
- // CommandMgr uses IO service to run asynchronous socket operations.
+ // CommandMgr's use IO service to run asynchronous socket operations.
CommandMgr::instance().setIOService(getIOService());
+ HttpCommandMgr::instance().setIOService(getIOService());
// DatabaseConnection uses IO service to run asynchronous timers.
DatabaseConnection::setIOService(getIOService());
cleanup();
- // Close the command socket (if it exists).
+ // Close command sockets.
CommandMgr::instance().closeCommandSocket();
+ HttpCommandMgr::instance().close();
// Deregister any registered commands (please keep in alphabetic order)
CommandMgr::instance().deregisterCommand("build-report");
#include <asiolink/io_address.h>
#include <asiolink/io_service_mgr.h>
+#include <config/http_command_mgr.h>
#include <dhcp_ddns/ncr_msg.h>
#include <dhcp/dhcp6.h>
#include <dhcp/docsis3_option_defs.h>
// Handle events registered by hooks using external IOService objects.
IOServiceMgr::instance().pollIOServices();
getIOService()->poll();
+ config::HttpCommandMgr::instance().garbageCollectListeners();
} catch (const std::exception& e) {
// General catch-all standard exceptions that are not caught by more
// specific catches.
#include <cc/data.h>
#include <cc/command_interpreter.h>
#include <config/command_mgr.h>
+#include <config/http_command_mgr.h>
#include <database/dbaccess_parser.h>
#include <dhcp6/ctrl_dhcp6_srv.h>
#include <dhcp6/dhcp6_log.h>
#include <stdint.h>
-using namespace std;
-using namespace isc;
+using namespace isc::asiolink;
+using namespace isc::config;
using namespace isc::data;
using namespace isc::dhcp;
-using namespace isc::asiolink;
using namespace isc::hooks;
using namespace isc::process;
-using namespace isc::config;
using namespace isc::util;
+using namespace isc;
+using namespace std;
namespace {
// receive the configuration result.
if (!sock_cfg || !current_sock_cfg || sock_changed) {
// Close the existing socket (if any).
- isc::config::CommandMgr::instance().closeCommandSocket();
+ CommandMgr::instance().closeCommandSocket();
if (sock_cfg) {
// This will create a control socket and install the external
// socket in IfaceMgr. That socket will be monitored when
// Dhcp6Srv::receivePacket() calls IfaceMgr::receive6() and
// callback in CommandMgr will be called, if necessary.
- isc::config::CommandMgr::instance().openCommandSocket(sock_cfg);
+ CommandMgr::instance().openCommandSocket(sock_cfg);
}
}
+
+ // HTTP control socket is simpler: just (re)configure it.
+
+ // Get new config.
+ HttpCommandConfigPtr http_config =
+ CfgMgr::instance().getStagingCfg()->getHttpControlSocketInfo();
+ HttpCommandMgr::instance().configure(http_config);
}
/// @brief Process a DHCPv6 confguration and return an answer stating if the