// The user specified that the DHCP service should resume not
// later than in max-period seconds. If the 'dhcp-enable' command
// is not sent, the DHCP service will resume automatically.
- network_state_.delayedEnableAll(static_cast<unsigned>(max_period));
+ network_state_->delayedEnableAll(static_cast<unsigned>(max_period));
}
}
}
// No error occurred, so let's disable the service.
if (message.tellp() == 0) {
- network_state_.disableService();
+ network_state_->disableService();
message << "DHCPv6 service disabled";
if (max_period > 0) {
ConstElementPtr
ControlledDhcpv6Srv::commandDhcpEnableHandler(const std::string&, ConstElementPtr) {
- network_state_.enableService();
+ network_state_->enableService();
return (config::createAnswer(CONTROL_RESULT_SUCCESS, "DHCP service successfully enabled"));
}
CalloutHandlePtr callout_handle = HooksManager::createCalloutHandle();
callout_handle->setArgument("io_context", srv->getIOService());
- // callout_handle->setArgument("network_state", srv->getNetworkState());
+ callout_handle->setArgument("network_state", srv->getNetworkState());
callout_handle->setArgument("json_config", config);
callout_handle->setArgument("server_config", CfgMgr::instance().getStagingCfg());
TimerMgr::instance()->cancel("Dhcp6DbReconnectTimer"); }
// Set network state to service enabled
- network_state_.enableService();
+ network_state_->enableService();
// Toss the reconnct control, we're done with it
db_reconnect_ctl.reset();
bool
ControlledDhcpv6Srv::dbLostCallback(ReconnectCtlPtr db_reconnect_ctl) {
// Disable service until we recover
- network_state_.disableService();
+ network_state_->disableService();
if (!db_reconnect_ctl) {
// This shouldn't never happen
Dhcpv6Srv::Dhcpv6Srv(uint16_t port)
: io_service_(new IOService()), port_(port), serverid_(), shutdown_(true),
- alloc_engine_(), name_change_reqs_(), network_state_(NetworkState::DHCPv6)
+ alloc_engine_(), name_change_reqs_(),
+ network_state_(new NetworkState(NetworkState::DHCPv6))
{
LOG_DEBUG(dhcp6_logger, DBG_DHCP6_START, DHCP6_OPEN_SOCKET).arg(port);
}
// If the DHCP service has been globally disabled, drop the packet.
- if (!network_state_.isServiceEnabled()) {
+ if (!network_state_->isServiceEnabled()) {
LOG_DEBUG(bad_packet6_logger, DBG_DHCP6_DETAIL_DATA,
DHCP6_PACKET_DROP_DHCP_DISABLED)
.arg(query->getLabel());
return (io_service_);
}
+ /// @brief Returns pointer to the network state used by the server.
+ NetworkStatePtr& getNetworkState() {
+ return (network_state_);
+ }
+
/// @brief returns Kea version on stdout and exit.
/// redeclaration/redefinition. @ref Daemon::getVersion()
static std::string getVersion(bool extended);
/// @brief Holds information about disabled DHCP service and/or
/// disabled subnet/network scopes.
- NetworkState network_state_;
+ NetworkStatePtr network_state_;
};
-// Copyright (C) 2012-2017 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2018 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
ConstElementPtr cfg = parseAnswer(status, rsp);
EXPECT_EQ(CONTROL_RESULT_SUCCESS, status);
- EXPECT_FALSE(server_->network_state_.isServiceEnabled());
+ EXPECT_FALSE(server_->network_state_->isServiceEnabled());
}
// This test verifies that it is possible to disable DHCP service for a short
EXPECT_EQ(CONTROL_RESULT_SUCCESS, status);
// The service should be disabled.
- EXPECT_FALSE(server_->network_state_.isServiceEnabled());
+ EXPECT_FALSE(server_->network_state_->isServiceEnabled());
// And the timer should be scheduled which counts the time to automatic
// enabling of the service.
- EXPECT_TRUE(server_->network_state_.isDelayedEnableAll());
+ EXPECT_TRUE(server_->network_state_->isDelayedEnableAll());
}
// This test verifies if it is possible to enable DHCP service via command.
ConstElementPtr cfg = parseAnswer(status, rsp);
EXPECT_EQ(CONTROL_RESULT_SUCCESS, status);
- EXPECT_TRUE(server_->network_state_.isServiceEnabled());
+ EXPECT_TRUE(server_->network_state_->isServiceEnabled());
}
/// Verify that concurrent connections over the control channel can be
// parameters should be recorded.
//// not yet network_state
EXPECT_TRUE(checkMarkerFile(SRV_CONFIG_MARKER_FILE,
- "3io_contextjson_configserver_config"));
+ "3io_contextjson_confignetwork_stateserver_config"));
// Destroy the server, instance which should unload the libraries.
srv.reset();
EXPECT_TRUE(checkMarkerFile(LOAD_MARKER_FILE, "3"));
EXPECT_TRUE(checkMarkerFile(UNLOAD_MARKER_FILE, "3"));
EXPECT_TRUE(checkMarkerFile(SRV_CONFIG_MARKER_FILE,
- "3io_contextjson_configserver_config"));
+ "3io_contextjson_confignetwork_stateserver_config"));
}
} // end of anonymous namespace