Commit 355bc5c2 authored by Jeremy C. Reed's avatar Jeremy C. Reed
Browse files

[master]Merge branch 'master' of ssh://git.bind10.isc.org/var/bind10/git/bind10

edited src/bin/resolver/bench/Makefile.am
to remove unneeded linking.
parents 02c64383 d09952e1
627 [func] tmark
Logger name for DHCP-DDNS has been changed from "d2_logger" to "dhcpddns".
In addition, its log messages now use two suffixes, DCTL_ for logs the
emanate from the underlying base classes, and DHCP_DDNS_ for logs which
emanate from DHCP-DDNS specific code
(trac #2978 git 5aec5fb20b0486574226f89bd877267cb9116921)
626. [func] tmark
Created the initial implementation of DHCP-DDNS service
controller class, D2Controller, and the abstract class from
......
......@@ -21,11 +21,19 @@
namespace isc {
namespace d2 {
/// @brief Defines the application name, this is passed into base class
/// and appears in log statements.
const char* D2Controller::d2_app_name_ = "DHCP-DDNS";
/// @brief Defines the executable name. This is passed into the base class
/// by convention this should match the BIND10 module name.
const char* D2Controller::d2_bin_name_ = "b10-dhcp-ddns";
DControllerBasePtr&
D2Controller::instance() {
// If the instance hasn't been created yet, create it. Note this method
// must use the base class singleton instance methods. The base class
// must have access to the singleton in order to use it within BIND10
// must have access to the singleton in order to use it within BIND10
// static function callbacks.
if (!getController()) {
DControllerBasePtr controller_ptr(new D2Controller());
......@@ -38,11 +46,11 @@ D2Controller::instance() {
DProcessBase* D2Controller::createProcess() {
// Instantiate and return an instance of the D2 application process. Note
// that the process is passed the controller's io_service.
return (new D2Process(getName().c_str(), getIOService()));
return (new D2Process(getAppName().c_str(), getIOService()));
}
D2Controller::D2Controller()
: DControllerBase(D2_MODULE_NAME) {
: DControllerBase(d2_app_name_, d2_bin_name_) {
// set the BIND10 spec file either from the environment or
// use the production value.
if (getenv("B10_FROM_BUILD")) {
......
......@@ -21,20 +21,20 @@ namespace isc {
namespace d2 {
/// @brief Process Controller for D2 Process
/// This class is the DHCP-DDNS specific derivation of DControllerBase. It
/// creates and manages an instance of the DHCP-DDNS application process,
/// D2Process.
/// This class is the DHCP-DDNS specific derivation of DControllerBase. It
/// creates and manages an instance of the DHCP-DDNS application process,
/// D2Process.
/// @TODO Currently, this class provides only the minimum required specialized
/// behavior to run the DHCP-DDNS service. It may very well expand as the
/// service implementation evolves. Some thought was given to making
/// behavior to run the DHCP-DDNS service. It may very well expand as the
/// service implementation evolves. Some thought was given to making
/// DControllerBase a templated class but the labor savings versus the
/// potential number of virtual methods which may be overridden didn't seem
/// worth the clutter at this point.
/// worth the clutter at this point.
class D2Controller : public DControllerBase {
public:
/// @brief Static singleton instance method. This method returns the
/// base class singleton instance member. It instantiates the singleton
/// and sets the base class instance member upon first invocation.
/// base class singleton instance member. It instantiates the singleton
/// and sets the base class instance member upon first invocation.
///
/// @return returns the pointer reference to the singleton instance.
static DControllerBasePtr& instance();
......@@ -42,11 +42,19 @@ public:
/// @brief Destructor.
virtual ~D2Controller();
/// @brief Defines the application name, this is passed into base class
/// and appears in log statements.
static const char* d2_app_name_;
/// @brief Defines the executable name. This is passed into the base class
/// by convention this should match the BIND10 module name.
static const char* d2_bin_name_;
private:
/// @brief Creates an instance of the DHCP-DDNS specific application
/// @brief Creates an instance of the DHCP-DDNS specific application
/// process. This method is invoked during the process initialization
/// step of the controller launch.
///
///
/// @return returns a DProcessBase* to the application process created.
/// Note the caller is responsible for destructing the process. This
/// is handled by the base class, which wraps this pointer with a smart
......
......@@ -19,12 +19,8 @@
namespace isc {
namespace d2 {
/// @brief Defines the service name which is used in the controller constructor
/// and ultimately defines the BIND10 module name.
const char* const D2_MODULE_NAME = "b10-dhpc-ddns";
/// @brief Defines the logger used within D2.
isc::log::Logger d2_logger(D2_MODULE_NAME);
isc::log::Logger dctl_logger("dhcpddns");
} // namespace d2
} // namespace isc
......
......@@ -22,15 +22,8 @@
namespace isc {
namespace d2 {
/// @brief Defines the executable name, ultimately this is the BIND10 module
/// name.
extern const char* const D2_MODULE_NAME;
/// Define the logger for the "d2" module part of b10-d2. We could define
/// a logger in each file, but we would want to define a common name to avoid
/// spelling mistakes, so it is just one small step from there to define a
/// module-common logger.
extern isc::log::Logger d2_logger;
/// Define the logger for the "d2" logging.
extern isc::log::Logger dctl_logger;
} // namespace d2
......
......@@ -14,95 +14,100 @@
$NAMESPACE isc::d2
% D2CTL_STARTING DHCP-DDNS controller starting, pid: %1
This is an informational message issued when controller for DHCP-DDNS
service first starts.
% DCTL_CCSESSION_ENDING %1 ending control channel session
This debug message is issued just before the controller attempts
to disconnect from its session with the BIND10 control channel.
% D2CTL_STOPPING DHCP-DDNS controller is exiting
This is an informational message issued when the controller is exiting
following a shut down (normal or otherwise) of the DDHCP-DDNS process.
% DCTL_CCSESSION_STARTING %1 starting control channel session, specfile: %2
This debug message is issued just before the controller attempts
to establish a session with the BIND10 control channel.
% D2PRC_SHUTDOWN DHCP-DDNS process is performing a normal shut down
This is a debug message issued when the service process has been instructed
to shut down by the controller.
% DCTL_COMMAND_RECEIVED %1 received command %2, arguments: %3
A debug message listing the command (and possible arguments) received
from the BIND10 control system by the controller.
% D2PRC_PROCESS_INIT DHCP-DDNS application init invoked
This is a debug message issued when the D2 process enters its
init method.
% DCTL_CONFIG_LOAD_FAIL %1 configuration failed to load: %2
This critical error message indicates that the initial application
configuration has failed. The service will start, but will not
process requests until the configuration has been corrected.
% D2PRC_RUN_ENTER process has entered the event loop
This is a debug message issued when the D2 process enters its
run method.
% DCTL_CONFIG_STUB %1 configuration stub handler called
This debug message is issued when the dummy handler for configuration
events is called. This only happens during initial startup.
% D2PRC_RUN_EXIT process is exiting the event loop
This is a debug message issued when the D2 process exits the
in event loop.
% DCTL_CONFIG_UPDATE %1 updated configuration received: %2
A debug message indicating that the controller has received an
updated configuration from the BIND10 configuration system.
% D2PRC_FAILED process experienced a fatal error: %1
This is a debug message issued when the D2 process encounters an
unrecoverable error from within the event loop.
% DCTL_DISCONNECT_FAIL %1 controller failed to end session with BIND10: %2
This message indicates that while shutting down, the Dhcp-Ddns controller
encountered an error terminating communication with the BIND10. The service
will still exit. While theoretically possible, this situation is rather
unlikely.
% D2PRC_CONFIGURE new configuration received: %1
This is a debug message issued when the D2 process configure method
has been invoked.
% DCTL_INIT_PROCESS %1 initializing the application
This debug message is issued just before the controller attempts
to create and initialize its application instance.
% D2PRC_COMMAND command directive received, command: %1 - args: %2
This is a debug message issued when the D2 process command method
has been invoked.
% DCTL_INIT_PROCESS_FAIL %1 application initialization failed: %2
This error message is issued if the controller could not initialize the
application and will exit.
% D2CTL_INIT_PROCESS initializing application proces
This debug message is issued just before the controller attempts
to create and initialize its process instance.
% DCTL_NOT_RUNNING %1 application instance is not running
A warning message is issued when an attempt is made to shut down the
the application when it is not running.
% D2CTL_SESSION_FAIL failed to establish BIND 10 session: %1
The controller has failed to establish communication with the rest of BIND
10 and will exit.
% DCTL_PROCESS_FAILED %1 application execution failed: %2
The controller has encountered a fatal error while running the
application and is terminating. The reason for the failure is
included in the message.
% D2CTL_DISCONNECT_FAIL failed to disconnect from BIND 10 session: %1
This message indicates that while shutting down, the DHCP-DDNS controller
encountered an error terminating communication with the BIND10. The service
will still exit. While theoretically possible, this situation is rather
unlikely.
% DCTL_RUN_PROCESS %1 starting application event loop
This debug message is issued just before the controller invokes
the application run method.
% D2CTL_STANDALONE skipping message queue, running standalone
% DCTL_SESSION_FAIL %1 controller failed to establish BIND10 session: %1
The controller has failed to establish communication with the rest of BIND
10 and will exit.
% DCTL_STANDALONE %1 skipping message queue, running standalone
This is a debug message indicating that the controller is running in the
process in standalone mode. This means it will not connected to the BIND10
message queue. Standalone mode is only useful during program development,
application in standalone mode. This means it will not connected to the BIND10
message queue. Standalone mode is only useful during program development,
and should not be used in a production environment.
% D2CTL_RUN_PROCESS starting application proces event loop
This debug message is issued just before the controller invokes
the application process run method.
% DCTL_STARTING %1 controller starting, pid: %2
This is an informational message issued when controller for the
service first starts.
% D2CTL_FAILED process failed: %1
The controller has encountered a fatal error and is terminating.
The reason for the failure is included in the message.
% DCTL_STOPPING %1 controller is exiting
This is an informational message issued when the controller is exiting
following a shut down (normal or otherwise) of the service.
% D2CTL_CCSESSION_STARTING starting control channel session, specfile: %1
This debug message is issued just before the controller attempts
to establish a session with the BIND 10 control channel.
% DHCP_DDNS_COMMAND command directive received, command: %1 - args: %2
This is a debug message issued when the Dhcp-Ddns application command method
has been invoked.
% D2CTL_CCSESSION_ENDING ending control channel session
This debug message is issued just before the controller attempts
to disconnect from its session with the BIND 10 control channel.
% DHCP_DDNS_CONFIGURE configuration update received: %1
This is a debug message issued when the Dhcp-Ddns application configure method
has been invoked.
% D2CTL_CONFIG_STUB configuration stub handler called
This debug message is issued when the dummy handler for configuration
events is called. This only happens during intial startup.
% DHCP_DDNS_FAILED application experienced a fatal error: %1
This is a debug message issued when the Dhcp-Ddns application encounters an
unrecoverable error from within the event loop.
% D2CTL_CONFIG_LOAD_FAIL failed to load configuration: %1
This critical error message indicates that the initial process
configuration has failed. The service will start, but will not
process requests until the configuration has been corrected.
% DHCP_DDNS_PROCESS_INIT application init invoked
This is a debug message issued when the Dhcp-Ddns application enters
its init method.
% D2CTL_COMMAND_RECEIVED received command %1, arguments: %2
A debug message listing the command (and possible arguments) received
from the BIND 10 control system by the controller.
% DHCP_DDNS_RUN_ENTER application has entered the event loop
This is a debug message issued when the Dhcp-Ddns application enters
its run method.
% D2CTL_NOT_RUNNING The application process instance is not running
A warning message is issued when an attempt is made to shut down the
the process when it is not running.
% DHCP_DDNS_RUN_EXIT application is exiting the event loop
This is a debug message issued when the Dhcp-Ddns exits the
in event loop.
% D2CTL_CONFIG_UPDATE updated configuration received: %1
A debug message indicating that the controller has received an
updated configuration from the BIND 10 configuration system.
% DHCP_DDNS_SHUTDOWN application is performing a normal shut down
This is a debug message issued when the application has been instructed
to shut down by the controller.
......@@ -37,24 +37,24 @@ D2Process::run() {
// To use run(), the "managing" layer must issue an io_service::stop
// or the call to run will continue to block, and shutdown will not
// occur.
LOG_DEBUG(d2_logger, DBGLVL_START_SHUT, D2PRC_RUN_ENTER);
LOG_DEBUG(dctl_logger, DBGLVL_START_SHUT, DHCP_DDNS_RUN_ENTER);
IOServicePtr& io_service = getIoService();
while (!shouldShutdown()) {
try {
io_service->run_one();
} catch (const std::exception& ex) {
LOG_FATAL(d2_logger, D2PRC_FAILED).arg(ex.what());
LOG_FATAL(dctl_logger, DHCP_DDNS_FAILED).arg(ex.what());
isc_throw (DProcessBaseError,
"Process run method failed: " << ex.what());
}
}
LOG_DEBUG(d2_logger, DBGLVL_START_SHUT, D2PRC_RUN_EXIT);
LOG_DEBUG(dctl_logger, DBGLVL_START_SHUT, DHCP_DDNS_RUN_EXIT);
};
void
D2Process::shutdown() {
LOG_DEBUG(d2_logger, DBGLVL_START_SHUT, D2PRC_SHUTDOWN);
LOG_DEBUG(dctl_logger, DBGLVL_START_SHUT, DHCP_DDNS_SHUTDOWN);
setShutdownFlag(true);
}
......@@ -64,8 +64,8 @@ D2Process::configure(isc::data::ConstElementPtr config_set) {
// any content in config_set as valid. This is sufficient to
// allow participation as a BIND10 module, while D2 configuration support
// is being developed.
LOG_DEBUG(d2_logger, DBGLVL_TRACE_BASIC,
D2PRC_CONFIGURE).arg(config_set->str());
LOG_DEBUG(dctl_logger, DBGLVL_TRACE_BASIC,
DHCP_DDNS_CONFIGURE).arg(config_set->str());
return (isc::config::createAnswer(0, "Configuration accepted."));
}
......@@ -75,8 +75,8 @@ D2Process::command(const std::string& command, isc::data::ConstElementPtr args){
// @TODO This is the initial implementation. If and when D2 is extended
// to support its own commands, this implementation must change. Otherwise
// it should reject all commands as it does now.
LOG_DEBUG(d2_logger, DBGLVL_TRACE_BASIC,
D2PRC_COMMAND).arg(command).arg(args->str());
LOG_DEBUG(dctl_logger, DBGLVL_TRACE_BASIC,
DHCP_DDNS_COMMAND).arg(command).arg(args->str());
return (isc::config::createAnswer(COMMAND_INVALID, "Unrecognized command: "
+ command));
......
......@@ -26,11 +26,13 @@ namespace d2 {
DControllerBasePtr DControllerBase::controller_;
// Note that the constructor instantiates the controller's primary IOService.
DControllerBase::DControllerBase(const char* name)
: name_(name), stand_alone_(false), verbose_(false),
spec_file_name_(""), io_service_(new isc::asiolink::IOService()){
DControllerBase::DControllerBase(const char* app_name, const char* bin_name)
: app_name_(app_name), bin_name_(bin_name), stand_alone_(false),
verbose_(false), spec_file_name_(""),
io_service_(new isc::asiolink::IOService()){
}
void
DControllerBase::setController(const DControllerBasePtr& controller) {
if (controller_) {
......@@ -55,30 +57,33 @@ DControllerBase::launch(int argc, char* argv[]) {
// Now that we know what the mode flags are, we can init logging.
// If standalone is enabled, do not buffer initial log messages
isc::log::initLogger(name_,
isc::log::initLogger(bin_name_,
((verbose_ && stand_alone_)
? isc::log::DEBUG : isc::log::INFO),
isc::log::MAX_DEBUG_LEVEL, NULL, !stand_alone_);
LOG_DEBUG(d2_logger, DBGLVL_START_SHUT, D2CTL_STARTING).arg(getpid());
LOG_DEBUG(dctl_logger, DBGLVL_START_SHUT, DCTL_STARTING)
.arg(app_name_).arg(getpid());
try {
// Step 2 is to create and initialize the application process object.
initProcess();
} catch (const std::exception& ex) {
LOG_FATAL(d2_logger, D2CTL_INIT_PROCESS).arg(ex.what());
isc_throw (ProcessInitError,
LOG_FATAL(dctl_logger, DCTL_INIT_PROCESS_FAIL)
.arg(app_name_).arg(ex.what());
isc_throw (ProcessInitError,
"Application Process initialization failed: " << ex.what());
}
// Next we connect if we are running integrated.
if (stand_alone_) {
LOG_DEBUG(d2_logger, DBGLVL_START_SHUT, D2CTL_STANDALONE);
LOG_DEBUG(dctl_logger, DBGLVL_START_SHUT, DCTL_STANDALONE)
.arg(app_name_);
} else {
try {
establishSession();
} catch (const std::exception& ex) {
LOG_FATAL(d2_logger, D2CTL_SESSION_FAIL).arg(ex.what());
isc_throw (SessionStartError,
LOG_FATAL(dctl_logger, DCTL_SESSION_FAIL).arg(ex.what());
isc_throw (SessionStartError,
"Session start up failed: " << ex.what());
}
}
......@@ -88,8 +93,9 @@ DControllerBase::launch(int argc, char* argv[]) {
try {
runProcess();
} catch (const std::exception& ex) {
LOG_FATAL(d2_logger, D2CTL_FAILED).arg(ex.what());
isc_throw (ProcessRunError,
LOG_FATAL(dctl_logger, DCTL_PROCESS_FAILED)
.arg(app_name_).arg(ex.what());
isc_throw (ProcessRunError,
"Application process event loop failed: " << ex.what());
}
......@@ -98,13 +104,14 @@ DControllerBase::launch(int argc, char* argv[]) {
try {
disconnectSession();
} catch (const std::exception& ex) {
LOG_ERROR(d2_logger, D2CTL_DISCONNECT_FAIL).arg(ex.what());
LOG_ERROR(dctl_logger, DCTL_DISCONNECT_FAIL)
.arg(app_name_).arg(ex.what());
isc_throw (SessionEndError, "Session end failed: " << ex.what());
}
}
// All done, so bail out.
LOG_INFO(d2_logger, D2CTL_STOPPING);
LOG_INFO(dctl_logger, DCTL_STOPPING).arg(app_name_);
}
......@@ -132,7 +139,7 @@ DControllerBase::parseArgs(int argc, char* argv[])
case '?': {
// We hit an invalid option.
isc_throw(InvalidUsage, "unsupported option: ["
isc_throw(InvalidUsage, "unsupported option: ["
<< static_cast<char>(optopt) << "] "
<< (!optarg ? "" : optarg));
......@@ -143,7 +150,7 @@ DControllerBase::parseArgs(int argc, char* argv[])
// We hit a valid custom option
if (!customOption(ch, optarg)) {
// This would be a programmatic error.
isc_throw(InvalidUsage, " Option listed but implemented?: ["
isc_throw(InvalidUsage, " Option listed but implemented?: ["
<< static_cast<char>(ch) << "] "
<< (!optarg ? "" : optarg));
}
......@@ -166,7 +173,7 @@ DControllerBase::customOption(int /* option */, char* /*optarg*/)
void
DControllerBase::initProcess() {
LOG_DEBUG(d2_logger, DBGLVL_START_SHUT, D2CTL_INIT_PROCESS);
LOG_DEBUG(dctl_logger, DBGLVL_START_SHUT, DCTL_INIT_PROCESS).arg(app_name_);
// Invoke virtual method to instantiate the application process.
try {
......@@ -188,8 +195,8 @@ DControllerBase::initProcess() {
void
DControllerBase::establishSession() {
LOG_DEBUG(d2_logger, DBGLVL_START_SHUT, D2CTL_CCSESSION_STARTING)
.arg(spec_file_name_);
LOG_DEBUG(dctl_logger, DBGLVL_START_SHUT, DCTL_CCSESSION_STARTING)
.arg(app_name_).arg(spec_file_name_);
// Create the BIND10 command control session with the our IOService.
cc_session_ = SessionPtr(new isc::cc::Session(
......@@ -223,7 +230,8 @@ DControllerBase::establishSession() {
int ret = 0;
isc::data::ConstElementPtr comment = isc::config::parseAnswer(ret, answer);
if (ret) {
LOG_ERROR(d2_logger, D2CTL_CONFIG_LOAD_FAIL).arg(comment->str());
LOG_ERROR(dctl_logger, DCTL_CONFIG_LOAD_FAIL)
.arg(app_name_).arg(comment->str());
}
// Lastly, call onConnect. This allows deriving class to execute custom
......@@ -233,7 +241,7 @@ DControllerBase::establishSession() {
void
DControllerBase::runProcess() {
LOG_DEBUG(d2_logger, DBGLVL_START_SHUT, D2CTL_RUN_PROCESS);
LOG_DEBUG(dctl_logger, DBGLVL_START_SHUT, DCTL_RUN_PROCESS).arg(app_name_);
if (!process_) {
// This should not be possible.
isc_throw(DControllerBaseError, "Process not initialized");
......@@ -245,7 +253,8 @@ DControllerBase::runProcess() {
}
void DControllerBase::disconnectSession() {
LOG_DEBUG(d2_logger, DBGLVL_START_SHUT, D2CTL_CCSESSION_ENDING);
LOG_DEBUG(dctl_logger, DBGLVL_START_SHUT, DCTL_CCSESSION_ENDING)
.arg(app_name_);
// Call virtual onDisconnect. Allows deriving class to execute custom
// logic prior to session loss.
......@@ -265,24 +274,16 @@ void DControllerBase::disconnectSession() {
isc::data::ConstElementPtr
DControllerBase::dummyConfigHandler(isc::data::ConstElementPtr) {
LOG_DEBUG(d2_logger, DBGLVL_START_SHUT, D2CTL_CONFIG_STUB);
LOG_DEBUG(dctl_logger, DBGLVL_START_SHUT, DCTL_CONFIG_STUB)
.arg(controller_->getAppName());
return (isc::config::createAnswer(0, "Configuration accepted."));
}
isc::data::ConstElementPtr
DControllerBase::configHandler(isc::data::ConstElementPtr new_config) {
LOG_DEBUG(d2_logger, DBGLVL_COMMAND, D2CTL_CONFIG_UPDATE)
.arg(new_config->str());
if (!controller_) {
// This should never happen as we install the handler after we
// instantiate the server.
isc::data::ConstElementPtr answer =
isc::config::createAnswer(1, "Configuration rejected,"
" Controller has not been initialized.");
return (answer);
}
LOG_DEBUG(dctl_logger, DBGLVL_COMMAND, DCTL_CONFIG_UPDATE)
.arg(controller_->getAppName()).arg(new_config->str());
// Invoke the instance method on the controller singleton.
return (controller_->updateConfig(new_config));
......@@ -293,17 +294,8 @@ isc::data::ConstElementPtr
DControllerBase::commandHandler(const std::string& command,
isc::data::ConstElementPtr args) {
LOG_DEBUG(d2_logger, DBGLVL_COMMAND, D2CTL_COMMAND_RECEIVED)
.arg(command).arg(args->str());
if (!controller_ ) {
// This should never happen as we install the handler after we
// instantiate the server.
isc::data::ConstElementPtr answer =
isc::config::createAnswer(1, "Command rejected,"
" Controller has not been initialized.");
return (answer);
}
LOG_DEBUG(dctl_logger, DBGLVL_COMMAND, DCTL_COMMAND_RECEIVED)
.arg(controller_->getAppName()).arg(command).arg(args->str());
// Invoke the instance method on the controller singleton.
return (controller_->executeCommand(command, args));
......@@ -399,7 +391,7 @@ DControllerBase::shutdown() {
} else {
// Not really a failure, but this condition is worth noting. In reality
// it should be pretty hard to cause this.
LOG_WARN(d2_logger, D2CTL_NOT_RUNNING);
LOG_WARN(dctl_logger, DCTL_NOT_RUNNING).arg(app_name_);
}
return (isc::config::createAnswer(0, "Shutting down."));
......@@ -412,7 +404,7 @@ DControllerBase::usage(const std::string & text)
std::cerr << "Usage error: " << text << std::endl;
}
std::cerr << "Usage: " << name_ << std::endl;
std::cerr << "Usage: " << bin_name_ << std::endl;
std::cerr << " -v: verbose output" << std::endl;
std::cerr << " -s: stand-alone mode (don't connect to BIND10)"
<< std::endl;
......
......@@ -56,7 +56,7 @@ public:
isc::Exception(file, line, what) { };
};
/// @brief Exception thrown when the application process encounters an
/// @brief Exception thrown when the application process encounters an
/// operation in its event loop (i.e. run method).
class ProcessRunError: public isc::Exception {
public:
......@@ -104,26 +104,28 @@ typedef boost::shared_ptr<isc::config::ModuleCCSession> ModuleCCSessionPtr;
/// creation. In integrated mode it is responsible for establishing BIND10
/// session(s) and passes this IOService into the session creation method(s).
/// It also provides the callback handlers for command and configuration events
/// received from the external framework (aka BIND10). For example, when
/// received from the external framework (aka BIND10). For example, when
/// running in integrated mode and a user alters the configuration with the
/// bindctl tool, BIND10 will emit a configuration message which is sensed by
/// the controller's IOService. The IOService in turn invokes the configuration
/// callback, DControllerBase::configHandler(). If the user issues a command
/// such as shutdown via bindctl, BIND10 will emit a command message, which is
/// sensed by controller's IOService which invokes the command callback,
/// sensed by controller's IOService which invokes the command callback,
/// DControllerBase::commandHandler().
///
/// 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 BIND10 callback functions. This
/// would not be required if BIND10 supported instance method callbacks.
/// would not be required if BIND10 supported instance method callbacks.
class DControllerBase : public boost::noncopyable {
public:
/// @brief Constructor
///
/// @param name name is a text label for the controller. Typically this
/// would be the BIND10 module name.
DControllerBase(const char* name);
/// @param app_name is display name of the application under control. This
/// name appears in log statements.
/// @param bin_name is the name of the application executable. Typically
/// this matches the BIND10 module name.
DControllerBase(const char* app_name, const char* bin_name);
/// @brief Destructor
virtual ~DControllerBase();
......@@ -150,9 +152,9 @@ public:
/// ProcessInitError - Failed to create and initialize application
/// process object.
/// SessionStartError - Could not connect to BIND10 (integrated mode only).
/// ProcessRunError - A fatal error occurred while in the application
/// ProcessRunError - A fatal error occurred while in the application
/// process event loop.
/// SessionEndError - Could not disconnect from BIND10 (integrated mode
/// SessionEndError - Could not disconnect from BIND10 (integrated mode
/// only).
void launch(int argc, char* argv[]);
......@@ -334,11 +336,18 @@ protected:
return ("");