43namespace ph = std::placeholders;
48struct CtrlDhcp6Hooks {
49 int hooks_index_dhcp6_srv_configured_;
53 hooks_index_dhcp6_srv_configured_ = HooksManager::registerHook(
"dhcp6_srv_configured");
65static const char* SERVER_DUID_FILE =
"kea-dhcp6-serverid";
76void signalHandler(
int signo) {
78 if (signo == SIGHUP) {
79 ControlledDhcpv6Srv::processCommand(
"config-reload",
81 }
else if ((signo == SIGTERM) || (signo == SIGINT)) {
82 ControlledDhcpv6Srv::processCommand(
"shutdown",
104 if (file_name.empty()) {
107 "use -c command line option.");
121 "a map, i.e., start with { and end with } and contain "
122 "at least an entry called 'Dhcp6' that itself is a map. "
124 <<
" is a valid JSON, but its top element is not a map."
125 " Did you forget to add { } around your configuration?");
135 "processCommand(\"config-set\", json)");
143 string reason = comment ? comment->stringValue() :
144 "no details available";
147 }
catch (
const std::exception& ex) {
153 .arg(file_name).arg(ex.what());
155 << file_name <<
"': " << ex.
what());
159 .arg(MultiThreadingMgr::instance().getMode() ?
"yes" :
"no")
160 .arg(MultiThreadingMgr::instance().getThreadPoolSize())
161 .arg(MultiThreadingMgr::instance().getPacketQueueSize());
169 start_ = boost::posix_time::second_clock::universal_time();
177 string reason = comment ? comment->stringValue() :
178 "no details available";
201ControlledDhcpv6Srv::commandShutdownHandler(
const string&,
ConstElementPtr args) {
218 "parameter 'exit-value' is not an integer"));
221 exit_value = param->intValue();
230ControlledDhcpv6Srv::commandLibReloadHandler(
const string&,
ConstElementPtr) {
235 MultiThreadingMgr::instance().getThreadPool().reset();
240 HooksManager::prepareUnloadLibraries();
241 static_cast<void>(HooksManager::unloadLibraries());
242 bool status = HooksManager::loadLibraries(loaded);
244 isc_throw(Unexpected,
"Failed to reload hooks libraries.");
246 }
catch (
const std::exception& ex) {
252 "Hooks libraries successfully reloaded.");
257ControlledDhcpv6Srv::commandConfigReloadHandler(
const string&,
266 }
catch (
const std::exception& ex) {
273 "Config reload failed: " +
string(ex.what())));
278ControlledDhcpv6Srv::commandConfigGetHandler(
const string&,
286ControlledDhcpv6Srv::commandConfigWriteHandler(
const string&,
295 if (filename_param) {
298 "passed parameter 'filename' is not a string"));
300 filename = filename_param->stringValue();
304 if (filename.empty()) {
310 if (filename.empty()) {
312 "Please specify filename explicitly."));
335 + filename +
" successful", params));
339ControlledDhcpv6Srv::commandConfigSetHandler(
const string&,
348 message =
"Missing mandatory 'arguments' parameter.";
350 dhcp6 = args->get(
"Dhcp6");
352 message =
"Missing mandatory 'Dhcp6' parameter.";
354 message =
"'Dhcp6' parameter expected to be a map.";
359 if (message.empty()) {
360 for (
auto obj : args->mapValue()) {
361 const string& obj_name = obj.first;
362 if (obj_name !=
"Dhcp6") {
365 if (message.empty()) {
366 message =
"Unsupported '" + obj_name +
"' parameter";
368 message +=
" (and '" + obj_name +
"')";
372 if (!message.empty()) {
377 if (!message.empty()) {
390 MultiThreadingMgr::instance().apply(
false, 0, 0);
438ControlledDhcpv6Srv::commandConfigTestHandler(
const string&,
447 message =
"Missing mandatory 'arguments' parameter.";
449 dhcp6 = args->get(
"Dhcp6");
451 message =
"Missing mandatory 'Dhcp6' parameter.";
453 message =
"'Dhcp6' parameter expected to be a map.";
458 if (message.empty()) {
459 for (
auto obj : args->mapValue()) {
460 const string& obj_name = obj.first;
461 if (obj_name !=
"Dhcp6") {
464 if (message.empty()) {
465 message =
"Unsupported '" + obj_name +
"' parameter";
467 message +=
" (and '" + obj_name +
"')";
471 if (!message.empty()) {
476 if (!message.empty()) {
496ControlledDhcpv6Srv::commandDhcpDisableHandler(
const std::string&,
498 std::ostringstream message;
499 int64_t max_period = 0;
511 message <<
"arguments for the 'dhcp-disable' command must be a map";
516 if (max_period_element) {
519 message <<
"'max-period' argument must be a number";
523 max_period = max_period_element->intValue();
524 if (max_period <= 0) {
525 message <<
"'max-period' must be positive integer";
531 if (origin_element) {
534 message <<
"'origin' argument must be a string";
537 origin = origin_element->stringValue();
538 if (origin ==
"ha-partner") {
540 }
else if (origin !=
"user") {
541 if (origin.empty()) {
542 origin =
"(empty string)";
544 message <<
"invalid value used for 'origin' parameter: "
553 if (message.tellp() == 0) {
554 message <<
"DHCPv6 service disabled";
555 if (max_period > 0) {
556 message <<
" for " << max_period <<
" seconds";
561 network_state_->delayedEnableAll(
static_cast<unsigned>(max_period),
575ControlledDhcpv6Srv::commandDhcpEnableHandler(
const std::string&,
577 std::ostringstream message;
588 message <<
"arguments for the 'dhcp-enable' command must be a map";
593 if (origin_element) {
596 message <<
"'origin' argument must be a string";
599 origin = origin_element->stringValue();
600 if (origin ==
"ha-partner") {
602 }
else if (origin !=
"user") {
603 if (origin.empty()) {
604 origin =
"(empty string)";
606 message <<
"invalid value used for 'origin' parameter: "
615 if (message.tellp() == 0) {
620 "DHCP service successfully enabled"));
628ControlledDhcpv6Srv::commandVersionGetHandler(
const string&,
ConstElementPtr) {
631 arguments->set(
"extended", extended);
639ControlledDhcpv6Srv::commandBuildReportHandler(
const string&,
647ControlledDhcpv6Srv::commandLeasesReclaimHandler(
const string&,
654 message =
"Missing mandatory 'remove' parameter.";
658 message =
"Missing mandatory 'remove' parameter.";
660 message =
"'remove' parameter expected to be a boolean.";
662 bool remove_lease = remove_name->boolValue();
663 server_->
alloc_engine_->reclaimExpiredLeases6(0, 0, remove_lease);
665 message =
"Reclamation of expired leases is complete.";
673ControlledDhcpv6Srv::commandServerTagGetHandler(
const std::string&,
675 const std::string& tag =
684ControlledDhcpv6Srv::commandConfigBackendPullHandler(
const std::string&,
705 auto mode = CBControlDHCPv6::FetchMode::FETCH_UPDATE;
706 server_->
getCBControl()->databaseConfigFetch(srv_cfg, mode);
707 }
catch (
const std::exception& ex) {
711 "On demand configuration update failed: " +
715 "On demand configuration update successful."));
719ControlledDhcpv6Srv::commandStatusGetHandler(
const string&,
724 auto now = boost::posix_time::second_clock::universal_time();
726 if (!
start_.is_not_a_date_time()) {
727 auto uptime = now -
start_;
732 if (!last_commit.is_not_a_date_time()) {
733 auto reload = now - last_commit;
737 auto& mt_mgr = MultiThreadingMgr::instance();
738 if (mt_mgr.getMode()) {
741 MultiThreadingMgr::instance().getThreadPoolSize())));
743 MultiThreadingMgr::instance().getPacketQueueSize())));
745 queue_stats->add(
Element::create(mt_mgr.getThreadPool().getQueueStat(10)));
746 queue_stats->add(
Element::create(mt_mgr.getThreadPool().getQueueStat(100)));
747 queue_stats->add(
Element::create(mt_mgr.getThreadPool().getQueueStat(1000)));
748 status->set(
"packet-queue-statistics", queue_stats);
757 for (std::string
const&
error : interface->getErrors()) {
764 if (socket_errors->empty()) {
769 if (reconnect_ctl && reconnect_ctl->retriesLeft()) {
774 sockets->set(
"errors", socket_errors);
776 status->set(
"sockets", sockets);
782ControlledDhcpv6Srv::commandStatisticSetMaxSampleCountAllHandler(
const string&,
784 StatsMgr& stats_mgr = StatsMgr::instance();
794ControlledDhcpv6Srv::commandStatisticSetMaxSampleAgeAllHandler(
const string&,
796 StatsMgr& stats_mgr = StatsMgr::instance();
809 string txt = args ? args->str() :
"(none)";
812 .arg(command).arg(txt);
818 "Server object not initialized, so can't process command '" +
819 command +
"', arguments: '" + txt +
"'.");
824 if (command ==
"shutdown") {
825 return (srv->commandShutdownHandler(command, args));
827 }
else if (command ==
"libreload") {
828 return (srv->commandLibReloadHandler(command, args));
830 }
else if (command ==
"config-reload") {
831 return (srv->commandConfigReloadHandler(command, args));
833 }
else if (command ==
"config-set") {
834 return (srv->commandConfigSetHandler(command, args));
836 }
else if (command ==
"config-get") {
837 return (srv->commandConfigGetHandler(command, args));
839 }
else if (command ==
"config-test") {
840 return (srv->commandConfigTestHandler(command, args));
842 }
else if (command ==
"dhcp-disable") {
843 return (srv->commandDhcpDisableHandler(command, args));
845 }
else if (command ==
"dhcp-enable") {
846 return (srv->commandDhcpEnableHandler(command, args));
848 }
else if (command ==
"version-get") {
849 return (srv->commandVersionGetHandler(command, args));
851 }
else if (command ==
"build-report") {
852 return (srv->commandBuildReportHandler(command, args));
854 }
else if (command ==
"leases-reclaim") {
855 return (srv->commandLeasesReclaimHandler(command, args));
857 }
else if (command ==
"config-write") {
858 return (srv->commandConfigWriteHandler(command, args));
860 }
else if (command ==
"server-tag-get") {
861 return (srv->commandServerTagGetHandler(command, args));
863 }
else if (command ==
"config-backend-pull") {
864 return (srv->commandConfigBackendPullHandler(command, args));
866 }
else if (command ==
"status-get") {
867 return (srv->commandStatusGetHandler(command, args));
875 + command +
"':" + ex.
what() +
876 ", params: '" + txt +
"'"));
886 std::ostringstream err;
889 err <<
"Server object not initialized, can't process config.";
906 }
catch (
const std::exception& ex) {
907 err <<
"Failed to process configuration:" << ex.what();
914 std::bind(&ControlledDhcpv6Srv::dbLostCallback, srv, ph::_1);
917 std::bind(&ControlledDhcpv6Srv::dbRecoveredCallback, srv, ph::_1);
920 std::bind(&ControlledDhcpv6Srv::dbFailedCallback, srv, ph::_1);
923 cfg_db->setAppendedParameters(
"universe=6");
924 cfg_db->createManagers();
927 }
catch (
const std::exception& ex) {
928 err <<
"Unable to open database: " << ex.what();
934 const std::string duid_file =
936 std::string(SERVER_DUID_FILE);
945 }
catch (
const std::exception& ex) {
946 err <<
"unable to configure server identifier: " << ex.what();
953 }
catch (
const std::exception& ex) {
954 err <<
"Error starting DHCP_DDNS client after server reconfiguration: "
962 }
catch (
const std::exception& ex) {
963 err <<
"error starting DHCPv4-over-DHCPv6 IPC "
964 " after server reconfiguration: " << ex.what();
977 }
catch (
const std::exception& ex) {
978 err <<
"Error setting packet queue controls after server reconfiguration: "
986 std::bind(&ControlledDhcpv6Srv::openSocketsFailedCallback, srv, ph::_1);
1001 setupTimers(&ControlledDhcpv6Srv::reclaimExpiredLeases,
1002 &ControlledDhcpv6Srv::deleteExpiredReclaimedLeases,
1005 }
catch (
const std::exception& ex) {
1006 err <<
"unable to setup timers for periodically running the"
1007 " reclamation of the expired leases: "
1008 << ex.what() <<
".";
1015 long fetch_time =
static_cast<long>(ctl_info->getConfigFetchWaitTime());
1018 if (fetch_time > 0) {
1025 fetch_time = 1000 * fetch_time;
1028 boost::shared_ptr<unsigned> failure_count(
new unsigned(0));
1030 registerTimer(
"Dhcp6CBFetchTimer",
1031 std::bind(&ControlledDhcpv6Srv::cbFetchUpdates,
1049 if (HooksManager::calloutsPresent(
Hooks.hooks_index_dhcp6_srv_configured_)) {
1052 callout_handle->setArgument(
"io_context", srv->
getIOService());
1054 callout_handle->setArgument(
"json_config", config);
1055 callout_handle->setArgument(
"server_config",
CfgMgr::instance().getStagingCfg());
1057 HooksManager::callCallouts(
Hooks.hooks_index_dhcp6_srv_configured_,
1061 if (callout_handle->getStatus() == CalloutHandle::NEXT_STEP_DROP) {
1064 callout_handle->getArgument(
"error",
error);
1066 error =
"unknown error";
1078 }
catch (
const std::exception& ex) {
1079 err <<
"Error applying multi threading settings: "
1097 "Server object not initialized, can't process config.");
1105 uint16_t client_port)
1109 "There is another Dhcpv6Srv instance already.");
1127 CommandMgr::instance().registerCommand(
"build-report",
1128 std::bind(&ControlledDhcpv6Srv::commandBuildReportHandler,
this, ph::_1, ph::_2));
1130 CommandMgr::instance().registerCommand(
"config-backend-pull",
1131 std::bind(&ControlledDhcpv6Srv::commandConfigBackendPullHandler,
this, ph::_1, ph::_2));
1133 CommandMgr::instance().registerCommand(
"config-get",
1134 std::bind(&ControlledDhcpv6Srv::commandConfigGetHandler,
this, ph::_1, ph::_2));
1136 CommandMgr::instance().registerCommand(
"config-reload",
1137 std::bind(&ControlledDhcpv6Srv::commandConfigReloadHandler,
this, ph::_1, ph::_2));
1139 CommandMgr::instance().registerCommand(
"config-test",
1140 std::bind(&ControlledDhcpv6Srv::commandConfigTestHandler,
this, ph::_1, ph::_2));
1142 CommandMgr::instance().registerCommand(
"config-write",
1143 std::bind(&ControlledDhcpv6Srv::commandConfigWriteHandler,
this, ph::_1, ph::_2));
1145 CommandMgr::instance().registerCommand(
"dhcp-disable",
1146 std::bind(&ControlledDhcpv6Srv::commandDhcpDisableHandler,
this, ph::_1, ph::_2));
1148 CommandMgr::instance().registerCommand(
"dhcp-enable",
1149 std::bind(&ControlledDhcpv6Srv::commandDhcpEnableHandler,
this, ph::_1, ph::_2));
1151 CommandMgr::instance().registerCommand(
"leases-reclaim",
1152 std::bind(&ControlledDhcpv6Srv::commandLeasesReclaimHandler,
this, ph::_1, ph::_2));
1154 CommandMgr::instance().registerCommand(
"server-tag-get",
1155 std::bind(&ControlledDhcpv6Srv::commandServerTagGetHandler,
this, ph::_1, ph::_2));
1157 CommandMgr::instance().registerCommand(
"libreload",
1158 std::bind(&ControlledDhcpv6Srv::commandLibReloadHandler,
this, ph::_1, ph::_2));
1160 CommandMgr::instance().registerCommand(
"config-set",
1161 std::bind(&ControlledDhcpv6Srv::commandConfigSetHandler,
this, ph::_1, ph::_2));
1163 CommandMgr::instance().registerCommand(
"shutdown",
1164 std::bind(&ControlledDhcpv6Srv::commandShutdownHandler,
this, ph::_1, ph::_2));
1166 CommandMgr::instance().registerCommand(
"status-get",
1167 std::bind(&ControlledDhcpv6Srv::commandStatusGetHandler,
this, ph::_1, ph::_2));
1169 CommandMgr::instance().registerCommand(
"version-get",
1170 std::bind(&ControlledDhcpv6Srv::commandVersionGetHandler,
this, ph::_1, ph::_2));
1173 CommandMgr::instance().registerCommand(
"statistic-get",
1174 std::bind(&StatsMgr::statisticGetHandler, ph::_1, ph::_2));
1176 CommandMgr::instance().registerCommand(
"statistic-get-all",
1177 std::bind(&StatsMgr::statisticGetAllHandler, ph::_1, ph::_2));
1179 CommandMgr::instance().registerCommand(
"statistic-reset",
1180 std::bind(&StatsMgr::statisticResetHandler, ph::_1, ph::_2));
1182 CommandMgr::instance().registerCommand(
"statistic-reset-all",
1183 std::bind(&StatsMgr::statisticResetAllHandler, ph::_1, ph::_2));
1185 CommandMgr::instance().registerCommand(
"statistic-remove",
1186 std::bind(&StatsMgr::statisticRemoveHandler, ph::_1, ph::_2));
1188 CommandMgr::instance().registerCommand(
"statistic-remove-all",
1189 std::bind(&StatsMgr::statisticRemoveAllHandler, ph::_1, ph::_2));
1191 CommandMgr::instance().registerCommand(
"statistic-sample-age-set",
1192 std::bind(&StatsMgr::statisticSetMaxSampleAgeHandler, ph::_1, ph::_2));
1194 CommandMgr::instance().registerCommand(
"statistic-sample-age-set-all",
1195 std::bind(&ControlledDhcpv6Srv::commandStatisticSetMaxSampleAgeAllHandler,
this, ph::_1, ph::_2));
1197 CommandMgr::instance().registerCommand(
"statistic-sample-count-set",
1198 std::bind(&StatsMgr::statisticSetMaxSampleCountHandler, ph::_1, ph::_2));
1200 CommandMgr::instance().registerCommand(
"statistic-sample-count-set-all",
1201 std::bind(&ControlledDhcpv6Srv::commandStatisticSetMaxSampleCountAllHandler,
this, ph::_1, ph::_2));
1222 timer_mgr_->unregisterTimers();
1225 CommandMgr::instance().closeCommandSocket();
1228 CommandMgr::instance().deregisterCommand(
"build-report");
1229 CommandMgr::instance().deregisterCommand(
"config-backend-pull");
1230 CommandMgr::instance().deregisterCommand(
"config-get");
1231 CommandMgr::instance().deregisterCommand(
"config-reload");
1232 CommandMgr::instance().deregisterCommand(
"config-set");
1233 CommandMgr::instance().deregisterCommand(
"config-test");
1234 CommandMgr::instance().deregisterCommand(
"config-write");
1235 CommandMgr::instance().deregisterCommand(
"dhcp-disable");
1236 CommandMgr::instance().deregisterCommand(
"dhcp-enable");
1237 CommandMgr::instance().deregisterCommand(
"leases-reclaim");
1238 CommandMgr::instance().deregisterCommand(
"libreload");
1239 CommandMgr::instance().deregisterCommand(
"server-tag-get");
1240 CommandMgr::instance().deregisterCommand(
"shutdown");
1241 CommandMgr::instance().deregisterCommand(
"statistic-get");
1242 CommandMgr::instance().deregisterCommand(
"statistic-get-all");
1243 CommandMgr::instance().deregisterCommand(
"statistic-remove");
1244 CommandMgr::instance().deregisterCommand(
"statistic-remove-all");
1245 CommandMgr::instance().deregisterCommand(
"statistic-reset");
1246 CommandMgr::instance().deregisterCommand(
"statistic-reset-all");
1247 CommandMgr::instance().deregisterCommand(
"statistic-sample-age-set");
1248 CommandMgr::instance().deregisterCommand(
"statistic-sample-age-set-all");
1249 CommandMgr::instance().deregisterCommand(
"statistic-sample-count-set");
1250 CommandMgr::instance().deregisterCommand(
"statistic-sample-count-set-all");
1251 CommandMgr::instance().deregisterCommand(
"status-get");
1252 CommandMgr::instance().deregisterCommand(
"version-get");
1270ControlledDhcpv6Srv::reclaimExpiredLeases(
const size_t max_leases,
1271 const uint16_t timeout,
1272 const bool remove_lease,
1273 const uint16_t max_unwarned_cycles) {
1275 server_->
alloc_engine_->reclaimExpiredLeases6(max_leases, timeout,
1277 max_unwarned_cycles);
1278 }
catch (
const std::exception& ex) {
1287ControlledDhcpv6Srv::deleteExpiredReclaimedLeases(
const uint32_t secs) {
1288 server_->
alloc_engine_->deleteExpiredReclaimedLeases6(secs);
1294ControlledDhcpv6Srv::dbLostCallback(
ReconnectCtlPtr db_reconnect_ctl) {
1295 if (!db_reconnect_ctl) {
1302 if (db_reconnect_ctl->retriesLeft() == db_reconnect_ctl->maxRetries() &&
1303 db_reconnect_ctl->alterServiceState()) {
1311 if (!db_reconnect_ctl->retriesLeft() ||
1312 !db_reconnect_ctl->retryInterval()) {
1314 .arg(db_reconnect_ctl->retriesLeft())
1315 .arg(db_reconnect_ctl->retryInterval());
1316 if (db_reconnect_ctl->exitOnFailure()) {
1326ControlledDhcpv6Srv::dbRecoveredCallback(
ReconnectCtlPtr db_reconnect_ctl) {
1327 if (!db_reconnect_ctl) {
1334 if (db_reconnect_ctl->alterServiceState()) {
1340 db_reconnect_ctl->resetRetries();
1346ControlledDhcpv6Srv::dbFailedCallback(
ReconnectCtlPtr db_reconnect_ctl) {
1347 if (!db_reconnect_ctl) {
1354 .arg(db_reconnect_ctl->maxRetries());
1356 if (db_reconnect_ctl->exitOnFailure()) {
1364ControlledDhcpv6Srv::openSocketsFailedCallback(
ReconnectCtlPtr reconnect_ctl) {
1365 if (!reconnect_ctl) {
1372 .arg(reconnect_ctl->maxRetries());
1374 if (reconnect_ctl->exitOnFailure()) {
1380ControlledDhcpv6Srv::cbFetchUpdates(
const SrvConfigPtr& srv_cfg,
1381 boost::shared_ptr<unsigned> failure_count) {
1388 CBControlDHCPv6::FetchMode::FETCH_UPDATE);
1389 (*failure_count) = 0;
1391 }
catch (
const std::exception& ex) {
1398 if (++(*failure_count) > 10) {
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
This is a base class for exceptions thrown from the DNS library module.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
A generic exception that is thrown if a function is called in a prohibited way.
Implements an asynchronous "signal" for IOService driven processing.
static ElementPtr create(const Position &pos=ZERO_POSITION())
static ElementPtr createMap(const Position &pos=ZERO_POSITION())
Creates an empty MapElement type ElementPtr.
static ElementPtr createList(const Position &pos=ZERO_POSITION())
Creates an empty ListElement type ElementPtr.
static DbCallback db_recovered_callback_
Optional callback function to invoke if an opened connection recovery succeeded.
static DbCallback db_failed_callback_
Optional callback function to invoke if an opened connection recovery failed.
static DbCallback db_lost_callback_
Optional callback function to invoke if an opened connection is lost.
static const std::string FLUSH_RECLAIMED_TIMER_NAME
Name of the timer for flushing reclaimed leases.
static const std::string RECLAIM_EXPIRED_TIMER_NAME
Name of the timer for reclaiming expired leases.
static OpenSocketsFailedCallback open_sockets_failed_callback_
Optional callback function to invoke if all retries of the opening sockets fail.
void rollback()
Removes staging configuration.
static CfgMgr & instance()
returns a single instance of Configuration Manager
SrvConfigPtr getStagingCfg()
Returns a pointer to the staging configuration.
void commit()
Commits the staging configuration.
SrvConfigPtr getCurrentCfg()
Returns a pointer to the current configuration.
static void apply(data::ConstElementPtr value)
apply multi threading configuration
Controlled version of the DHCPv6 server.
void init(const std::string &config_file)
Initializes the server.
void cleanup()
Performs cleanup, immediately before termination.
isc::data::ConstElementPtr checkConfig(isc::data::ConstElementPtr new_config)
Configuration checker.
static isc::data::ConstElementPtr processConfig(isc::data::ConstElementPtr new_config)
Configuration processor.
virtual ~ControlledDhcpv6Srv()
Destructor.
static isc::data::ConstElementPtr processCommand(const std::string &command, isc::data::ConstElementPtr args)
Command processor.
virtual void shutdownServer(int exit_value)
Initiates shutdown procedure for the whole DHCPv6 server.
static ControlledDhcpv6Srv * getInstance()
Returns pointer to the sole instance of Dhcpv6Srv.
isc::data::ConstElementPtr loadConfigFile(const std::string &file_name)
Configure DHCPv6 server using the configuration file specified.
ControlledDhcpv6Srv(uint16_t server_port=DHCP6_SERVER_PORT, uint16_t client_port=0)
Constructor.
virtual void open()
Open communication socket.
static Dhcp6to4Ipc & instance()
Returns pointer to the sole instance of Dhcp6to4Ipc.
void shutdown() override
Instructs the server to shut down.
boost::shared_ptr< AllocEngine > alloc_engine_
Allocation Engine.
uint16_t getServerPort() const
Get UDP port on which server should listen.
OptionPtr serverid_
Server DUID (to be sent in server-identifier option)
NetworkStatePtr & getNetworkState()
Returns pointer to the network state used by the server.
NetworkStatePtr network_state_
Holds information about disabled DHCP service and/or disabled subnet/network scopes.
CBControlDHCPv6Ptr getCBControl() const
Returns an object which controls access to the configuration backends.
static std::string getVersion(bool extended)
returns Kea version on stdout and exit.
asiolink::IOServicePtr & getIOService()
Returns pointer to the IO service used by the server.
bool inTestMode() const
Checks if the server is running in unit test mode.
void startD2()
Starts DHCP_DDNS client IO if DDNS updates are enabled.
static void setIOService(const isc::asiolink::IOServicePtr &io_service)
Sets IO service to be used by the Host Manager.
static void create()
Creates new instance of the HostMgr.
static IfaceMgr & instance()
IfaceMgr is a singleton class.
static void destroy()
Destroy lease manager.
static void setIOService(const isc::asiolink::IOServicePtr &io_service)
Sets IO service to be used by the Lease Manager.
static void commitRuntimeOptionDefs()
Commits runtime option definitions.
Origin
Origin of the network state transition.
@ USER_COMMAND
The network state is being altered by a user command.
@ DB_CONNECTION
The network state is being altered by the DB connection recovery mechanics.
@ HA_COMMAND
The network state is being altered by a HA internal command.
Evaluation context, an interface to the expression evaluation.
isc::data::ElementPtr parseFile(const std::string &filename, ParserType parser_type)
Run the parser on the file specified.
@ PARSER_DHCP6
This parser will parse the content as Dhcp6 config wrapped in a map (that's the regular config file)
Manages a pool of asynchronous interval timers.
static const TimerMgrPtr & instance()
Returns pointer to the sole instance of the TimerMgr.
std::string getConfigFile() const
Returns config file name.
virtual size_t writeConfigFile(const std::string &config_file, isc::data::ConstElementPtr cfg=isc::data::ConstElementPtr()) const
Writes current configuration to specified file.
isc::asiolink::IOSignalSetPtr signal_set_
A pointer to the object installing custom signal handlers.
boost::posix_time::ptime start_
Timestamp of the start of the daemon.
void setExitValue(int value)
Sets the exit value.
isc::data::ConstElementPtr redactConfig(isc::data::ConstElementPtr const &config)
Redact a configuration.
Statistics Manager class.
RAII class creating a critical section.
This file contains several functions and constants that are used for handling commands and responses ...
Defines the Dhcp6to4Ipc class.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
isc::data::ConstElementPtr statisticSetMaxSampleCountAllHandler(const isc::data::ConstElementPtr ¶ms)
Handles statistic-sample-count-set-all command.
isc::data::ConstElementPtr statisticSetMaxSampleAgeAllHandler(const isc::data::ConstElementPtr ¶ms)
Handles statistic-sample-age-set-all command.
uint32_t getMaxSampleCountDefault() const
Get default count limit.
const StatsDuration & getMaxSampleAgeDefault() const
Get default duration limit.
#define LOG_ERROR(LOGGER, MESSAGE)
Macro to conveniently test error output and log it.
#define LOG_INFO(LOGGER, MESSAGE)
Macro to conveniently test info output and log it.
#define LOG_WARN(LOGGER, MESSAGE)
Macro to conveniently test warn output and log it.
#define LOG_FATAL(LOGGER, MESSAGE)
Macro to conveniently test fatal output and log it.
#define LOG_DEBUG(LOGGER, LEVEL, MESSAGE)
Macro to conveniently test debug output and log it.
boost::shared_ptr< IOService > IOServicePtr
Defines a smart pointer to an IOService instance.
const int CONTROL_RESULT_EMPTY
Status code indicating that the specified command was completed correctly, but failed to produce any ...
const int CONTROL_RESULT_ERROR
Status code indicating a general failure.
ConstElementPtr createAnswer(const int status_code, const std::string &text, const ConstElementPtr &arg)
ConstElementPtr parseAnswer(int &rcode, const ConstElementPtr &msg)
const int CONTROL_RESULT_SUCCESS
Status code indicating a successful operation.
boost::shared_ptr< const Element > ConstElementPtr
boost::shared_ptr< Element > ElementPtr
std::string getConfigReport()
const isc::log::MessageID DHCP6_DB_RECONNECT_NO_DB_CTL
const isc::log::MessageID DHCP6_OPEN_SOCKETS_NO_RECONNECT_CTL
const isc::log::MessageID DHCP6_USING_SERVERID
const isc::log::MessageID DHCP6_CONFIG_LOAD_FAIL
isc::data::ConstElementPtr configureDhcp6Server(Dhcpv6Srv &server, isc::data::ConstElementPtr config_set, bool check_only)
Configures DHCPv6 server.
const isc::log::MessageID DHCP6_DB_RECONNECT_SUCCEEDED
boost::shared_ptr< CfgDbAccess > CfgDbAccessPtr
A pointer to the CfgDbAccess.
boost::shared_ptr< Iface > IfacePtr
Type definition for the pointer to an Iface object.
boost::shared_ptr< DUID > DuidPtr
const int DBG_DHCP6_COMMAND
Debug level used to log receiving commands.
const isc::log::MessageID DHCP6_CB_PERIODIC_FETCH_UPDATES_FAIL
const isc::log::MessageID DHCP6_RECLAIM_EXPIRED_LEASES_FAIL
const isc::log::MessageID DHCP6_OPEN_SOCKETS_FAILED
boost::shared_ptr< SrvConfig > SrvConfigPtr
Non-const pointer to the SrvConfig.
const isc::log::MessageID DHCP6_DYNAMIC_RECONFIGURATION_SUCCESS
const isc::log::MessageID DHCP6_CB_ON_DEMAND_FETCH_UPDATES_FAIL
const isc::log::MessageID DHCP6_COMMAND_RECEIVED
const isc::log::MessageID DHCP6_CB_PERIODIC_FETCH_UPDATES_RETRIES_EXHAUSTED
const isc::log::MessageID DHCP6_NOT_RUNNING
const isc::log::MessageID DHCP6_DYNAMIC_RECONFIGURATION_FAIL
const isc::log::MessageID DHCP6_CONFIG_UNSUPPORTED_OBJECT
const isc::log::MessageID DHCP6_CONFIG_UNRECOVERABLE_ERROR
const isc::log::MessageID DHCP6_CONFIG_RECEIVED
const isc::log::MessageID DHCP6_DB_RECONNECT_DISABLED
const isc::log::MessageID DHCP6_DYNAMIC_RECONFIGURATION
const isc::log::MessageID DHCP6_DB_RECONNECT_LOST_CONNECTION
const isc::log::MessageID DHCP6_HOOKS_LIBS_RELOAD_FAIL
isc::log::Logger dhcp6_logger(DHCP6_APP_LOGGER_NAME)
Base logger for DHCPv6 server.
const isc::log::MessageID DHCP6_MULTI_THREADING_INFO
const isc::log::MessageID DHCP6_DB_RECONNECT_FAILED
const isc::log::MessageID DHCP6_CONFIG_PACKET_QUEUE
std::vector< HookLibInfo > HookLibsCollection
A storage for information about hook libraries.
boost::shared_ptr< CalloutHandle > CalloutHandlePtr
A shared pointer to a CalloutHandle object.
long toSeconds(const StatsDuration &dur)
Returns the number of seconds in a duration.
boost::shared_ptr< ReconnectCtl > ReconnectCtlPtr
Pointer to an instance of ReconnectCtl.
Defines the logger used by the top-level component of kea-lfc.