51namespace ph = std::placeholders;
56struct CtrlDhcp6Hooks {
57 int hooks_index_dhcp6_srv_configured_;
73static const char* SERVER_DUID_FILE =
"kea-dhcp6-serverid";
84void signalHandler(
int signo) {
86 if (signo == SIGHUP) {
88 }
else if ((signo == SIGTERM) || (signo == SIGINT)) {
103 start_ = boost::posix_time::second_clock::universal_time();
111 string reason = comment ? comment->stringValue() :
112 "no details available";
141 if (file_name.empty()) {
144 " Please use -c command line option.");
158 "a map, i.e., start with { and end with } and contain "
159 "at least an entry called 'Dhcp6' that itself is a map. "
161 <<
" is a valid JSON, but its top element is not a map."
162 " Did you forget to add { } around your configuration?");
172 "process command \"config-set\"");
180 string reason = comment ? comment->stringValue() :
181 "no details available";
184 }
catch (
const std::exception& ex) {
190 .arg(file_name).arg(ex.what());
192 << file_name <<
"': " << ex.what());
204ControlledDhcpv6Srv::commandShutdownHandler(
const string&,
ConstElementPtr args) {
221 "parameter 'exit-value' is not an integer"));
224 exit_value = param->intValue();
233ControlledDhcpv6Srv::commandConfigReloadHandler(
const string&,
242 }
catch (
const std::exception& ex) {
249 "Config reload failed: " +
string(ex.what())));
254ControlledDhcpv6Srv::commandConfigGetHandler(
const string&,
264ControlledDhcpv6Srv::commandConfigHashGetHandler(
const string&,
276ControlledDhcpv6Srv::commandConfigWriteHandler(
const string&,
285 if (filename_param) {
288 "passed parameter 'filename' is not a string"));
290 filename = filename_param->stringValue();
294 if (filename.empty()) {
298 if (filename.empty()) {
300 "Please specify filename explicitly."));
305 }
catch (
const isc::Exception& ex) {
306 std::ostringstream msg;
307 msg <<
"not allowed to write config into " << filename
308 <<
": " << ex.
what();
318 }
catch (
const isc::Exception& ex) {
333 + filename +
" successful", params));
337ControlledDhcpv6Srv::commandConfigSetHandler(
const string&,
346 message =
"Missing mandatory 'arguments' parameter.";
348 dhcp6 = args->get(
"Dhcp6");
350 message =
"Missing mandatory 'Dhcp6' parameter.";
352 message =
"'Dhcp6' parameter expected to be a map.";
357 if (message.empty()) {
358 for (
auto const& obj : args->mapValue()) {
359 const string& obj_name = obj.first;
360 if (obj_name !=
"Dhcp6") {
363 if (message.empty()) {
364 message =
"Unsupported '" + obj_name +
"' parameter";
366 message +=
" (and '" + obj_name +
"')";
370 if (!message.empty()) {
375 if (!message.empty()) {
383 if (lease_database) {
384 db::DbAccessParser parser;
385 std::string access_string;
386 parser.
parse(access_string, lease_database);
388 if (params[
"type"] ==
"memfile") {
389 string file_name = params[
"name"];
392 "Can not update configuration while lease file cleanup process is running."));
398 MultiThreadingCriticalSection cs;
447 }
catch (
const std::exception& ex) {
448 std::ostringstream err;
449 err <<
"Error initializing hooks: "
458ControlledDhcpv6Srv::commandConfigTestHandler(
const string&,
467 message =
"Missing mandatory 'arguments' parameter.";
469 dhcp6 = args->get(
"Dhcp6");
471 message =
"Missing mandatory 'Dhcp6' parameter.";
473 message =
"'Dhcp6' parameter expected to be a map.";
478 if (message.empty()) {
479 for (
auto const& obj : args->mapValue()) {
480 const string& obj_name = obj.first;
481 if (obj_name !=
"Dhcp6") {
484 if (message.empty()) {
485 message =
"Unsupported '" + obj_name +
"' parameter";
487 message +=
" (and '" + obj_name +
"')";
491 if (!message.empty()) {
496 if (!message.empty()) {
504 MultiThreadingCriticalSection cs;
516ControlledDhcpv6Srv::commandDhcpDisableHandler(
const std::string&,
518 std::ostringstream message;
519 int64_t max_period = 0;
531 message <<
"arguments for the 'dhcp-disable' command must be a map";
536 if (max_period_element) {
539 message <<
"'max-period' argument must be a number";
543 max_period = max_period_element->intValue();
544 if (max_period <= 0) {
545 message <<
"'max-period' must be positive integer";
558 if (origin_id_element) {
560 type = origin_id_element->intValue();
562 message <<
"'origin-id' argument must be a number";
564 }
else if (origin_element) {
565 switch (origin_element->getType()) {
567 origin = origin_element->stringValue();
568 if (origin ==
"ha-partner") {
570 }
else if (origin !=
"user") {
571 if (origin.empty()) {
572 origin =
"(empty string)";
574 message <<
"invalid value used for 'origin' parameter: "
579 type = origin_element->intValue();
583 message <<
"'origin' argument must be a string or a number";
590 if (message.tellp() == 0) {
591 message <<
"DHCPv6 service disabled";
592 if (max_period > 0) {
593 message <<
" for " << max_period <<
" seconds";
598 network_state_->delayedEnableService(
static_cast<unsigned>(max_period),
612ControlledDhcpv6Srv::commandDhcpEnableHandler(
const std::string&,
614 std::ostringstream message;
625 message <<
"arguments for the 'dhcp-enable' command must be a map";
637 if (origin_id_element) {
639 type = origin_id_element->intValue();
641 message <<
"'origin-id' argument must be a number";
643 }
else if (origin_element) {
644 switch (origin_element->getType()) {
646 origin = origin_element->stringValue();
647 if (origin ==
"ha-partner") {
649 }
else if (origin !=
"user") {
650 if (origin.empty()) {
651 origin =
"(empty string)";
653 message <<
"invalid value used for 'origin' parameter: "
658 type = origin_element->intValue();
662 message <<
"'origin' argument must be a string or a number";
669 if (message.tellp() == 0) {
674 "DHCP service successfully enabled"));
682ControlledDhcpv6Srv::commandVersionGetHandler(
const string&,
ConstElementPtr) {
685 arguments->set(
"extended", extended);
693ControlledDhcpv6Srv::commandBuildReportHandler(
const string&,
701ControlledDhcpv6Srv::commandLeasesReclaimHandler(
const string&,
708 message =
"Missing mandatory 'remove' parameter.";
712 message =
"Missing mandatory 'remove' parameter.";
714 message =
"'remove' parameter expected to be a boolean.";
716 bool remove_lease = remove_name->boolValue();
717 server_->alloc_engine_->reclaimExpiredLeases6(0, 0, remove_lease);
719 message =
"Reclamation of expired leases is complete.";
727ControlledDhcpv6Srv::commandSubnet6SelectTestHandler(
const string&,
735 SubnetSelector selector;
737 for (
auto const& entry : args->mapValue()) {
738 ostringstream errmsg;
739 if (entry.first ==
"interface") {
741 errmsg <<
"'interface' entry must be a string";
744 selector.
iface_name_ = entry.second->stringValue();
746 }
if (entry.first ==
"interface-id") {
748 errmsg <<
"'interface-id' entry must be a string";
752 string str = entry.second->stringValue();
758 errmsg <<
"'interface-id' must be not empty";
766 errmsg <<
"value of 'interface-id' was not recognized";
769 }
else if (entry.first ==
"remote") {
771 errmsg <<
"'remote' entry must be a string";
775 IOAddress addr(entry.second->stringValue());
777 errmsg <<
"bad 'remote' entry: not IPv6";
782 }
catch (
const exception& ex) {
783 errmsg <<
"bad 'remote' entry: " << ex.what();
786 }
else if (entry.first ==
"link") {
788 errmsg <<
"'link' entry must be a string";
792 IOAddress addr(entry.second->stringValue());
794 errmsg <<
"bad 'link' entry: not IPv6";
799 }
catch (
const exception& ex) {
800 errmsg <<
"bad 'link' entry: " << ex.what();
803 }
else if (entry.first ==
"classes") {
806 "'classes' entry must be a list"));
808 for (
auto const& item : entry.second->listValue()) {
810 errmsg <<
"'classes' entry must be a list of strings";
814 if (!item->stringValue().empty()) {
820 errmsg <<
"unknown entry '" << entry.first <<
"'";
825 getCfgSubnets6()->selectSubnet(selector);
830 subnet->getSharedNetwork(network);
833 msg <<
"selected shared network '" << network->getName()
834 <<
"' starting with subnet '" << subnet->toText()
835 <<
"' id " << subnet->getID();
837 msg <<
"selected subnet '" << subnet->toText()
838 <<
"' id " << subnet->getID();
844ControlledDhcpv6Srv::commandServerTagGetHandler(
const std::string&,
846 const std::string& tag =
855ControlledDhcpv6Srv::commandConfigBackendPullHandler(
const std::string&,
863 MultiThreadingCriticalSection cs;
876 auto mode = CBControlDHCPv6::FetchMode::FETCH_UPDATE;
877 server_->getCBControl()->databaseConfigFetch(srv_cfg, mode);
878 }
catch (
const std::exception& ex) {
882 "On demand configuration update failed: " +
886 "On demand configuration update successful."));
890ControlledDhcpv6Srv::commandStatusGetHandler(
const string&,
895 auto now = boost::posix_time::second_clock::universal_time();
897 if (!
start_.is_not_a_date_time()) {
898 auto uptime = now -
start_;
903 if (!last_commit.is_not_a_date_time()) {
904 auto reload = now - last_commit;
909 if (mt_mgr.getMode()) {
916 queue_stats->add(
Element::create(mt_mgr.getThreadPool().getQueueStat(10)));
917 queue_stats->add(
Element::create(mt_mgr.getThreadPool().getQueueStat(100)));
918 queue_stats->add(
Element::create(mt_mgr.getThreadPool().getQueueStat(1000)));
919 status->set(
"packet-queue-statistics", queue_stats);
926 CfgMgr::instance().getCurrentCfg()->getCfgDbAccess()->getExtendedInfoTablesEnabled()));
931 for (std::string
const&
error : interface->getErrors()) {
938 if (socket_errors->empty()) {
943 if (reconnect_ctl && reconnect_ctl->retriesLeft()) {
948 sockets->set(
"errors", socket_errors);
950 status->set(
"sockets", sockets);
958ControlledDhcpv6Srv::commandStatisticSetMaxSampleCountAllHandler(
const string&,
970ControlledDhcpv6Srv::commandStatisticSetMaxSampleAgeAllHandler(
const string&,
991 std::ostringstream err;
994 err <<
"Server object not initialized, can't process config.";
1017 }
catch (
const std::exception& ex) {
1018 err <<
"Failed to process configuration:" << ex.what();
1025 std::bind(&ControlledDhcpv6Srv::dbLostCallback, srv, ph::_1);
1028 std::bind(&ControlledDhcpv6Srv::dbRecoveredCallback, srv, ph::_1);
1031 std::bind(&ControlledDhcpv6Srv::dbFailedCallback, srv, ph::_1);
1034 string params =
"universe=6";
1035 if (cfg_db->getExtendedInfoTablesEnabled()) {
1036 params +=
" extended-info-tables=true";
1038 cfg_db->setAppendedParameters(params);
1039 cfg_db->createManagers();
1044 }
catch (
const std::exception& ex) {
1045 err <<
"Unable to open database: " << ex.what();
1051 const std::string duid_file =
1053 std::string(SERVER_DUID_FILE);
1058 .arg(duid->toText())
1062 }
catch (
const std::exception& ex) {
1063 err <<
"unable to configure server identifier: " << ex.what();
1070 }
catch (
const std::exception& ex) {
1071 err <<
"Error starting DHCP_DDNS client after server reconfiguration: "
1079 }
catch (
const std::exception& ex) {
1080 err <<
"error starting DHCPv4-over-DHCPv6 IPC "
1081 " after server reconfiguration: " << ex.what();
1094 }
catch (
const std::exception& ex) {
1095 err <<
"Error setting packet queue controls after server reconfiguration: "
1103 std::bind(&ControlledDhcpv6Srv::openSocketsFailedCallback, srv, ph::_1);
1118 setupTimers(&ControlledDhcpv6Srv::reclaimExpiredLeases,
1119 &ControlledDhcpv6Srv::deleteExpiredReclaimedLeases,
1122 }
catch (
const std::exception& ex) {
1123 err <<
"unable to setup timers for periodically running the"
1124 " reclamation of the expired leases: "
1125 << ex.what() <<
".";
1132 long fetch_time =
static_cast<long>(ctl_info->getConfigFetchWaitTime());
1135 if (fetch_time > 0) {
1141 if (!server_->inTestMode()) {
1142 fetch_time = 1000 * fetch_time;
1145 boost::shared_ptr<unsigned> failure_count(
new unsigned(0));
1147 registerTimer(
"Dhcp6CBFetchTimer",
1148 std::bind(&ControlledDhcpv6Srv::cbFetchUpdates,
1162 if (notify_libraries) {
1163 return (notify_libraries);
1172 }
catch (
const std::exception& ex) {
1173 err <<
"Error initializing the lease allocators: "
1184 }
catch (
const std::exception& ex) {
1185 err <<
"Error applying multi threading settings: "
1204 callout_handle->setArgument(
"io_context", srv->
getIOService());
1206 callout_handle->setArgument(
"json_config",
config);
1207 callout_handle->setArgument(
"server_config",
CfgMgr::instance().getStagingCfg());
1216 callout_handle->getArgument(
"error",
error);
1218 error =
"unknown error";
1233 "Server object not initialized, can't process config.");
1244 uint16_t client_port )
1248 "There is another Dhcpv6Srv instance already.");
1274 std::bind(&ControlledDhcpv6Srv::commandBuildReportHandler,
this, ph::_1, ph::_2));
1277 std::bind(&ControlledDhcpv6Srv::commandConfigBackendPullHandler,
this, ph::_1, ph::_2));
1280 std::bind(&ControlledDhcpv6Srv::commandConfigGetHandler,
this, ph::_1, ph::_2));
1283 std::bind(&ControlledDhcpv6Srv::commandConfigHashGetHandler,
this, ph::_1, ph::_2));
1286 std::bind(&ControlledDhcpv6Srv::commandConfigReloadHandler,
this, ph::_1, ph::_2));
1289 std::bind(&ControlledDhcpv6Srv::commandConfigSetHandler,
this, ph::_1, ph::_2));
1292 std::bind(&ControlledDhcpv6Srv::commandConfigTestHandler,
this, ph::_1, ph::_2));
1295 std::bind(&ControlledDhcpv6Srv::commandConfigWriteHandler,
this, ph::_1, ph::_2));
1298 std::bind(&ControlledDhcpv6Srv::commandDhcpEnableHandler,
this, ph::_1, ph::_2));
1301 std::bind(&ControlledDhcpv6Srv::commandDhcpDisableHandler,
this, ph::_1, ph::_2));
1304 std::bind(&ControlledDhcpv6Srv::commandLeasesReclaimHandler,
this, ph::_1, ph::_2));
1307 std::bind(&ControlledDhcpv6Srv::commandSubnet6SelectTestHandler,
this, ph::_1, ph::_2));
1310 std::bind(&ControlledDhcpv6Srv::commandServerTagGetHandler,
this, ph::_1, ph::_2));
1313 std::bind(&ControlledDhcpv6Srv::commandShutdownHandler,
this, ph::_1, ph::_2));
1316 std::bind(&ControlledDhcpv6Srv::commandStatusGetHandler,
this, ph::_1, ph::_2));
1319 std::bind(&ControlledDhcpv6Srv::commandVersionGetHandler,
this, ph::_1, ph::_2));
1344 std::bind(&ControlledDhcpv6Srv::commandStatisticSetMaxSampleAgeAllHandler,
this, ph::_1, ph::_2));
1350 std::bind(&ControlledDhcpv6Srv::commandStatisticSetMaxSampleCountAllHandler,
this, ph::_1, ph::_2));
1371 timer_mgr_->unregisterTimers();
1419ControlledDhcpv6Srv::reclaimExpiredLeases(
const size_t max_leases,
1420 const uint16_t timeout,
1421 const bool remove_lease,
1422 const uint16_t max_unwarned_cycles) {
1425 server_->
alloc_engine_->reclaimExpiredLeases6(max_leases, timeout,
1427 max_unwarned_cycles);
1431 getCfgExpiration()->getReclaimTimerWaitTime());
1433 }
catch (
const std::exception& ex) {
1442ControlledDhcpv6Srv::deleteExpiredReclaimedLeases(
const uint32_t secs) {
1444 server_->alloc_engine_->deleteExpiredReclaimedLeases6(secs);
1452ControlledDhcpv6Srv::dbLostCallback(
ReconnectCtlPtr db_reconnect_ctl) {
1453 if (!db_reconnect_ctl) {
1460 if (db_reconnect_ctl->retriesLeft() == db_reconnect_ctl->maxRetries() &&
1461 db_reconnect_ctl->alterServiceState()) {
1466 .arg(db_reconnect_ctl->id())
1467 .arg(db_reconnect_ctl->timerName());
1471 if (!db_reconnect_ctl->retriesLeft() ||
1472 !db_reconnect_ctl->retryInterval()) {
1474 .arg(db_reconnect_ctl->retriesLeft())
1475 .arg(db_reconnect_ctl->retryInterval())
1476 .arg(db_reconnect_ctl->id())
1477 .arg(db_reconnect_ctl->timerName());
1478 if (db_reconnect_ctl->exitOnFailure()) {
1488ControlledDhcpv6Srv::dbRecoveredCallback(
ReconnectCtlPtr db_reconnect_ctl) {
1489 if (!db_reconnect_ctl) {
1496 if (db_reconnect_ctl->retriesLeft() != db_reconnect_ctl->maxRetries() &&
1497 db_reconnect_ctl->alterServiceState()) {
1502 .arg(db_reconnect_ctl->id())
1503 .arg(db_reconnect_ctl->timerName());
1505 db_reconnect_ctl->resetRetries();
1511ControlledDhcpv6Srv::dbFailedCallback(
ReconnectCtlPtr db_reconnect_ctl) {
1512 if (!db_reconnect_ctl) {
1519 .arg(db_reconnect_ctl->maxRetries())
1520 .arg(db_reconnect_ctl->id())
1521 .arg(db_reconnect_ctl->timerName());
1523 if (db_reconnect_ctl->exitOnFailure()) {
1531ControlledDhcpv6Srv::openSocketsFailedCallback(
ReconnectCtlPtr reconnect_ctl) {
1532 if (!reconnect_ctl) {
1539 .arg(reconnect_ctl->maxRetries());
1541 if (reconnect_ctl->exitOnFailure()) {
1547ControlledDhcpv6Srv::cbFetchUpdates(
const SrvConfigPtr& srv_cfg,
1548 boost::shared_ptr<unsigned> failure_count) {
1550 MultiThreadingCriticalSection cs;
1554 server_->getCBControl()->databaseConfigFetch(srv_cfg,
1555 CBControlDHCPv6::FetchMode::FETCH_UPDATE);
1556 (*failure_count) = 0;
1558 }
catch (
const std::exception& ex) {
1565 if (++(*failure_count) > 10) {
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
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.
The IOAddress class represents an IP addresses (version agnostic)
static const IOAddress & IPV6_ZERO_ADDRESS()
Returns an IPv6 zero address.
static IOServiceMgr & instance()
Access the IOServiceMgr singleton instance.
size_t pollIOServices()
Poll IOService objects.
Implements an asynchronous "signal" for IOService driven processing.
static void setIOService(isc::asiolink::IOServicePtr io_service)
Set the I/O service.
virtual isc::data::ConstElementPtr processCommand(const isc::data::ConstElementPtr &cmd)
Triggers command processing.
void registerCommand(const std::string &cmd, CommandHandler handler)
Registers specified command handler for a given command.
static std::string getHash(const isc::data::ConstElementPtr &config)
returns a hash of a given Element structure
void deregisterCommand(const std::string &cmd)
Deregisters specified command handler.
static CommandMgr & instance()
CommandMgr is a singleton class.
static std::string DEFAULT_AUTHENTICATION_REALM
Default HTTP authentication realm.
static isc::asiolink::IOAddress DEFAULT_SOCKET_ADDRESS
Default socket address (127.0.0.1).
void closeCommandSockets()
Close http control sockets.
static HttpCommandMgr & instance()
HttpCommandMgr is a singleton class.
void setIOService(const asiolink::IOServicePtr &io_service)
Sets IO service to be used by the http command manager.
static UnixCommandMgr & instance()
UnixCommandMgr is a singleton class.
void setIOService(const asiolink::IOServicePtr &io_service)
Sets IO service to be used by the unix command manager.
void closeCommandSockets()
Shuts down any open unix control sockets.
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 void setIOService(const isc::asiolink::IOServicePtr &io_service)
Sets IO service to be used by the database backends.
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.
void parse(std::string &access_string, isc::data::ConstElementPtr database_config)
Parse configuration value.
const DatabaseConnection::ParameterMap & getDbAccessParameters() const
Get database access parameters.
RAII class to enable DB reconnect retries on server startup.
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.
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.
void clearStagingConfiguration()
Remove staging configuration.
SrvConfigPtr getCurrentCfg()
Returns a pointer to the current configuration.
static void apply(data::ConstElementPtr value)
apply multi threading configuration
void insert(const ClientClass &class_name)
Insert an element.
Controlled version of the DHCPv6 server.
void init(const std::string &config_file)
Initializes the server.
void cleanup()
Performs cleanup, immediately before termination.
static isc::data::ConstElementPtr finishConfigHookLibraries(isc::data::ConstElementPtr config)
Configuration checker for hook libraries.
virtual ~ControlledDhcpv6Srv()
Destructor.
static isc::data::ConstElementPtr processConfig(isc::data::ConstElementPtr config)
Configuration 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.
static isc::data::ConstElementPtr checkConfig(isc::data::ConstElementPtr config)
Configuration checker.
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.
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.
Dhcpv6Srv(uint16_t server_port=DHCP6_SERVER_PORT, uint16_t client_port=0)
Default constructor.
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.
void startD2()
Starts DHCP_DDNS client IO if DDNS updates are enabled.
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 commitRuntimeOptionDefs()
Commits runtime option definitions.
static bool isLFCProcessRunning(const std::string file_name, Universe u)
Check if LFC is running.
static const unsigned int DB_CONNECTION
The network state is being altered by the DB connection recovery mechanics.
static const unsigned int USER_COMMAND
Origin of the network state transition.
static const unsigned int HA_REMOTE_COMMAND
The network state is being altered by a "dhcp-disable" or "dhcp-enable" command sent by a HA partner.
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.
@ NEXT_STEP_DROP
drop the packet
static int registerHook(const std::string &name)
Register Hook.
static bool calloutsPresent(int index)
Are callouts present?
static boost::shared_ptr< CalloutHandle > createCalloutHandle()
Return callout handle.
static void callCallouts(int index, CalloutHandle &handle)
Calls the callouts for a given hook.
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 checkWriteConfigFile(std::string &file)
Checks the to-be-written configuration file name.
void setExitValue(int value)
Sets the exit value.
isc::data::ConstElementPtr redactConfig(isc::data::ConstElementPtr const &config)
Redact a configuration.
static StatsMgr & instance()
Statistics Manager accessor method.
static MultiThreadingMgr & instance()
Returns a single instance of Multi Threading Manager.
void apply(bool enabled, uint32_t thread_count, uint32_t queue_size)
Apply the multi-threading related settings.
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.
static isc::data::ConstElementPtr statisticResetHandler(const std::string &name, const isc::data::ConstElementPtr ¶ms)
Handles statistic-reset command.
static isc::data::ConstElementPtr statisticGetAllHandler(const std::string &name, const isc::data::ConstElementPtr ¶ms)
Handles statistic-get-all command.
static isc::data::ConstElementPtr statisticRemoveHandler(const std::string &name, const isc::data::ConstElementPtr ¶ms)
Handles statistic-remove command.
static isc::data::ConstElementPtr statisticGetHandler(const std::string &name, const isc::data::ConstElementPtr ¶ms)
Handles statistic-get command.
isc::data::ConstElementPtr statisticSetMaxSampleAgeAllHandler(const isc::data::ConstElementPtr ¶ms)
Handles statistic-sample-age-set-all command.
static isc::data::ConstElementPtr statisticResetAllHandler(const std::string &name, const isc::data::ConstElementPtr ¶ms)
Handles statistic-reset-all command.
static isc::data::ConstElementPtr statisticSetMaxSampleAgeHandler(const std::string &name, const isc::data::ConstElementPtr ¶ms)
Handles statistic-sample-age-set command.
static isc::data::ConstElementPtr statisticRemoveAllHandler(const std::string &name, const isc::data::ConstElementPtr ¶ms)
Handles statistic-remove-all command.
static isc::data::ConstElementPtr statisticSetMaxSampleCountHandler(const std::string &name, const isc::data::ConstElementPtr ¶ms)
Handles statistic-sample-count-set 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 ...
ConstElementPtr parseAnswer(int &rcode, const ConstElementPtr &msg)
Parses a standard config/command level answer and returns arguments or text status code.
ConstElementPtr createCommand(const std::string &command)
Creates a standard command message with no argument (of the form { "command": "my_command" }...
const int CONTROL_RESULT_ERROR
Status code indicating a general failure.
ConstElementPtr createAnswer(const int status_code, const std::string &text, const ConstElementPtr &arg)
Creates a standard config/command level answer message.
ConstElementPtr createAnswer()
Creates a standard config/command level success answer message (i.e.
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
boost::shared_ptr< const Subnet6 > ConstSubnet6Ptr
A const pointer to a Subnet6 object.
const isc::log::MessageID DHCP6_DB_RECONNECT_SUCCEEDED
isc::data::ConstElementPtr configureDhcp6Server(Dhcpv6Srv &server, isc::data::ConstElementPtr config_set, bool check_only, bool extra_checks)
Configure DHCPv6 server (Dhcpv6Srv) with a set of configuration values.
const isc::log::MessageID DHCP6_RECLAIM_EXPIRED_LEASES_SKIPPED
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_CB_PERIODIC_FETCH_UPDATES_RETRIES_EXHAUSTED
const isc::log::MessageID DHCP6_NOT_RUNNING
boost::shared_ptr< SharedNetwork6 > SharedNetwork6Ptr
Pointer to SharedNetwork6 object.
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 int DBG_DHCP6_BASIC
Debug level used to trace basic operations within the code.
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
boost::shared_ptr< Option > OptionPtr
const isc::log::MessageID DHCP6_CONFIG_PACKET_QUEUE
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.
void decodeFormattedHexString(const string &hex_string, vector< uint8_t > &binary)
Converts a formatted string of hexadecimal digits into a vector.
vector< uint8_t > quotedStringToBinary(const string "ed_string)
Converts a string in quotes into vector.
boost::shared_ptr< ReconnectCtl > ReconnectCtlPtr
Pointer to an instance of ReconnectCtl.
Defines the logger used by the top-level component of kea-lfc.
std::string iface_name_
Name of the interface on which the message was received.
ClientClasses client_classes_
Classes that the client belongs to.
asiolink::IOAddress remote_address_
Source address of the message.
OptionPtr interface_id_
Interface id option.
asiolink::IOAddress first_relay_linkaddr_
First relay link address.