Kea 2.7.4
|
Application Controller. More...
#include <d_controller.h>
Public Member Functions | |
DControllerBase (const char *app_name, const char *bin_name) | |
Constructor. | |
virtual | ~DControllerBase () |
Destructor. | |
isc::data::ConstElementPtr | buildReportHandler (const std::string &command, isc::data::ConstElementPtr args) |
handler for 'build-report' command | |
virtual isc::data::ConstElementPtr | checkConfig (isc::data::ConstElementPtr new_config) |
Instance method invoked by the configuration event handler and which processes the actual configuration check. | |
virtual isc::data::ConstElementPtr | configFromFile () |
Reconfigures the process from a configuration file. | |
isc::data::ConstElementPtr | configGetHandler (const std::string &command, isc::data::ConstElementPtr args) |
handler for config-get command | |
isc::data::ConstElementPtr | configHashGetHandler (const std::string &command, isc::data::ConstElementPtr args) |
handler for config-hash-get command | |
isc::data::ConstElementPtr | configReloadHandler (const std::string &command, isc::data::ConstElementPtr args) |
handler for config-reload command | |
isc::data::ConstElementPtr | configSetHandler (const std::string &command, isc::data::ConstElementPtr args) |
handler for config-set command | |
isc::data::ConstElementPtr | configTestHandler (const std::string &command, isc::data::ConstElementPtr args) |
handler for config-test command | |
isc::data::ConstElementPtr | configWriteHandler (const std::string &command, isc::data::ConstElementPtr args) |
handler for config-write command | |
std::string | getAppName () const |
Fetches the name of the application under control. | |
std::string | getBinName () const |
Fetches the name of the application executable. | |
std::string | getVersion (bool extended) |
returns Kea version on stdout and exit. | |
virtual int | launch (int argc, char *argv[], const bool test_mode) |
Acts as the primary entry point into the controller execution and provides the outermost application control logic: | |
isc::data::ConstElementPtr | serverTagGetHandler (const std::string &command, isc::data::ConstElementPtr args) |
handler for server-tag-get command | |
isc::data::ConstElementPtr | shutdownHandler (const std::string &command, isc::data::ConstElementPtr args) |
handler for 'shutdown' command | |
isc::data::ConstElementPtr | statusGetHandler (const std::string &command, isc::data::ConstElementPtr args) |
handler for status-get command | |
virtual isc::data::ConstElementPtr | updateConfig (isc::data::ConstElementPtr new_config) |
Instance method invoked by the configuration event handler and which processes the actual configuration update. | |
isc::data::ConstElementPtr | versionGetHandler (const std::string &command, isc::data::ConstElementPtr args) |
handler for version-get command | |
Public Member Functions inherited from isc::process::Daemon | |
Daemon () | |
Default constructor. | |
virtual | ~Daemon () |
Destructor. | |
void | checkConfigFile () const |
Checks the configuration file name. | |
virtual void | cleanup () |
Performs final deconfiguration. | |
void | createPIDFile (int pid=0) |
Creates the PID file. | |
std::string | getConfigFile () const |
Returns config file name. | |
int | getExitValue () |
Fetches the exit value. | |
std::string | getPIDFileDir () const |
Returns the directory used when forming default PID file name. | |
std::string | getPIDFileName () const |
Returns the current PID file name. | |
virtual std::list< std::list< std::string > > | jsonPathsToRedact () const |
Return a list of all paths that contain passwords or secrets. | |
isc::data::ConstElementPtr | redactConfig (isc::data::ConstElementPtr const &config) |
Redact a configuration. | |
void | setConfigFile (const std::string &config_file) |
Sets the configuration file name. | |
void | setExitValue (int value) |
Sets the exit value. | |
void | setPIDFileDir (const std::string &pid_file_dir) |
Sets the PID file directory. | |
void | setPIDFileName (const std::string &pid_file_name) |
Sets PID file name. | |
virtual void | shutdown () |
Initiates shutdown procedure for the whole server. | |
virtual size_t | writeConfigFile (const std::string &config_file, isc::data::ConstElementPtr cfg=isc::data::ConstElementPtr()) const |
Writes current configuration to specified file. | |
Protected Member Functions | |
void | checkConfigOnly () |
Check the configuration. | |
virtual DProcessBase * | createProcess ()=0 |
Abstract method that is responsible for instantiating the application process object. | |
virtual bool | customOption (int option, char *optarg) |
Virtual method that provides derivations the opportunity to support additional command line options. | |
virtual const std::string | getCustomOpts () const |
Virtual method which returns a string containing the option letters for any custom command line options supported by the derivation. | |
asiolink::IOServicePtr & | getIOService () |
Getter for fetching the controller's IOService. | |
DProcessBasePtr | getProcess () |
Fetches the current process. | |
virtual const std::string | getUsageText () const |
Virtual method which can be used to contribute derivation specific usage text. | |
virtual std::string | getVersionAddendum () |
Fetches text containing additional version specifics. | |
std::string | handleOtherObjects (isc::data::ConstElementPtr args) |
Deals with other (i.e. | |
void | initProcess () |
Instantiates the application process and then initializes it. | |
void | initSignalHandling () |
Initializes signal handling. | |
bool | isCheckOnly () const |
Supplies whether or not check only mode is enabled. | |
bool | isVerbose () const |
Supplies whether or not verbose logging is enabled. | |
void | parseArgs (int argc, char *argv[]) |
Processes the command line arguments. | |
virtual isc::data::ConstElementPtr | parseFile (const std::string &file_name) |
Parse a given file into Elements. | |
virtual isc::data::ConstElementPtr | parseText (const std::string &input) |
Parse text into Elements. | |
virtual void | processSignal (int signum) |
Application-level signal processing method. | |
void | runProcess () |
Invokes the application process's event loop,(DBaseProcess::run). | |
void | setCheckOnly (bool value) |
Method for enabling or disabling check only mode. | |
void | setVerbose (bool value) |
Method for enabling or disabling verbose logging. | |
isc::data::ConstElementPtr | shutdownProcess (isc::data::ConstElementPtr args) |
Initiates shutdown procedure. | |
void | usage (const std::string &text) |
Prints the program usage text to std error. | |
Protected Member Functions inherited from isc::process::Daemon | |
std::string | makePIDFileName () const |
Manufacture the pid file name. | |
Static Protected Member Functions | |
static DControllerBasePtr & | getController () |
Static getter which returns the singleton instance. | |
static void | setController (const DControllerBasePtr &controller) |
Static setter which sets the singleton instance. | |
Friends | |
class | DControllerTest |
Additional Inherited Members | |
Static Public Member Functions inherited from isc::process::Daemon | |
static void | configureLogger (const isc::data::ConstElementPtr &log_config, const isc::process::ConfigPtr &storage) |
Configures logger. | |
static std::string | getDefaultLoggerName () |
Returns default logger name. | |
static std::string | getProcName () |
returns the process name This value is used as when forming the default PID file name | |
static bool | getVerbose () |
Returns if running in verbose mode. | |
static std::string | getVersion (bool extended) |
returns Kea version on stdout and exits. | |
static void | loggerInit (const char *log_name, bool verbose) |
Initializes logger. | |
static void | setDefaultLoggerName (const std::string &logger) |
Sets the default logger name. | |
static void | setProcName (const std::string &proc_name) |
Sets the process name. | |
static void | setVerbose (const bool verbose) |
Sets or clears verbose mode. | |
Protected Attributes inherited from isc::process::Daemon | |
isc::asiolink::IOSignalSetPtr | signal_set_ |
A pointer to the object installing custom signal handlers. | |
boost::posix_time::ptime | start_ |
Timestamp of the start of the daemon. | |
Application Controller.
DControllerBase is an abstract singleton which provides the framework and services for managing an application process that implements the DProcessBase interface. It runs the process like a stand-alone, command line driven executable, which must be supplied a configuration file at startup. It coordinates command line argument parsing, process instantiation and initialization, and runtime control through external command and configuration event handling. It creates the IOService instance which is used for runtime control events and passes the IOService into the application process at process creation. It provides the callback handlers for command and configuration events which could be triggered by an external source. Such sources are intended to be registered with and monitored by the controller's IOService such that the appropriate handler can be invoked.
DControllerBase provides dynamic configuration file reloading upon receipt of SIGHUP, and graceful shutdown upon receipt of either SIGINT or SIGTERM.
NOTE: Derivations must supply their own static singleton instance method(s) for creating and fetching the instance. The base class declares the instance member in order for it to be available for static callback functions.
Definition at line 103 of file d_controller.h.
isc::process::DControllerBase::DControllerBase | ( | const char * | app_name, |
const char * | bin_name ) |
Constructor.
app_name | is display name of the application under control. This name appears in log statements. |
bin_name | is the name of the application executable. |
Definition at line 43 of file d_controller.cc.
|
virtual |
Destructor.
Definition at line 834 of file d_controller.cc.
References isc::process::dctl_logger, isc::process::DCTL_UNLOAD_LIBRARIES_ERROR, getIOService(), isc::hooks::HooksManager::getLibraryNames(), isc::asiolink::IOServiceMgr::instance(), LOG_ERROR, isc::hooks::HooksManager::prepareUnloadLibraries(), and isc::hooks::HooksManager::unloadLibraries().
ConstElementPtr isc::process::DControllerBase::buildReportHandler | ( | const std::string & | command, |
isc::data::ConstElementPtr | args ) |
handler for 'build-report' command
This method handles build-report command. It returns the output printed by configure script which contains most compilation parameters.
command | (ignored) |
args | (ignored) |
Definition at line 719 of file d_controller.cc.
References isc::config::CONTROL_RESULT_SUCCESS, isc::config::createAnswer(), and isc::detail::getConfigReport().
Referenced by isc::agent::CtrlAgentController::registerCommands(), and isc::d2::D2Controller::registerCommands().
|
virtual |
Instance method invoked by the configuration event handler and which processes the actual configuration check.
Provides behavioral path for both integrated and stand-alone modes. The current implementation will merge the configuration update into the existing configuration and then invoke the application process' configure method with a final rollback.
new_config | is the new configuration |
Definition at line 458 of file d_controller.cc.
Referenced by checkConfigOnly(), and configTestHandler().
|
protected |
Check the configuration.
Called by launch()
when check_only_
mode is enabled
VersionMessage | when successful but a message should be displayed |
InvalidUsage | when an error was detected |
Definition at line 180 of file d_controller.cc.
References checkConfig(), getAppName(), isc::process::Daemon::getConfigFile(), handleOtherObjects(), initProcess(), isc_throw, isc::process::Daemon::loggerInit(), isc::data::Element::map, isc::config::parseAnswer(), parseFile(), isc::process::Daemon::setDefaultLoggerName(), isc::process::Daemon::setVerbose(), and isc::Exception::what().
Referenced by launch().
|
virtual |
Reconfigures the process from a configuration file.
By default the file is assumed to be a JSON text file whose contents include at least:
To translate the JSON content into Elements, parseFile()
is called first. This virtual method provides derivations a means to parse the file content using an alternate parser. If it returns an empty pointer than the JSON parsing providing by Element::fromJSONFile() is called.
Once parsed, the method extracts the set of configuration elements for the module-name that matches the controller's app_name_, looks for the loggers entry and, if present uses it to configure logging. It then passes that set into updateConfig()
(or checkConfig()
).
The file may contain an arbitrary number of other modules.
Definition at line 362 of file d_controller.cc.
References isc::process::Daemon::configureLogger(), isc::config::CONTROL_RESULT_ERROR, isc::config::createAnswer(), isc::data::Element::fromJSONFile(), getAppName(), isc::process::Daemon::getConfigFile(), handleOtherObjects(), isc_throw, isc::data::Element::map, parseFile(), and updateConfig().
Referenced by configReloadHandler(), launch(), and processSignal().
ConstElementPtr isc::process::DControllerBase::configGetHandler | ( | const std::string & | command, |
isc::data::ConstElementPtr | args ) |
handler for config-get command
This method handles the config-get command, which retrieves the current configuration and returns it in response.
command | (ignored) |
args | (ignored) |
Definition at line 463 of file d_controller.cc.
References isc::config::CONTROL_RESULT_SUCCESS, isc::data::Element::create(), isc::config::createAnswer(), and isc::config::BaseCommandMgr::getHash().
Referenced by isc::agent::CtrlAgentController::registerCommands(), and isc::d2::D2Controller::registerCommands().
ConstElementPtr isc::process::DControllerBase::configHashGetHandler | ( | const std::string & | command, |
isc::data::ConstElementPtr | args ) |
handler for config-hash-get command
This method handles the config-hash-get command, which retrieves the current configuration and returns it in response.
command | (ignored) |
args | (ignored) |
Definition at line 473 of file d_controller.cc.
References isc::config::CONTROL_RESULT_SUCCESS, isc::data::Element::create(), isc::config::createAnswer(), isc::data::Element::createMap(), and isc::config::BaseCommandMgr::getHash().
Referenced by isc::agent::CtrlAgentController::registerCommands(), and isc::d2::D2Controller::registerCommands().
ConstElementPtr isc::process::DControllerBase::configReloadHandler | ( | const std::string & | command, |
isc::data::ConstElementPtr | args ) |
handler for config-reload command
This method handles the config-reload command, which reloads the configuration file.
command | (ignored) |
args | (ignored) |
Definition at line 606 of file d_controller.cc.
References configFromFile().
Referenced by isc::agent::CtrlAgentController::registerCommands(), and isc::d2::D2Controller::registerCommands().
ConstElementPtr isc::process::DControllerBase::configSetHandler | ( | const std::string & | command, |
isc::data::ConstElementPtr | args ) |
handler for config-set command
This method handles the config-set command, which loads configuration specified in args parameter.
command | (ignored) |
args | configuration to be checked. |
Definition at line 612 of file d_controller.cc.
References isc::process::Daemon::configureLogger(), isc::config::CONTROL_RESULT_ERROR, isc::config::createAnswer(), getAppName(), handleOtherObjects(), isc::data::Element::map, isc::config::parseAnswer(), and updateConfig().
Referenced by isc::agent::CtrlAgentController::registerCommands(), and isc::d2::D2Controller::registerCommands().
ConstElementPtr isc::process::DControllerBase::configTestHandler | ( | const std::string & | command, |
isc::data::ConstElementPtr | args ) |
handler for config-test command
This method handles the config-test command, which checks configuration specified in args parameter.
command | (ignored) |
args | configuration to be checked. |
Definition at line 561 of file d_controller.cc.
References checkConfig(), isc::config::CONTROL_RESULT_ERROR, isc::config::createAnswer(), getAppName(), handleOtherObjects(), and isc::data::Element::map.
Referenced by isc::agent::CtrlAgentController::registerCommands(), and isc::d2::D2Controller::registerCommands().
ConstElementPtr isc::process::DControllerBase::configWriteHandler | ( | const std::string & | command, |
isc::data::ConstElementPtr | args ) |
handler for config-write command
This handle processes config-write command, which writes the current configuration to disk. This command takes one optional parameter called filename. If specified, the current configuration will be written to that file. If not specified, the file used during Kea start-up will be used. To avoid any exploits, the path is always relative and .. is not allowed in the filename. This is a security measure against exploiting file writes remotely.
command | (ignored) |
args | may contain optional string argument filename |
Definition at line 483 of file d_controller.cc.
References isc::config::CONTROL_RESULT_ERROR, isc::config::CONTROL_RESULT_SUCCESS, isc::data::Element::create(), isc::config::createAnswer(), isc::data::Element::createMap(), isc::process::Daemon::getConfigFile(), isc::data::Element::map, isc::data::Element::string, and isc::process::Daemon::writeConfigFile().
Referenced by isc::agent::CtrlAgentController::registerCommands(), and isc::d2::D2Controller::registerCommands().
|
protectedpure virtual |
Abstract method that is responsible for instantiating the application process object.
It is invoked by the controller after command line argument parsing as part of the process initialization (see initProcess method).
Referenced by initProcess().
|
protectedvirtual |
Virtual method that provides derivations the opportunity to support additional command line options.
It is invoked during command line argument parsing (see parseArgs method) if the option is not recognized as a stock DControllerBase option.
option | is the option "character" from the command line, without any prefixing hyphen(s) |
optarg | is the argument value (if one) associated with the option |
Definition at line 333 of file d_controller.cc.
Referenced by parseArgs().
|
inline |
Fetches the name of the application under control.
Definition at line 221 of file d_controller.h.
Referenced by checkConfigOnly(), configFromFile(), configSetHandler(), configTestHandler(), and handleOtherObjects().
|
inline |
Fetches the name of the application executable.
Definition at line 228 of file d_controller.h.
|
inlinestaticprotected |
Static getter which returns the singleton instance.
Definition at line 477 of file d_controller.h.
Referenced by isc::agent::CtrlAgentController::instance(), isc::d2::D2Controller::instance(), and isc::netconf::NetconfController::instance().
|
inlineprotectedvirtual |
Virtual method which returns a string containing the option letters for any custom command line options supported by the derivation.
These are added to the stock options of "c", "d", ..., during command line interpretation.
Definition at line 408 of file d_controller.h.
Referenced by parseArgs().
|
inlineprotected |
Getter for fetching the controller's IOService.
Definition at line 469 of file d_controller.h.
Referenced by ~DControllerBase().
|
inlineprotected |
Fetches the current process.
Definition at line 594 of file d_controller.h.
Referenced by isc::agent::CtrlAgentController::getCtrlAgentProcess(), and isc::netconf::NetconfController::getNetconfProcess().
|
inlineprotectedvirtual |
Virtual method which can be used to contribute derivation specific usage text.
It is invoked by the usage() method under invalid usage conditions.
Definition at line 398 of file d_controller.h.
Referenced by usage().
std::string isc::process::DControllerBase::getVersion | ( | bool | extended | ) |
returns Kea version on stdout and exit.
redeclaration/redefinition. isc::process::Daemon::getVersion()
Definition at line 861 of file d_controller.cc.
References isc::cryptolink::CryptoLink::getVersion(), and isc::log::Logger::getVersion().
Referenced by parseArgs(), and versionGetHandler().
|
inlineprotectedvirtual |
Fetches text containing additional version specifics.
This method is provided so derivations can append any additional desired information such as library dependencies to the extended version text returned when DControllerBase::getVersion(true) is invoked.
Definition at line 611 of file d_controller.h.
|
protected |
Deals with other (i.e.
not application name) global objects.
Code shared between configuration handlers:
args | Command arguments. |
Definition at line 539 of file d_controller.cc.
References isc::process::DCTL_CONFIG_DEPRECATED, isc::process::dctl_logger, getAppName(), and LOG_ERROR.
Referenced by checkConfigOnly(), configFromFile(), configSetHandler(), and configTestHandler().
|
protected |
Instantiates the application process and then initializes it.
This is the second step taken during launch, following successful command line parsing. It is used to invoke the derivation-specific implementation of createProcess, following by an invoking of the newly instantiated process's init method.
throws | DControllerBaseError or indirectly DProcessBaseError if there is a failure creating or initializing the application process. |
Definition at line 339 of file d_controller.cc.
References createProcess(), isc::log::DBGLVL_START_SHUT, isc::process::DCTL_INIT_PROCESS, isc::process::dctl_logger, isc_throw, LOG_DEBUG, and isc::Exception::what().
Referenced by checkConfigOnly(), and launch().
|
protected |
Initializes signal handling.
This method configures the controller to catch and handle signals. It instantiates a IOSignalSet which listens for SIGHUP, SIGINT, and SIGTERM.
Definition at line 765 of file d_controller.cc.
References processSignal().
Referenced by launch().
|
inlineprotected |
Supplies whether or not check only mode is enabled.
Definition at line 453 of file d_controller.h.
Referenced by launch().
|
inlineprotected |
Supplies whether or not verbose logging is enabled.
Definition at line 439 of file d_controller.h.
|
virtual |
Acts as the primary entry point into the controller execution and provides the outermost application control logic:
It is intended to be called from main() and be given the command line arguments.
This function can be run in "test mode". It prevents initialization of module logger. This is used in unit tests which initialize logger in their main function. Such a logger uses environmental variables to control severity, verbosity etc.
argc | is the number of command line arguments supplied |
argv | is the array of string (char *) command line arguments |
test_mode | is a bool value which indicates if DControllerBase::launch should be run in the test mode (if true). This parameter doesn't have default value to force test implementers to enable test mode explicitly. |
throws | one of the following exceptions: InvalidUsage - Indicates invalid command line. ProcessInitError - Failed to create and initialize application process object. ProcessRunError - A fatal error occurred while in the application process event loop. |
Daemon::getExitValue()
. Definition at line 68 of file d_controller.cc.
References isc::process::Daemon::checkConfigFile(), checkConfigOnly(), configFromFile(), isc::process::Daemon::createPIDFile(), isc::log::DBGLVL_START_SHUT, isc::process::DCTL_ALREADY_RUNNING, isc::process::DCTL_CONFIG_FILE_LOAD_FAIL, isc::process::DCTL_DEVELOPMENT_VERSION, isc::process::DCTL_INIT_PROCESS_FAIL, isc::process::dctl_logger, isc::process::DCTL_PID_FILE_ERROR, isc::process::DCTL_PROCESS_FAILED, isc::process::DCTL_SHUTDOWN, isc::process::DCTL_STANDALONE, isc::process::DCTL_STARTING, isc::process::Daemon::getExitValue(), initProcess(), initSignalHandling(), isc_throw, isCheckOnly(), LOG_DEBUG, LOG_FATAL, LOG_INFO, LOG_WARN, isc::process::Daemon::loggerInit(), isc::config::parseAnswer(), parseArgs(), runProcess(), isc::process::Daemon::setDefaultLoggerName(), isc::process::Daemon::setProcName(), isc::process::Daemon::setVerbose(), isc::process::Daemon::start_, usage(), and isc::Exception::what().
|
protected |
Processes the command line arguments.
It is the first step taken after the controller has been launched. It combines the stock list of options with those returned by getCustomOpts(), and uses cstdlib's getopt to loop through the command line. It handles stock options directly, and passes any custom options into the customOption method. Currently there are only some stock options -c/t for specifying the configuration file, -d for verbose logging, and -v/V/W for version reports.
argc | is the number of command line arguments supplied |
argv | is the array of string (char *) command line arguments |
InvalidUsage | when there are usage errors. |
VersionMessage | if the -v, -V or -W arguments is given. |
Definition at line 244 of file d_controller.cc.
References customOption(), isc::detail::getConfigReport(), getCustomOpts(), getVersion(), isc_throw, and isc::process::Daemon::setConfigFile().
Referenced by launch().
|
protectedvirtual |
Parse a given file into Elements.
This method provides a means for deriving classes to use alternate parsing mechanisms to parse configuration files into the corresponding isc::data::Elements. The elements produced must be equivalent to those which would be produced by the original JSON parsing. Implementations should throw when encountering errors.
The default implementation returns an empty pointer, signifying to callers that they should submit the file to the original parser.
file_name | pathname of the file to parse |
Reimplemented in isc::agent::CtrlAgentController, and isc::netconf::NetconfController.
Definition at line 62 of file d_controller.cc.
Referenced by checkConfigOnly(), and configFromFile().
|
inlineprotectedvirtual |
Parse text into Elements.
This method provides a means for deriving classes to use alternate parsing mechanisms to parse configuration text into the corresponding isc::data::Elements. The elements produced must be equivalent to those which would be produced by the original JSON parsing. Implementations should throw when encountering errors.
The default implementation returns an empty pointer, signifying to callers that they should submit the text to the original parser.
input | text to parse |
Definition at line 537 of file d_controller.h.
|
protectedvirtual |
Application-level signal processing method.
This method is the last step in processing a OS signal occurrence. It currently supports the following signals as follows:
Reimplemented in isc::netconf::NetconfController.
Definition at line 780 of file d_controller.cc.
References configFromFile(), isc::log::DBGLVL_START_SHUT, isc::process::DCTL_CFG_FILE_RELOAD_ERROR, isc::process::DCTL_CFG_FILE_RELOAD_SIGNAL_RECVD, isc::process::dctl_logger, isc::process::DCTL_SHUTDOWN_SIGNAL_RECVD, isc::process::DCTL_UNSUPPORTED_SIGNAL, isc::process::Daemon::getConfigFile(), LOG_DEBUG, LOG_ERROR, LOG_INFO, LOG_WARN, isc::config::parseAnswer(), and shutdownHandler().
Referenced by initSignalHandling(), and isc::netconf::NetconfController::processSignal().
|
protected |
Invokes the application process's event loop,(DBaseProcess::run).
It is called during launch only after successfully completing the requested setup: command line parsing, application initialization, and session establishment (if not stand-alone). The process event loop is expected to only return upon application shutdown either in response to the shutdown command or due to an unrecoverable error.
Definition at line 437 of file d_controller.cc.
References isc::log::DBGLVL_START_SHUT, isc::process::dctl_logger, isc::process::DCTL_RUN_PROCESS, isc_throw, and LOG_DEBUG.
Referenced by launch().
ConstElementPtr isc::process::DControllerBase::serverTagGetHandler | ( | const std::string & | command, |
isc::data::ConstElementPtr | args ) |
handler for server-tag-get command
This method handles the server-tag-get command, which retrieves the current server tag and returns it in response.
command | (ignored) |
args | (ignored) |
Definition at line 678 of file d_controller.cc.
References isc::config::CONTROL_RESULT_SUCCESS, isc::data::Element::create(), isc::config::createAnswer(), and isc::data::Element::createMap().
|
inlineprotected |
Method for enabling or disabling check only mode.
setVerbose
are currently not used.value | is the new value to assign the flag. |
Definition at line 462 of file d_controller.h.
|
staticprotected |
Static setter which sets the singleton instance.
controller | is a pointer to the singleton instance. |
throws | DControllerBase error if an attempt is made to set the instance a second time. |
Definition at line 51 of file d_controller.cc.
References isc_throw.
Referenced by isc::agent::CtrlAgentController::instance(), isc::d2::D2Controller::instance(), and isc::netconf::NetconfController::instance().
|
inlineprotected |
Method for enabling or disabling verbose logging.
value | is the new value to assign the flag. |
Definition at line 446 of file d_controller.h.
ConstElementPtr isc::process::DControllerBase::shutdownHandler | ( | const std::string & | command, |
isc::data::ConstElementPtr | args ) |
handler for 'shutdown' command
This method handles shutdown command. It initiates the shutdown procedure using CPL methods.
command | (ignored) |
args | (ignored) |
Definition at line 724 of file d_controller.cc.
References isc::config::CONTROL_RESULT_ERROR, isc::config::createAnswer(), isc::data::Element::integer, isc::data::Element::map, isc::process::Daemon::setExitValue(), and shutdownProcess().
Referenced by processSignal(), isc::agent::CtrlAgentController::registerCommands(), and isc::d2::D2Controller::registerCommands().
|
protected |
Initiates shutdown procedure.
This method is invoked by executeCommand in response to the shutdown command. It will invoke the application process's shutdown method which causes the process to to begin its shutdown process.
Note, it is assumed that the process of shutting down is neither instantaneous nor synchronous. This method does not "block" waiting until the process has halted. Rather it is used to convey the need to shutdown. A successful return indicates that the shutdown has successfully commenced, but does not indicate that the process has actually exited.
args | is a set of derivation-specific arguments (if any) for the shutdown command. |
Definition at line 753 of file d_controller.cc.
References isc::config::CONTROL_RESULT_SUCCESS, isc::config::createAnswer(), isc::process::dctl_logger, isc::process::DCTL_NOT_RUNNING, and LOG_WARN.
Referenced by shutdownHandler().
ConstElementPtr isc::process::DControllerBase::statusGetHandler | ( | const std::string & | command, |
isc::data::ConstElementPtr | args ) |
handler for status-get command
This method handles the status-get command, which retrieves the server process information i.e. the pid and returns it in response.
command | (ignored) |
args | (ignored) |
Definition at line 687 of file d_controller.cc.
References isc::config::CONTROL_RESULT_SUCCESS, isc::data::Element::create(), isc::config::createAnswer(), isc::data::Element::createMap(), and isc::process::Daemon::start_.
Referenced by isc::agent::CtrlAgentController::registerCommands(), and isc::d2::D2Controller::registerCommands().
|
virtual |
Instance method invoked by the configuration event handler and which processes the actual configuration update.
Provides behavioral path for both integrated and stand-alone modes. The current implementation will merge the configuration update into the existing configuration and then invoke the application process' configure method.
new_config | is the new configuration |
Definition at line 452 of file d_controller.cc.
Referenced by configFromFile(), and configSetHandler().
|
protected |
Prints the program usage text to std error.
text | is a string message which will preceded the usage text. This is intended to be used for specific usage violation messages. |
Definition at line 813 of file d_controller.cc.
References getUsageText().
ConstElementPtr isc::process::DControllerBase::versionGetHandler | ( | const std::string & | command, |
isc::data::ConstElementPtr | args ) |
handler for version-get command
This method handles the version-get command. It returns the basic and extended version.
command | (ignored) |
args | (ignored) |
Definition at line 707 of file d_controller.cc.
References isc::config::CONTROL_RESULT_SUCCESS, isc::data::Element::create(), isc::config::createAnswer(), isc::data::Element::createMap(), and getVersion().
Referenced by isc::agent::CtrlAgentController::registerCommands(), and isc::d2::D2Controller::registerCommands().
|
friend |
Definition at line 657 of file d_controller.h.