49namespace ph = std::placeholders;
 
   54struct CtrlDhcp6Hooks {
 
   55    int hooks_index_dhcp6_srv_configured_;
 
   71static const char* SERVER_DUID_FILE = 
"kea-dhcp6-serverid";
 
   82void signalHandler(
int signo) {
 
   84    if (signo == SIGHUP) {
 
   86    } 
else if ((signo == SIGTERM) || (signo == SIGINT)) {
 
  101    start_ = boost::posix_time::second_clock::universal_time();
 
  109        string reason = comment ? comment->stringValue() :
 
  110            "no details available";
 
 
  139        if (file_name.empty()) {
 
  142                      " Please use -c command line option.");
 
  156                      "a map, i.e., start with { and end with } and contain " 
  157                      "at least an entry called 'Dhcp6' that itself is a map. " 
  159                      << 
" is a valid JSON, but its top element is not a map." 
  160                      " Did you forget to add { } around your configuration?");
 
  170                      "process command \"config-set\"");
 
  178            string reason = comment ? comment->stringValue() :
 
  179                "no details available";
 
  182    } 
catch (
const std::exception& ex) {
 
  188            .arg(file_name).arg(ex.what());
 
  190                  << file_name << 
"': " << ex.what());
 
 
  202ControlledDhcpv6Srv::commandShutdownHandler(
const string&, 
ConstElementPtr args) {
 
  219                                     "parameter 'exit-value' is not an integer"));
 
  222            exit_value = param->intValue();
 
  231ControlledDhcpv6Srv::commandConfigReloadHandler(
const string&,
 
  240    } 
catch (
const std::exception& ex) {
 
  247                             "Config reload failed: " + 
string(ex.what())));
 
  252ControlledDhcpv6Srv::commandConfigGetHandler(
const string&,
 
  262ControlledDhcpv6Srv::commandConfigHashGetHandler(
const string&,
 
  274ControlledDhcpv6Srv::commandConfigWriteHandler(
const string&,
 
  283        if (filename_param) {
 
  286                                     "passed parameter 'filename' is not a string"));
 
  288            filename = filename_param->stringValue();
 
  292    if (filename.empty()) {
 
  296        if (filename.empty()) {
 
  298                                 "Please specify filename explicitly."));
 
  303        } 
catch (
const isc::Exception& ex) {
 
  304            std::ostringstream msg;
 
  305            msg << 
"not allowed to write config into " << filename
 
  306                << 
": " << ex.
what();
 
  316    } 
catch (
const isc::Exception& ex) {
 
  331                         + filename + 
" successful", params));
 
  335ControlledDhcpv6Srv::commandConfigSetHandler(
const string&,
 
  344        message = 
"Missing mandatory 'arguments' parameter.";
 
  346        dhcp6 = args->get(
"Dhcp6");
 
  348            message = 
"Missing mandatory 'Dhcp6' parameter.";
 
  350            message = 
"'Dhcp6' parameter expected to be a map.";
 
  355    if (message.empty()) {
 
  356        for (
auto const& obj : args->mapValue()) {
 
  357            const string& obj_name = obj.first;
 
  358            if (obj_name != 
"Dhcp6") {
 
  361                if (message.empty()) {
 
  362                    message = 
"Unsupported '" + obj_name + 
"' parameter";
 
  364                    message += 
" (and '" + obj_name + 
"')";
 
  368        if (!message.empty()) {
 
  373    if (!message.empty()) {
 
  381    MultiThreadingCriticalSection cs;
 
  430    } 
catch (
const std::exception& ex) {
 
  431        std::ostringstream err;
 
  432        err << 
"Error initializing hooks: " 
  441ControlledDhcpv6Srv::commandConfigTestHandler(
const string&,
 
  450        message = 
"Missing mandatory 'arguments' parameter.";
 
  452        dhcp6 = args->get(
"Dhcp6");
 
  454            message = 
"Missing mandatory 'Dhcp6' parameter.";
 
  456            message = 
"'Dhcp6' parameter expected to be a map.";
 
  461    if (message.empty()) {
 
  462        for (
auto const& obj : args->mapValue()) {
 
  463            const string& obj_name = obj.first;
 
  464            if (obj_name != 
"Dhcp6") {
 
  467                if (message.empty()) {
 
  468                    message = 
"Unsupported '" + obj_name + 
"' parameter";
 
  470                    message += 
" (and '" + obj_name + 
"')";
 
  474        if (!message.empty()) {
 
  479    if (!message.empty()) {
 
  487    MultiThreadingCriticalSection cs;
 
  499ControlledDhcpv6Srv::commandDhcpDisableHandler(
const std::string&,
 
  501    std::ostringstream message;
 
  502    int64_t max_period = 0;
 
  514            message << 
"arguments for the 'dhcp-disable' command must be a map";
 
  519            if (max_period_element) {
 
  522                    message << 
"'max-period' argument must be a number";
 
  526                    max_period = max_period_element->intValue();
 
  527                    if (max_period <= 0) {
 
  528                        message << 
"'max-period' must be positive integer";
 
  541            if (origin_id_element) {
 
  543                    type = origin_id_element->intValue();
 
  545                    message << 
"'origin-id' argument must be a number";
 
  547            } 
else if (origin_element) {
 
  548                switch (origin_element->getType()) {
 
  550                    origin = origin_element->stringValue();
 
  551                    if (origin == 
"ha-partner") {
 
  553                    } 
else if (origin != 
"user") {
 
  554                        if (origin.empty()) {
 
  555                            origin = 
"(empty string)";
 
  557                        message << 
"invalid value used for 'origin' parameter: " 
  562                    type = origin_element->intValue();
 
  566                    message << 
"'origin' argument must be a string or a number";
 
  573    if (message.tellp() == 0) {
 
  574        message << 
"DHCPv6 service disabled";
 
  575        if (max_period > 0) {
 
  576            message << 
" for " << max_period << 
" seconds";
 
  581            network_state_->delayedEnableService(
static_cast<unsigned>(max_period),
 
  595ControlledDhcpv6Srv::commandDhcpEnableHandler(
const std::string&,
 
  597    std::ostringstream message;
 
  608            message << 
"arguments for the 'dhcp-enable' command must be a map";
 
  620            if (origin_id_element) {
 
  622                    type = origin_id_element->intValue();
 
  624                    message << 
"'origin-id' argument must be a number";
 
  626            } 
else if (origin_element) {
 
  627                switch (origin_element->getType()) {
 
  629                    origin = origin_element->stringValue();
 
  630                    if (origin == 
"ha-partner") {
 
  632                    } 
else if (origin != 
"user") {
 
  633                        if (origin.empty()) {
 
  634                            origin = 
"(empty string)";
 
  636                        message << 
"invalid value used for 'origin' parameter: " 
  641                    type = origin_element->intValue();
 
  645                    message << 
"'origin' argument must be a string or a number";
 
  652    if (message.tellp() == 0) {
 
  657                                     "DHCP service successfully enabled"));
 
  665ControlledDhcpv6Srv::commandVersionGetHandler(
const string&, 
ConstElementPtr) {
 
  668    arguments->set(
"extended", extended);
 
  676ControlledDhcpv6Srv::commandBuildReportHandler(
const string&,
 
  684ControlledDhcpv6Srv::commandLeasesReclaimHandler(
const string&,
 
  691        message = 
"Missing mandatory 'remove' parameter.";
 
  695            message = 
"Missing mandatory 'remove' parameter.";
 
  697            message = 
"'remove' parameter expected to be a boolean.";
 
  699            bool remove_lease = remove_name->boolValue();
 
  700            server_->alloc_engine_->reclaimExpiredLeases6(0, 0, remove_lease);
 
  702            message = 
"Reclamation of expired leases is complete.";
 
  710ControlledDhcpv6Srv::commandSubnet6SelectTestHandler(
const string&,
 
  718    SubnetSelector selector;
 
  720    for (
auto const& entry : args->mapValue()) {
 
  721        ostringstream errmsg;
 
  722        if (entry.first == 
"interface") {
 
  724                errmsg << 
"'interface' entry must be a string";
 
  727            selector.
iface_name_ = entry.second->stringValue();
 
  729        } 
if (entry.first == 
"interface-id") {
 
  731                errmsg << 
"'interface-id' entry must be a string";
 
  735                string str = entry.second->stringValue();
 
  741                    errmsg << 
"'interface-id' must be not empty";
 
  749                errmsg << 
"value of 'interface-id' was not recognized";
 
  752        } 
else if (entry.first == 
"remote") {
 
  754                errmsg << 
"'remote' entry must be a string";
 
  758                IOAddress addr(entry.second->stringValue());
 
  760                    errmsg << 
"bad 'remote' entry: not IPv6";
 
  765            } 
catch (
const exception& ex) {
 
  766                errmsg << 
"bad 'remote' entry: " << ex.what();
 
  769        } 
else if (entry.first == 
"link") {
 
  771                errmsg << 
"'link' entry must be a string";
 
  775                IOAddress addr(entry.second->stringValue());
 
  777                    errmsg << 
"bad 'link' entry: not IPv6";
 
  782            } 
catch (
const exception& ex) {
 
  783                errmsg << 
"bad 'link' entry: " << ex.what();
 
  786        } 
else if (entry.first == 
"classes") {
 
  789                                     "'classes' entry must be a list"));
 
  791            for (
auto const& item : entry.second->listValue()) {
 
  793                    errmsg << 
"'classes' entry must be a list of strings";
 
  797                if (!item->stringValue().empty()) {
 
  803            errmsg << 
"unknown entry '" << entry.first << 
"'";
 
  808        getCfgSubnets6()->selectSubnet(selector);
 
  813    subnet->getSharedNetwork(network);
 
  816        msg << 
"selected shared network '" << network->getName()
 
  817            << 
"' starting with subnet '" << subnet->toText()
 
  818            << 
"' id " << subnet->getID();
 
  820        msg << 
"selected subnet '" << subnet->toText()
 
  821            << 
"' id " << subnet->getID();
 
  827ControlledDhcpv6Srv::commandServerTagGetHandler(
const std::string&,
 
  829    const std::string& tag =
 
  838ControlledDhcpv6Srv::commandConfigBackendPullHandler(
const std::string&,
 
  846    MultiThreadingCriticalSection cs;
 
  859        auto mode = CBControlDHCPv6::FetchMode::FETCH_UPDATE;
 
  860        server_->getCBControl()->databaseConfigFetch(srv_cfg, mode);
 
  861    } 
catch (
const std::exception& ex) {
 
  865                             "On demand configuration update failed: " +
 
  869                         "On demand configuration update successful."));
 
  873ControlledDhcpv6Srv::commandStatusGetHandler(
const string&,
 
  878    auto now = boost::posix_time::second_clock::universal_time();
 
  880    if (!
start_.is_not_a_date_time()) {
 
  881        auto uptime = now - 
start_;
 
  886    if (!last_commit.is_not_a_date_time()) {
 
  887        auto reload = now - last_commit;
 
  892    if (mt_mgr.getMode()) {
 
  899        queue_stats->add(
Element::create(mt_mgr.getThreadPool().getQueueStat(10)));
 
  900        queue_stats->add(
Element::create(mt_mgr.getThreadPool().getQueueStat(100)));
 
  901        queue_stats->add(
Element::create(mt_mgr.getThreadPool().getQueueStat(1000)));
 
  902        status->set(
"packet-queue-statistics", queue_stats);
 
  909                    CfgMgr::instance().getCurrentCfg()->getCfgDbAccess()->getExtendedInfoTablesEnabled()));
 
  914        for (std::string 
const& 
error : interface->getErrors()) {
 
  921    if (socket_errors->empty()) {
 
  926        if (reconnect_ctl && reconnect_ctl->retriesLeft()) {
 
  931        sockets->set(
"errors", socket_errors);
 
  933    status->set(
"sockets", sockets);
 
  941ControlledDhcpv6Srv::commandStatisticSetMaxSampleCountAllHandler(
const string&,
 
  953ControlledDhcpv6Srv::commandStatisticSetMaxSampleAgeAllHandler(
const string&,
 
  974    std::ostringstream err;
 
  977        err << 
"Server object not initialized, can't process config.";
 
 1000    } 
catch (
const std::exception& ex) {
 
 1001        err << 
"Failed to process configuration:" << ex.what();
 
 1008            std::bind(&ControlledDhcpv6Srv::dbLostCallback, srv, ph::_1);
 
 1011            std::bind(&ControlledDhcpv6Srv::dbRecoveredCallback, srv, ph::_1);
 
 1014            std::bind(&ControlledDhcpv6Srv::dbFailedCallback, srv, ph::_1);
 
 1017        string params = 
"universe=6";
 
 1018        if (cfg_db->getExtendedInfoTablesEnabled()) {
 
 1019            params += 
" extended-info-tables=true";
 
 1021        cfg_db->setAppendedParameters(params);
 
 1022        cfg_db->createManagers();
 
 1027    } 
catch (
const std::exception& ex) {
 
 1028        err << 
"Unable to open database: " << ex.what();
 
 1034        const std::string duid_file =
 
 1036            std::string(SERVER_DUID_FILE);
 
 1041                .arg(duid->toText())
 
 1045    } 
catch (
const std::exception& ex) {
 
 1046        err << 
"unable to configure server identifier: " << ex.what();
 
 1053    } 
catch (
const std::exception& ex) {
 
 1054        err << 
"Error starting DHCP_DDNS client after server reconfiguration: " 
 1062    } 
catch (
const std::exception& ex) {
 
 1063        err << 
"error starting DHCPv4-over-DHCPv6 IPC " 
 1064               " after server reconfiguration: " << ex.what();
 
 1077    } 
catch (
const std::exception& ex) {
 
 1078        err << 
"Error setting packet queue controls after server reconfiguration: " 
 1086        std::bind(&ControlledDhcpv6Srv::openSocketsFailedCallback, srv, ph::_1);
 
 1101            setupTimers(&ControlledDhcpv6Srv::reclaimExpiredLeases,
 
 1102                        &ControlledDhcpv6Srv::deleteExpiredReclaimedLeases,
 
 1105    } 
catch (
const std::exception& ex) {
 
 1106        err << 
"unable to setup timers for periodically running the" 
 1107            " reclamation of the expired leases: " 
 1108            << ex.what() << 
".";
 
 1115        long fetch_time = 
static_cast<long>(ctl_info->getConfigFetchWaitTime());
 
 1118        if (fetch_time > 0) {
 
 1124            if (!server_->inTestMode()) {
 
 1125                fetch_time = 1000 * fetch_time;
 
 1128            boost::shared_ptr<unsigned> failure_count(
new unsigned(0));
 
 1130                registerTimer(
"Dhcp6CBFetchTimer",
 
 1131                              std::bind(&ControlledDhcpv6Srv::cbFetchUpdates,
 
 1145    if (notify_libraries) {
 
 1146        return (notify_libraries);
 
 1155    } 
catch (
const std::exception& ex) {
 
 1156        err << 
"Error initializing the lease allocators: " 
 1167    } 
catch (
const std::exception& ex) {
 
 1168        err << 
"Error applying multi threading settings: " 
 
 1187        callout_handle->setArgument(
"io_context", srv->
getIOService());
 
 1189        callout_handle->setArgument(
"json_config", 
config);
 
 1190        callout_handle->setArgument(
"server_config", 
CfgMgr::instance().getStagingCfg());
 
 1199                callout_handle->getArgument(
"error", 
error);
 
 1201                error = 
"unknown error";
 
 
 1216            "Server object not initialized, can't process config.");
 
 
 1227                                         uint16_t client_port )
 
 1231                  "There is another Dhcpv6Srv instance already.");
 
 1257        std::bind(&ControlledDhcpv6Srv::commandBuildReportHandler, 
this, ph::_1, ph::_2));
 
 1260        std::bind(&ControlledDhcpv6Srv::commandConfigBackendPullHandler, 
this, ph::_1, ph::_2));
 
 1263        std::bind(&ControlledDhcpv6Srv::commandConfigGetHandler, 
this, ph::_1, ph::_2));
 
 1266        std::bind(&ControlledDhcpv6Srv::commandConfigHashGetHandler, 
this, ph::_1, ph::_2));
 
 1269        std::bind(&ControlledDhcpv6Srv::commandConfigReloadHandler, 
this, ph::_1, ph::_2));
 
 1272        std::bind(&ControlledDhcpv6Srv::commandConfigSetHandler, 
this, ph::_1, ph::_2));
 
 1275        std::bind(&ControlledDhcpv6Srv::commandConfigTestHandler, 
this, ph::_1, ph::_2));
 
 1278        std::bind(&ControlledDhcpv6Srv::commandConfigWriteHandler, 
this, ph::_1, ph::_2));
 
 1281        std::bind(&ControlledDhcpv6Srv::commandDhcpEnableHandler, 
this, ph::_1, ph::_2));
 
 1284        std::bind(&ControlledDhcpv6Srv::commandDhcpDisableHandler, 
this, ph::_1, ph::_2));
 
 1287        std::bind(&ControlledDhcpv6Srv::commandLeasesReclaimHandler, 
this, ph::_1, ph::_2));
 
 1290        std::bind(&ControlledDhcpv6Srv::commandSubnet6SelectTestHandler, 
this, ph::_1, ph::_2));
 
 1293        std::bind(&ControlledDhcpv6Srv::commandServerTagGetHandler, 
this, ph::_1, ph::_2));
 
 1296        std::bind(&ControlledDhcpv6Srv::commandShutdownHandler, 
this, ph::_1, ph::_2));
 
 1299        std::bind(&ControlledDhcpv6Srv::commandStatusGetHandler, 
this, ph::_1, ph::_2));
 
 1302        std::bind(&ControlledDhcpv6Srv::commandVersionGetHandler, 
this, ph::_1, ph::_2));
 
 1327        std::bind(&ControlledDhcpv6Srv::commandStatisticSetMaxSampleAgeAllHandler, 
this, ph::_1, ph::_2));
 
 1333        std::bind(&ControlledDhcpv6Srv::commandStatisticSetMaxSampleCountAllHandler, 
this, ph::_1, ph::_2));
 
 
 1354        timer_mgr_->unregisterTimers();
 
 
 1402ControlledDhcpv6Srv::reclaimExpiredLeases(
const size_t max_leases,
 
 1403                                          const uint16_t timeout,
 
 1404                                          const bool remove_lease,
 
 1405                                          const uint16_t max_unwarned_cycles) {
 
 1408            server_->
alloc_engine_->reclaimExpiredLeases6(max_leases, timeout,
 
 1410                                                          max_unwarned_cycles);
 
 1414                     getCfgExpiration()->getReclaimTimerWaitTime());
 
 1416    } 
catch (
const std::exception& ex) {
 
 1425ControlledDhcpv6Srv::deleteExpiredReclaimedLeases(
const uint32_t secs) {
 
 1427        server_->alloc_engine_->deleteExpiredReclaimedLeases6(secs);
 
 1435ControlledDhcpv6Srv::dbLostCallback(
ReconnectCtlPtr db_reconnect_ctl) {
 
 1436    if (!db_reconnect_ctl) {
 
 1443    if (db_reconnect_ctl->retriesLeft() == db_reconnect_ctl->maxRetries() &&
 
 1444        db_reconnect_ctl->alterServiceState()) {
 
 1449        .arg(db_reconnect_ctl->id())
 
 1450        .arg(db_reconnect_ctl->timerName());
 
 1454    if (!db_reconnect_ctl->retriesLeft() ||
 
 1455        !db_reconnect_ctl->retryInterval()) {
 
 1457            .arg(db_reconnect_ctl->retriesLeft())
 
 1458            .arg(db_reconnect_ctl->retryInterval())
 
 1459            .arg(db_reconnect_ctl->id())
 
 1460            .arg(db_reconnect_ctl->timerName());
 
 1461        if (db_reconnect_ctl->exitOnFailure()) {
 
 1471ControlledDhcpv6Srv::dbRecoveredCallback(
ReconnectCtlPtr db_reconnect_ctl) {
 
 1472    if (!db_reconnect_ctl) {
 
 1479    if (db_reconnect_ctl->retriesLeft() != db_reconnect_ctl->maxRetries() &&
 
 1480        db_reconnect_ctl->alterServiceState()) {
 
 1485        .arg(db_reconnect_ctl->id())
 
 1486        .arg(db_reconnect_ctl->timerName());
 
 1488    db_reconnect_ctl->resetRetries();
 
 1494ControlledDhcpv6Srv::dbFailedCallback(
ReconnectCtlPtr db_reconnect_ctl) {
 
 1495    if (!db_reconnect_ctl) {
 
 1502        .arg(db_reconnect_ctl->maxRetries())
 
 1503        .arg(db_reconnect_ctl->id())
 
 1504        .arg(db_reconnect_ctl->timerName());
 
 1506    if (db_reconnect_ctl->exitOnFailure()) {
 
 1514ControlledDhcpv6Srv::openSocketsFailedCallback(
ReconnectCtlPtr reconnect_ctl) {
 
 1515    if (!reconnect_ctl) {
 
 1522            .arg(reconnect_ctl->maxRetries());
 
 1524    if (reconnect_ctl->exitOnFailure()) {
 
 1530ControlledDhcpv6Srv::cbFetchUpdates(
const SrvConfigPtr& srv_cfg,
 
 1531                                    boost::shared_ptr<unsigned> failure_count) {
 
 1533    MultiThreadingCriticalSection cs;
 
 1537        server_->getCBControl()->databaseConfigFetch(srv_cfg,
 
 1538                                                     CBControlDHCPv6::FetchMode::FETCH_UPDATE);
 
 1539        (*failure_count) = 0;
 
 1541    } 
catch (
const std::exception& ex) {
 
 1548        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.
void 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.
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 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.