34struct D2ProcessHooks {
 
   35    int hooks_index_d2_srv_configured_;
 
   61      reconf_queue_flag_(false), shutdown_type_(
SD_NORMAL) {
 
 
  107        controller->registerCommands();
 
  117            update_mgr_->sweep();
 
  131                          "Primary IO service stopped unexpectedly");
 
  134    } 
catch (
const std::exception& ex) {
 
  136        controller->deregisterCommands();
 
  138                   "Process run method failed: " << ex.what());
 
  145    controller->deregisterCommands();
 
 
  170    bool all_clear = 
false;
 
  174        switch (shutdown_type_) {
 
  180                         && (update_mgr_->getTransactionCount() == 0));
 
  188                          && (queue_mgr_->getQueueSize() == 0)
 
  189                          && (update_mgr_->getTransactionCount() == 0));
 
 
  217        .arg(args ? args->str() : 
"(no arguments)");
 
  225            args->contains(
"type")) {
 
  226            type_str = args->get(
"type")->stringValue();
 
  237                                                  "Invalid Shutdown type: " +
 
  246                                      "Shutdown initiated, type is: " +
 
 
  253        .arg(check_only ? 
"check" : 
"update")
 
  257    answer = 
getCfgMgr()->simpleParseConfig(config_set, check_only,
 
  271        reconf_queue_flag_ = 
false;
 
  286    reconf_queue_flag_ = 
true;
 
  293    std::string error(
"");
 
  297        callout_handle->setArgument(
"io_context", 
getIOService());
 
  298        callout_handle->setArgument(
"json_config", config_set);
 
  299        callout_handle->setArgument(
"server_config",
 
  301        callout_handle->setArgument(
"error", error);
 
  308            callout_handle->getArgument(
"error", error);
 
  311            reconf_queue_flag_ = 
false;
 
  321    } 
catch (
const std::exception& ex) {
 
  322        std::ostringstream err;
 
  323        err << 
"Error initializing hooks: " 
 
  336    switch (queue_mgr_->getMgrState()){
 
  346                    .arg(reconf_queue_flag_ ? 
"reconfiguration" : 
"shutdown");
 
  347                queue_mgr_->stopListening();
 
  361            size_t threshold = (((queue_mgr_->getMaxQueueSize()
 
  363            if (queue_mgr_->getQueueSize() <= threshold) {
 
  365                          .arg(threshold).arg(queue_mgr_->getMaxQueueSize());
 
  367                    queue_mgr_->startListening();
 
  402        if (reconf_queue_flag_) {
 
 
  422    reconf_queue_flag_ = 
false;
 
  425        queue_mgr_->removeListener();
 
  432        std::string ip_address = d2_params->getIpAddress().toText();
 
  433        if (ip_address == 
"0.0.0.0" || ip_address == 
"::") {
 
  435        } 
else if (ip_address != 
"127.0.0.1" && ip_address != 
"::1") {
 
  441            queue_mgr_->initUDPListener(d2_params->getIpAddress(),
 
  442                                        d2_params->getPort(),
 
  443                                        d2_params->getNcrFormat(), 
true);
 
  456        queue_mgr_->startListening();
 
 
  466    queue_mgr_->stopListening();
 
  468    queue_mgr_->removeListener();
 
 
  476    return (boost::dynamic_pointer_cast<D2CfgMgr>(
getCfgMgr()));
 
 
  508    bool sock_changed = (unix_config && current_unix_control_socket_ &&
 
  509                         !unix_config->equals(*current_unix_control_socket_));
 
  516    if (!unix_config || !current_unix_control_socket_ || sock_changed) {
 
  520        } 
else if (current_unix_control_socket_) {
 
  526    current_unix_control_socket_ = unix_config;
 
  535    } 
else if (current_http_control_socket_) {
 
  540    current_http_control_socket_ = http_config;
 
 
@ NEXT_STEP_DROP
drop the packet
This is a base class for exceptions thrown from the DNS library module.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
static IOServiceMgr & instance()
Access the IOServiceMgr singleton instance.
void pollIOServices()
Poll IOService objects.
static std::string DEFAULT_AUTHENTICATION_REALM
Default HTTP authentication realm.
void closeCommandSockets()
Close http control sockets.
void addExternalSockets(bool use_external=true)
Use external sockets flag.
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.
void openCommandSockets(const isc::data::ConstElementPtr config)
Open http control sockets using configuration.
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 openCommandSockets(const isc::data::ConstElementPtr config)
Opens unix control socket with parameters specified in socket_info (required parameters: socket-type:...
void closeCommandSockets()
Shuts down any open unix control sockets.
void addExternalSockets(bool use_external=true)
Use external sockets flag.
DHCP-DDNS Configuration Manager.
static process::DControllerBasePtr & instance()
Static singleton instance method.
D2Process(const char *name, const asiolink::IOServicePtr &io_service)
Constructor.
static const unsigned int QUEUE_RESTART_PERCENT
Defines the point at which to resume receiving requests.
virtual bool canShutdown() const
Indicates whether or not the process can perform a shutdown.
virtual void checkQueueStatus()
Monitors current queue manager state, takes action accordingly.
virtual ~D2Process()
Destructor.
virtual void run()
Implements the process's event loop.
virtual void init()
Called after instantiation to perform initialization unique to D2.
D2CfgMgrPtr getD2CfgMgr()
Returns a pointer to the configuration manager.
virtual isc::data::ConstElementPtr configure(isc::data::ConstElementPtr config_set, bool check_only=false)
Processes the given configuration.
void reconfigureCommandChannel()
(Re-)Configure the command channel.
virtual void reconfigureQueueMgr()
Initializes then starts the queue manager.
ShutdownType
Defines the shutdown types supported by D2Process.
virtual isc::data::ConstElementPtr shutdown(isc::data::ConstElementPtr args)
Initiates the D2Process shutdown process.
static const char * getShutdownTypeStr(const ShutdownType &type)
Returns a text label for the given shutdown type.
virtual size_t runIO()
Allows IO processing to run until at least callback is invoked.
D2QueueMgr creates and manages a queue of DNS update requests.
static void init()
Initialize D2 statistics.
D2UpdateMgr creates and manages update transactions.
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.
Exception thrown if the process encountered an operational error.
void setShutdownFlag(bool value)
Sets the process shut down flag to the given value.
DProcessBase(const char *app_name, asiolink::IOServicePtr io_service, DCfgMgrBasePtr cfg_mgr)
Constructor.
bool shouldShutdown() const
Checks if the process has been instructed to shut down.
asiolink::IOServicePtr & getIOService()
Fetches the controller's IOService.
DCfgMgrBasePtr & getCfgMgr()
Fetches the process's configuration manager.
static bool shouldEnforceSecurity()
Indicates security checks should be enforced.
This file contains several functions and constants that are used for handling commands and responses ...
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
#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.
ConstElementPtr parseAnswer(int &rcode, const ConstElementPtr &msg)
Parses a standard config/command level answer and returns arguments or text status code.
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< D2CfgMgr > D2CfgMgrPtr
Defines a shared pointer to D2CfgMgr.
const isc::log::MessageID DHCP_DDNS_SECURITY_CHECKS_DISABLED
const isc::log::MessageID DHCP_DDNS_QUEUE_MGR_RECOVERING
const isc::log::MessageID DHCP_DDNS_QUEUE_MGR_STOP_ERROR
const isc::log::MessageID DHCP_DDNS_FAILED
const isc::log::MessageID DHCP_DDNS_LISTENING_ON_ALL_INTERFACES
const isc::log::MessageID DHCP_DDNS_QUEUE_MGR_START_ERROR
const isc::log::MessageID DHCP_DDNS_SHUTDOWN_COMMAND
const isc::log::MessageID DHCP_DDNS_CONFIGURE
const isc::log::MessageID DHCP_DDNS_CLEARED_FOR_SHUTDOWN
const isc::log::MessageID DHCP_DDNS_QUEUE_MGR_RECONFIGURING
const isc::log::MessageID DHCP_DDNS_RUN_EXIT
const isc::log::MessageID DHCP_DDNS_CONFIGURED_CALLOUT_DROP
const isc::log::MessageID DHCP_DDNS_QUEUE_MGR_RESUME_ERROR
const isc::log::MessageID DHCP_DDNS_STARTED
boost::shared_ptr< D2Controller > D2ControllerPtr
Pointer to a process controller.
isc::log::Logger d2_logger("dhcpddns")
Defines the logger used within D2.
const isc::log::MessageID DHCP_DDNS_QUEUE_MGR_RESUMING
boost::shared_ptr< D2Params > D2ParamsPtr
Defines a pointer for D2Params instances.
const isc::log::MessageID DHCP_DDNS_QUEUE_MGR_STOPPING
const isc::log::MessageID DHCP_DDNS_NOT_ON_LOOPBACK
boost::shared_ptr< const Element > ConstElementPtr
std::string ncrProtocolToString(NameChangeProtocol protocol)
Function which converts NameChangeProtocol enums to text labels.
boost::shared_ptr< CalloutHandle > CalloutHandlePtr
A shared pointer to a CalloutHandle object.
const int DBGLVL_TRACE_BASIC
Trace basic operations.
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...
boost::shared_ptr< DCfgMgrBase > DCfgMgrBasePtr
Defines a shared pointer to DCfgMgrBase.
ConstElementPtr redactConfig(ConstElementPtr const &element, list< string > const &json_path, string obscure)
Redact a configuration.
Defines the logger used by the top-level component of kea-lfc.