 |
Kea
1.5.0
|
Go to the documentation of this file.
21 const unsigned int D2Process::QUEUE_RESTART_PERCENT = 80;
25 reconf_queue_flag_(false), shutdown_type_(SD_NORMAL) {
70 "Primary IO service stopped unexpectedly");
72 }
catch (
const std::exception& ex) {
75 "Process run method failed: " << ex.
what());
99 boost::asio::io_service& asio_io_service = io->get_io_service();
103 size_t cnt = asio_io_service.poll();
108 cnt = asio_io_service.run_one();
116 bool all_clear =
false;
120 switch (shutdown_type_) {
126 && (update_mgr_->getTransactionCount() == 0));
134 && (queue_mgr_->getQueueSize() == 0)
135 && (update_mgr_->getTransactionCount() == 0));
151 DHCP_DDNS_CLEARED_FOR_SHUTDOWN)
162 DHCP_DDNS_SHUTDOWN_COMMAND)
163 .arg(args ? args->str() :
"(no arguments)");
171 args->contains(
"type")) {
172 type_str = args->get(
"type")->stringValue();
197 .arg(check_only ?
"check" :
"update")
198 .arg(config_set->str());
201 answer =
getCfgMgr()->simpleParseConfig(config_set, check_only);
214 reconf_queue_flag_ =
false;
229 reconf_queue_flag_ =
true;
239 switch (queue_mgr_->getMgrState()){
248 DHCP_DDNS_QUEUE_MGR_STOPPING)
249 .arg(reconf_queue_flag_ ?
"reconfiguration" :
"shutdown");
250 queue_mgr_->stopListening();
264 size_t threshold = (((queue_mgr_->getMaxQueueSize()
266 if (queue_mgr_->getQueueSize() <= threshold) {
268 .arg(threshold).arg(queue_mgr_->getMaxQueueSize());
270 queue_mgr_->startListening();
305 if (reconf_queue_flag_) {
307 DHCP_DDNS_QUEUE_MGR_RECONFIGURING);
325 reconf_queue_flag_ =
false;
328 queue_mgr_->removeListener();
335 std::string ip_address = d2_params->getIpAddress().toText();
336 if (ip_address !=
"127.0.0.1" && ip_address !=
"::1") {
342 queue_mgr_->initUDPListener(d2_params->getIpAddress(),
343 d2_params->getPort(),
344 d2_params->getNcrFormat(),
true);
356 queue_mgr_->startListening();
373 return (boost::dynamic_pointer_cast<D2CfgMgr>(
getCfgMgr()));
377 const char* str =
"invalid";
asiolink::IOServicePtr & getIoService()
Fetches the controller's IOService.
#define LOG_ERROR(LOGGER, MESSAGE)
Macro to conveniently test error output and log it.
boost::shared_ptr< D2CfgMgr > D2CfgMgrPtr
Defines a shared pointer to D2CfgMgr.
isc::log::Logger d2_logger("dhcpddns")
Defines the logger used within D2.
virtual bool canShutdown() const
Indicates whether or not the process can perform a shutdown.
ConstElementPtr createAnswer(const int status_code, const std::string &text, const ConstElementPtr &arg)
This is a base class for exceptions thrown from the DNS library module.
virtual ~D2Process()
Destructor.
Defines the logger used by the top-level component of kea-dhcp-ddns.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
Exception thrown if the process encountered an operational error.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
#define LOG_DEBUG(LOGGER, LEVEL, MESSAGE)
Macro to conveniently test debug output and log it.
boost::shared_ptr< D2Params > D2ParamsPtr
Defines a pointer for D2Params instances.
D2CfgMgrPtr getD2CfgMgr()
Returns a pointer to the configuration manager.
const int DBGLVL_START_SHUT
This is given a value of 0 as that is the level selected if debugging is enabled without giving a lev...
bool shouldShutdown() const
Checks if the process has been instructed to shut down.
virtual isc::data::ConstElementPtr shutdown(isc::data::ConstElementPtr args)
Initiates the D2Process shutdown process.
#define LOG_FATAL(LOGGER, MESSAGE)
Macro to conveniently test fatal output and log it.
virtual size_t runIO()
Allows IO processing to run until at least callback is invoked.
Application Process Interface.
virtual void reconfigureQueueMgr()
Initializes then starts the queue manager.
#define LOG_WARN(LOGGER, MESSAGE)
Macro to conveniently test warn output and log it.
void setShutdownFlag(bool value)
Sets the process shut down flag to the given value.
virtual void run()
Implements the process's event loop.
boost::shared_ptr< DCfgMgrBase > DCfgMgrBasePtr
Defines a shared pointer to DCfgMgrBase.
boost::shared_ptr< IOService > IOServicePtr
Defines a smart pointer to an IOService instance.
const int DBGLVL_TRACE_BASIC
Trace basic operations.
ConstElementPtr parseAnswer(int &rcode, const ConstElementPtr &msg)
std::string ncrProtocolToString(NameChangeProtocol protocol)
Function which converts NameChangeProtocol enums to text labels.
virtual isc::data::ConstElementPtr configure(isc::data::ConstElementPtr config_set, bool check_only=false)
Processes the given configuration.
D2UpdateMgr creates and manages update transactions.
DCfgMgrBasePtr & getCfgMgr()
Fetches the process's configuration manager.
virtual void checkQueueStatus()
Monitors current queue manager state, takes action accordingly.
ShutdownType
Defines the shutdown types supported by D2Process.
D2QueueMgr creates and manages a queue of DNS update requests.
DHCP-DDNS Configuration Manager.
boost::shared_ptr< const Element > ConstElementPtr
static const char * getShutdownTypeStr(const ShutdownType &type)
Returns a text label for the given shutdown type.
#define LOG_INFO(LOGGER, MESSAGE)
Macro to conveniently test info output and log it.
static const unsigned int QUEUE_RESTART_PERCENT
Defines the point at which to resume receiving requests.
virtual void init()
Called after instantiation to perform initialization unique to D2.