Kea  1.5.0
ctrl_dhcp4_srv.h
Go to the documentation of this file.
1 // Copyright (C) 2012-2018 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 
10 #include <asiolink/asio_wrapper.h>
11 #include <asiolink/asiolink.h>
12 #include <cc/data.h>
13 #include <cc/command_interpreter.h>
15 #include <dhcpsrv/timer_mgr.h>
16 #include <dhcp4/dhcp4_srv.h>
17 
18 namespace isc {
19 namespace dhcp {
20 
26 public:
27 
31  ControlledDhcpv4Srv(uint16_t port = DHCP4_SERVER_PORT);
32 
35 
42  void init(const std::string& config_file);
43 
55  loadConfigFile(const std::string& file_name);
56 
61  void cleanup();
62 
64  void shutdown();
65 
88  processCommand(const std::string& command, isc::data::ConstElementPtr args);
89 
104 
114 
119  return (server_);
120  }
121 
122 
123 private:
130  static void sessionReader(void);
131 
141  commandShutdownHandler(const std::string& command,
143 
154  commandLibReloadHandler(const std::string& command,
156 
167  commandConfigReloadHandler(const std::string& command,
169 
179  commandConfigGetHandler(const std::string& command,
181 
196  commandConfigWriteHandler(const std::string& command,
198 
210  commandConfigSetHandler(const std::string& command,
212 
224  commandConfigTestHandler(const std::string& command,
226 
235  commandDhcpDisableHandler(const std::string& command,
237 
245  commandDhcpEnableHandler(const std::string& command,
247 
248 
259  commandVersionGetHandler(const std::string& command,
261 
271  commandBuildReportHandler(const std::string& command,
273 
288  commandLeasesReclaimHandler(const std::string& command,
290 
307  void reclaimExpiredLeases(const size_t max_leases, const uint16_t timeout,
308  const bool remove_lease,
309  const uint16_t max_unwarned_cycles);
310 
319  void deleteExpiredReclaimedLeases(const uint32_t secs);
320 
339  void dbReconnect(db::ReconnectCtlPtr db_reconnect_ctl);
340 
359  bool dbLostCallback(db::ReconnectCtlPtr db_reconnect_ctl);
360 
365  static ControlledDhcpv4Srv* server_;
366 
368  isc::asiolink::IOService io_service_;
369 
374  TimerMgrPtr timer_mgr_;
375 };
376 
377 }; // namespace isc::dhcp
378 }; // namespace isc
379 
380 #endif
isc::dhcp::ControlledDhcpv4Srv::shutdown
void shutdown()
Initiates shutdown procedure for the whole DHCPv4 server.
Definition: ctrl_dhcp4_srv.cc:791
timer_mgr.h
isc::dhcp::ControlledDhcpv4Srv::init
void init(const std::string &config_file)
Initializes the server.
Definition: ctrl_dhcp4_srv.cc:80
isc
Defines the logger used by the top-level component of kea-dhcp-ddns.
Definition: agent_parser.cc:144
dhcp4_srv.h
command_interpreter.h
isc::dhcp::ControlledDhcpv4Srv::loadConfigFile
isc::data::ConstElementPtr loadConfigFile(const std::string &file_name)
Loads specific config file.
Definition: ctrl_dhcp4_srv.cc:118
isc::dhcp::ControlledDhcpv4Srv::getInstance
static ControlledDhcpv4Srv * getInstance()
Returns pointer to the sole instance of Dhcpv4Srv.
Definition: ctrl_dhcp4_srv.h:118
isc::dhcp::ControlledDhcpv4Srv::processConfig
static isc::data::ConstElementPtr processConfig(isc::data::ConstElementPtr new_config)
Configuration processor.
Definition: ctrl_dhcp4_srv.cc:576
isc::dhcp::ControlledDhcpv4Srv
Controlled version of the DHCPv4 server.
Definition: ctrl_dhcp4_srv.h:25
database_connection.h
isc::dhcp::TimerMgrPtr
boost::shared_ptr< TimerMgr > TimerMgrPtr
Type definition of the shared pointer to TimerMgr.
Definition: timer_mgr.h:22
isc::dhcp::ControlledDhcpv4Srv::checkConfig
isc::data::ConstElementPtr checkConfig(isc::data::ConstElementPtr new_config)
Configuration checker.
Definition: ctrl_dhcp4_srv.cc:700
data.h
isc::dhcp::Dhcpv4Srv
DHCPv4 server service.
Definition: dhcp4_srv.h:194
isc::dhcp::ControlledDhcpv4Srv::processCommand
static isc::data::ConstElementPtr processCommand(const std::string &command, isc::data::ConstElementPtr args)
Command processor.
Definition: ctrl_dhcp4_srv.cc:511
isc::dhcp::ControlledDhcpv4Srv::~ControlledDhcpv4Srv
~ControlledDhcpv4Srv()
Destructor.
Definition: ctrl_dhcp4_srv.cc:796
isc::data::ConstElementPtr
boost::shared_ptr< const Element > ConstElementPtr
Definition: data.h:23
isc::db::ReconnectCtlPtr
boost::shared_ptr< ReconnectCtl > ReconnectCtlPtr
Pointer to an instance of ReconnectCtl.
Definition: database_connection.h:130
isc::dhcp::ControlledDhcpv4Srv::ControlledDhcpv4Srv
ControlledDhcpv4Srv(uint16_t port=DHCP4_SERVER_PORT)
Constructor.
Definition: ctrl_dhcp4_srv.cc:718
asio_wrapper.h
isc::dhcp::ControlledDhcpv4Srv::cleanup
void cleanup()
Performs cleanup, immediately before termination.
Definition: ctrl_dhcp4_srv.cc:103