Kea: ctrl_dhcp6_srv.h Source File

| Kea 3.2.0-git

ctrl_dhcp6_srv.h
Go to the documentation of this file.
1// Copyright (C) 2012-2026 Internet Systems Consortium, Inc. ("ISC")
2//
3// This Source Code Form is subject to the terms of the Mozilla Public
4// License, v. 2.0. If a copy of the MPL was not distributed with this
5// file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7#ifndef CTRL_DHCPV6_SRV_H
8#define CTRL_DHCPV6_SRV_H
9
10#include <asiolink/asio_wrapper.h>
11#include <asiolink/asiolink.h>
12#include <cc/data.h>
13#include <cc/command_interpreter.h>
14#include <util/reconnect_ctl.h>
15#include <dhcpsrv/lease_mgr.h>
16#include <dhcpsrv/timer_mgr.h>
17#include <dhcp6/dhcp6_srv.h>
18
19namespace isc {
20namespace dhcp {
21
26 class ControlledDhcpv6Srv : public isc::dhcp::Dhcpv6Srv {
27public:
28
33 ControlledDhcpv6Srv(uint16_t server_port = DHCP6_SERVER_PORT,
34 uint16_t client_port = 0);
35
37 virtual ~ControlledDhcpv6Srv();
38
45 void init(const std::string& config_file);
46
63 isc::data::ConstElementPtr
64 loadConfigFile(const std::string& file_name);
65
70 void cleanup();
71
74 virtual void shutdownServer(int exit_value);
75
77 bool getShutdown() const;
78
91 static isc::data::ConstElementPtr
92 processConfig(isc::data::ConstElementPtr config);
93
101 static isc::data::ConstElementPtr
102 checkConfig(isc::data::ConstElementPtr config);
103
112 static isc::data::ConstElementPtr
113 finishConfigHookLibraries(isc::data::ConstElementPtr config);
114
118 static ControlledDhcpv6Srv* getInstance() {
119 return (server_);
120 }
121
122protected:
129 static void sessionReader(void);
130
139 isc::data::ConstElementPtr
140 commandShutdownHandler(const std::string& command,
141 isc::data::ConstElementPtr args);
142
152 isc::data::ConstElementPtr
153 commandConfigReloadHandler(const std::string& command,
154 isc::data::ConstElementPtr args);
155
164 isc::data::ConstElementPtr
165 commandConfigGetHandler(const std::string& command,
166 isc::data::ConstElementPtr args);
167
176 isc::data::ConstElementPtr
177 commandConfigHashGetHandler(const std::string& command,
178 isc::data::ConstElementPtr args);
179
193 isc::data::ConstElementPtr
194 commandConfigWriteHandler(const std::string& command,
195 isc::data::ConstElementPtr args);
196
206 isc::data::ConstElementPtr
207 commandConfigSetHandler(const std::string& command,
208 isc::data::ConstElementPtr args);
209
219 isc::data::ConstElementPtr
220 commandConfigTestHandler(const std::string& command,
221 isc::data::ConstElementPtr args);
222
230 isc::data::ConstElementPtr
231 commandDhcpDisableHandler(const std::string& command,
232 isc::data::ConstElementPtr args);
233
240 isc::data::ConstElementPtr
241 commandDhcpEnableHandler(const std::string& command,
242 isc::data::ConstElementPtr args);
243
252 isc::data::ConstElementPtr
253 commandInterfaceListHandler(const std::string& command,
254 isc::data::ConstElementPtr args);
255
264 isc::data::ConstElementPtr
265 commandInterfaceRedetectHandler(const std::string& command,
266 isc::data::ConstElementPtr args);
267
276 isc::data::ConstElementPtr
277 commandInterfaceAddHandler(const std::string& command,
278 isc::data::ConstElementPtr args);
279
289 isc::data::ConstElementPtr
290 commandVersionGetHandler(const std::string& command,
291 isc::data::ConstElementPtr args);
292
301 isc::data::ConstElementPtr
302 commandBuildReportHandler(const std::string& command,
303 isc::data::ConstElementPtr args);
304
318 isc::data::ConstElementPtr
319 commandLeasesReclaimHandler(const std::string& command,
320 isc::data::ConstElementPtr args);
321
331 isc::data::ConstElementPtr
332 commandSubnet6SelectTestHandler(const std::string& command,
333 isc::data::ConstElementPtr args);
334
343 isc::data::ConstElementPtr
344 commandServerTagGetHandler(const std::string& command,
345 isc::data::ConstElementPtr args);
346
356 isc::data::ConstElementPtr
357 commandConfigBackendPullHandler(const std::string& command,
358 isc::data::ConstElementPtr args);
359
368 isc::data::ConstElementPtr
369 commandStatusGetHandler(const std::string& command,
370 isc::data::ConstElementPtr args);
371
381 isc::data::ConstElementPtr
382 commandStatisticSetMaxSampleCountAllHandler(const std::string& command,
383 isc::data::ConstElementPtr args);
384
394 isc::data::ConstElementPtr
395 commandStatisticSetMaxSampleAgeAllHandler(const std::string& command,
396 isc::data::ConstElementPtr args);
397
407 isc::data::ConstElementPtr
408 commandLfcStartHandler(const std::string& command,
409 isc::data::ConstElementPtr args);
410
411private:
428 void reclaimExpiredLeases(const size_t max_leases, const uint16_t timeout,
429 const bool remove_lease,
430 const uint16_t max_unwarned_cycles);
431
440 void deleteExpiredReclaimedLeases(const uint32_t secs);
441
459 bool dbLostCallback(util::ReconnectCtlPtr db_reconnect_ctl);
460
472 bool dbRecoveredCallback(util::ReconnectCtlPtr db_reconnect_ctl);
473
484 bool dbFailedCallback(util::ReconnectCtlPtr db_reconnect_ctl);
485
493 void openSocketsFailedCallback(util::ReconnectCtlPtr reconnect_ctl);
494
506 void cbFetchUpdates(const SrvConfigPtr& srv_cfg,
507 boost::shared_ptr<unsigned> failure_count);
508
513 static ControlledDhcpv6Srv* server_;
514
519 TimerMgrPtr timer_mgr_;
520};
521
522} // namespace dhcp
523} // namespace isc
524
525#endif
asio_wrapper.h
asiolink.h
isc::dhcp::ControlledDhcpv6Srv::getShutdown
bool getShutdown() const
Return the server shutdown flag value.
Definition ctrl_dhcp6_srv.cc:205
isc::dhcp::ControlledDhcpv6Srv::commandVersionGetHandler
isc::data::ConstElementPtr commandVersionGetHandler(const std::string &command, isc::data::ConstElementPtr args)
@Brief handler for processing 'version-get' command
Definition ctrl_dhcp6_srv.cc:844
isc::dhcp::ControlledDhcpv6Srv::init
void init(const std::string &config_file)
Initializes the server.
Definition ctrl_dhcp6_srv.cc:102
isc::dhcp::ControlledDhcpv6Srv::cleanup
void cleanup()
Performs cleanup, immediately before termination.
Definition ctrl_dhcp6_srv.cc:127
isc::dhcp::ControlledDhcpv6Srv::commandConfigSetHandler
isc::data::ConstElementPtr commandConfigSetHandler(const std::string &command, isc::data::ConstElementPtr args)
handler for processing 'config-set' command
Definition ctrl_dhcp6_srv.cc:347
isc::dhcp::ControlledDhcpv6Srv::commandInterfaceAddHandler
isc::data::ConstElementPtr commandInterfaceAddHandler(const std::string &command, isc::data::ConstElementPtr args)
Handler for processing 'interface-add' command.
Definition ctrl_dhcp6_srv.cc:764
isc::dhcp::ControlledDhcpv6Srv::commandInterfaceRedetectHandler
isc::data::ConstElementPtr commandInterfaceRedetectHandler(const std::string &command, isc::data::ConstElementPtr args)
Handler for processing 'interface-redetect' command.
Definition ctrl_dhcp6_srv.cc:733
isc::dhcp::ControlledDhcpv6Srv::commandShutdownHandler
isc::data::ConstElementPtr commandShutdownHandler(const std::string &command, isc::data::ConstElementPtr args)
Handler for processing 'shutdown' command.
Definition ctrl_dhcp6_srv.cc:210
isc::dhcp::ControlledDhcpv6Srv::commandConfigBackendPullHandler
isc::data::ConstElementPtr commandConfigBackendPullHandler(const std::string &command, isc::data::ConstElementPtr args)
handler for config-backend-pull command
Definition ctrl_dhcp6_srv.cc:1017
isc::dhcp::ControlledDhcpv6Srv::commandLfcStartHandler
isc::data::ConstElementPtr commandLfcStartHandler(const std::string &command, isc::data::ConstElementPtr args)
handler for processing 'kea-lfc-start' command
Definition ctrl_dhcp6_srv.cc:1160
isc::dhcp::ControlledDhcpv6Srv::sessionReader
static void sessionReader(void)
Callback that will be called from iface_mgr when data is received over control socket.
isc::dhcp::ControlledDhcpv6Srv::commandConfigHashGetHandler
isc::data::ConstElementPtr commandConfigHashGetHandler(const std::string &command, isc::data::ConstElementPtr args)
handler for processing 'config-hash-get' command
Definition ctrl_dhcp6_srv.cc:274
isc::dhcp::ControlledDhcpv6Srv::commandServerTagGetHandler
isc::data::ConstElementPtr commandServerTagGetHandler(const std::string &command, isc::data::ConstElementPtr args)
handler for server-tag-get command
Definition ctrl_dhcp6_srv.cc:1006
isc::dhcp::ControlledDhcpv6Srv::commandStatisticSetMaxSampleCountAllHandler
isc::data::ConstElementPtr commandStatisticSetMaxSampleCountAllHandler(const std::string &command, isc::data::ConstElementPtr args)
handler for processing 'statistic-sample-count-set-all' command
Definition ctrl_dhcp6_srv.cc:1135
isc::dhcp::ControlledDhcpv6Srv::commandStatisticSetMaxSampleAgeAllHandler
isc::data::ConstElementPtr commandStatisticSetMaxSampleAgeAllHandler(const std::string &command, isc::data::ConstElementPtr args)
handler for processing 'statistic-sample-age-set-all' command
Definition ctrl_dhcp6_srv.cc:1147
isc::dhcp::ControlledDhcpv6Srv::commandStatusGetHandler
isc::data::ConstElementPtr commandStatusGetHandler(const std::string &command, isc::data::ConstElementPtr args)
handler for processing 'status-get' command
Definition ctrl_dhcp6_srv.cc:1056
isc::dhcp::ControlledDhcpv6Srv::commandDhcpEnableHandler
isc::data::ConstElementPtr commandDhcpEnableHandler(const std::string &command, isc::data::ConstElementPtr args)
A handler for processing 'dhcp-enable' command.
Definition ctrl_dhcp6_srv.cc:636
isc::dhcp::ControlledDhcpv6Srv::commandConfigReloadHandler
isc::data::ConstElementPtr commandConfigReloadHandler(const std::string &command, isc::data::ConstElementPtr args)
Handler for processing 'config-reload' command.
Definition ctrl_dhcp6_srv.cc:239
isc::dhcp::ControlledDhcpv6Srv::commandLeasesReclaimHandler
isc::data::ConstElementPtr commandLeasesReclaimHandler(const std::string &command, isc::data::ConstElementPtr args)
Handler for processing 'leases-reclaim' command.
Definition ctrl_dhcp6_srv.cc:863
isc::dhcp::ControlledDhcpv6Srv::commandConfigWriteHandler
isc::data::ConstElementPtr commandConfigWriteHandler(const std::string &command, isc::data::ConstElementPtr args)
handler for processing 'config-write' command
Definition ctrl_dhcp6_srv.cc:286
isc::dhcp::ControlledDhcpv6Srv::commandBuildReportHandler
isc::data::ConstElementPtr commandBuildReportHandler(const std::string &command, isc::data::ConstElementPtr args)
handler for processing 'build-report' command
Definition ctrl_dhcp6_srv.cc:855
isc::dhcp::ControlledDhcpv6Srv::finishConfigHookLibraries
static isc::data::ConstElementPtr finishConfigHookLibraries(isc::data::ConstElementPtr config)
Configuration checker for hook libraries.
Definition ctrl_dhcp6_srv.cc:1365
isc::dhcp::ControlledDhcpv6Srv::~ControlledDhcpv6Srv
virtual ~ControlledDhcpv6Srv()
Destructor.
Definition ctrl_dhcp6_srv.cc:1548
isc::dhcp::ControlledDhcpv6Srv::processConfig
static isc::data::ConstElementPtr processConfig(isc::data::ConstElementPtr config)
Configuration processor.
Definition ctrl_dhcp6_srv.cc:1169
isc::dhcp::ControlledDhcpv6Srv::commandConfigGetHandler
isc::data::ConstElementPtr commandConfigGetHandler(const std::string &command, isc::data::ConstElementPtr args)
handler for processing 'config-get' command
Definition ctrl_dhcp6_srv.cc:264
isc::dhcp::ControlledDhcpv6Srv::shutdownServer
virtual void shutdownServer(int exit_value)
Initiates shutdown procedure for the whole DHCPv6 server.
Definition ctrl_dhcp6_srv.cc:1542
isc::dhcp::ControlledDhcpv6Srv::getInstance
static ControlledDhcpv6Srv * getInstance()
Returns pointer to the sole instance of Dhcpv6Srv.
Definition ctrl_dhcp6_srv.h:118
isc::dhcp::ControlledDhcpv6Srv::loadConfigFile
isc::data::ConstElementPtr loadConfigFile(const std::string &file_name)
Configure DHCPv6 server using the configuration file specified.
Definition ctrl_dhcp6_srv.cc:133
isc::dhcp::ControlledDhcpv6Srv::checkConfig
static isc::data::ConstElementPtr checkConfig(isc::data::ConstElementPtr config)
Configuration checker.
Definition ctrl_dhcp6_srv.cc:1399
isc::dhcp::ControlledDhcpv6Srv::commandInterfaceListHandler
isc::data::ConstElementPtr commandInterfaceListHandler(const std::string &command, isc::data::ConstElementPtr args)
Handler for processing 'interface-list' command.
Definition ctrl_dhcp6_srv.cc:706
isc::dhcp::ControlledDhcpv6Srv::commandSubnet6SelectTestHandler
isc::data::ConstElementPtr commandSubnet6SelectTestHandler(const std::string &command, isc::data::ConstElementPtr args)
Handler for processing 'subnet6-select-test' command.
Definition ctrl_dhcp6_srv.cc:889
isc::dhcp::ControlledDhcpv6Srv::ControlledDhcpv6Srv
ControlledDhcpv6Srv(uint16_t server_port=DHCP6_SERVER_PORT, uint16_t client_port=0)
Constructor.
Definition ctrl_dhcp6_srv.cc:1414
isc::dhcp::ControlledDhcpv6Srv::commandDhcpDisableHandler
isc::data::ConstElementPtr commandDhcpDisableHandler(const std::string &command, isc::data::ConstElementPtr args)
A handler for processing 'dhcp-disable' command.
Definition ctrl_dhcp6_srv.cc:540
isc::dhcp::ControlledDhcpv6Srv::commandConfigTestHandler
isc::data::ConstElementPtr commandConfigTestHandler(const std::string &command, isc::data::ConstElementPtr args)
handler for processing 'config-test' command
Definition ctrl_dhcp6_srv.cc:478
isc::dhcp::Dhcpv6Srv
DHCPv6 server service.
Definition dhcp6_srv.h:66
command_interpreter.h
This file contains several functions and constants that are used for handling commands and responses ...
data.h
dhcp6_srv.h
lease_mgr.h
An abstract API for lease database.
isc::config
Definition command_interpreter.cc:23
isc::data::ConstElementPtr
boost::shared_ptr< const Element > ConstElementPtr
Definition data.h:30
isc::dhcp
Definition dhcp4/client_handler.cc:20
isc::dhcp::TimerMgrPtr
boost::shared_ptr< TimerMgr > TimerMgrPtr
Type definition of the shared pointer to TimerMgr.
Definition timer_mgr.h:27
isc::dhcp::SrvConfigPtr
boost::shared_ptr< SrvConfig > SrvConfigPtr
Non-const pointer to the SrvConfig.
Definition srv_config.h:1148
isc::util::ReconnectCtlPtr
boost::shared_ptr< ReconnectCtl > ReconnectCtlPtr
Pointer to an instance of ReconnectCtl.
Definition reconnect_ctl.h:153
isc
Defines the logger used by the top-level component of kea-lfc.
Definition check_exists_add.cc:18
reconnect_ctl.h
timer_mgr.h