Kea 2.5.8
ctrl_dhcp4_srv.h
Go to the documentation of this file.
1// Copyright (C) 2012-2023 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_DHCPV4_SRV_H
8#define CTRL_DHCPV4_SRV_H
9
11#include <asiolink/asiolink.h>
12#include <cc/data.h>
14#include <util/reconnect_ctl.h>
15#include <dhcpsrv/timer_mgr.h>
16#include <dhcp4/dhcp4_srv.h>
17
18namespace isc {
19namespace dhcp {
20
26public:
27
32 ControlledDhcpv4Srv(uint16_t server_port = DHCP4_SERVER_PORT,
33 uint16_t client_port = 0);
34
36 virtual ~ControlledDhcpv4Srv();
37
44 void init(const std::string& config_file);
45
63 loadConfigFile(const std::string& file_name);
64
69 void cleanup();
70
73 virtual void shutdownServer(int exit_value);
74
105 processCommand(const std::string& command, isc::data::ConstElementPtr args);
106
121
131
142
147 return (server_);
148 }
149
150private:
157 static void sessionReader(void);
158
168 commandShutdownHandler(const std::string& command,
170
181 commandLibReloadHandler(const std::string& command,
183
194 commandConfigReloadHandler(const std::string& command,
196
206 commandConfigGetHandler(const std::string& command,
208
218 commandConfigHashGetHandler(const std::string& command,
220
235 commandConfigWriteHandler(const std::string& command,
237
248 commandConfigSetHandler(const std::string& command,
250
261 commandConfigTestHandler(const std::string& command,
263
272 commandDhcpDisableHandler(const std::string& command,
274
282 commandDhcpEnableHandler(const std::string& command,
284
295 commandVersionGetHandler(const std::string& command,
297
307 commandBuildReportHandler(const std::string& command,
309
324 commandLeasesReclaimHandler(const std::string& command,
326
336 commandServerTagGetHandler(const std::string& command,
338
349 commandConfigBackendPullHandler(const std::string& command,
351
361 commandStatusGetHandler(const std::string& command,
363
374 commandStatisticSetMaxSampleCountAllHandler(const std::string& command,
376
387 commandStatisticSetMaxSampleAgeAllHandler(const std::string& command,
389
406 void reclaimExpiredLeases(const size_t max_leases, const uint16_t timeout,
407 const bool remove_lease,
408 const uint16_t max_unwarned_cycles);
409
418 void deleteExpiredReclaimedLeases(const uint32_t secs);
419
437 bool dbLostCallback(util::ReconnectCtlPtr db_reconnect_ctl);
438
450 bool dbRecoveredCallback(util::ReconnectCtlPtr db_reconnect_ctl);
451
462 bool dbFailedCallback(util::ReconnectCtlPtr db_reconnect_ctl);
463
471 void openSocketsFailedCallback(util::ReconnectCtlPtr reconnect_ctl);
472
484 void cbFetchUpdates(const SrvConfigPtr& srv_cfg,
485 boost::shared_ptr<unsigned> failure_count);
486
491 static ControlledDhcpv4Srv* server_;
492
497 TimerMgrPtr timer_mgr_;
498};
499
500} // namespace dhcp
501} // namespace isc
502
503#endif
Controlled version of the DHCPv4 server.
virtual ~ControlledDhcpv4Srv()
Destructor.
static isc::data::ConstElementPtr finishConfigHookLibraries(isc::data::ConstElementPtr config)
Configuration checker for hook libraries.
isc::data::ConstElementPtr loadConfigFile(const std::string &file_name)
Configure DHCPv4 server using the configuration file specified.
void cleanup()
Performs cleanup, immediately before termination.
static isc::data::ConstElementPtr processCommand(const std::string &command, isc::data::ConstElementPtr args)
Command processor.
static isc::data::ConstElementPtr checkConfig(isc::data::ConstElementPtr config)
Configuration checker.
void init(const std::string &config_file)
Initializes the server.
static isc::data::ConstElementPtr processConfig(isc::data::ConstElementPtr config)
Configuration processor.
static ControlledDhcpv4Srv * getInstance()
Returns pointer to the sole instance of Dhcpv4Srv.
virtual void shutdownServer(int exit_value)
Initiates shutdown procedure for the whole DHCPv4 server.
DHCPv4 server service.
Definition: dhcp4_srv.h:253
This file contains several functions and constants that are used for handling commands and responses ...
boost::shared_ptr< const Element > ConstElementPtr
Definition: data.h:29
boost::shared_ptr< TimerMgr > TimerMgrPtr
Type definition of the shared pointer to TimerMgr.
Definition: timer_mgr.h:27
boost::shared_ptr< SrvConfig > SrvConfigPtr
Non-const pointer to the SrvConfig.
Definition: srv_config.h:1267
boost::shared_ptr< ReconnectCtl > ReconnectCtlPtr
Pointer to an instance of ReconnectCtl.
Defines the logger used by the top-level component of kea-lfc.