Commit 21f3ea90 authored by Thomas Markwalder's avatar Thomas Markwalder

[2956] Changes to address review comments. Note that the module name is

now b10-dhcp-ddns.
parent b222f7fa
...@@ -18,15 +18,15 @@ pkglibexecdir = $(libexecdir)/@PACKAGE@ ...@@ -18,15 +18,15 @@ pkglibexecdir = $(libexecdir)/@PACKAGE@
CLEANFILES = *.gcno *.gcda spec_config.h d2_messages.h d2_messages.cc CLEANFILES = *.gcno *.gcda spec_config.h d2_messages.h d2_messages.cc
man_MANS = b10-d2.8 man_MANS = b10-dhcp-ddns.8
DISTCLEANFILES = $(man_MANS) DISTCLEANFILES = $(man_MANS)
EXTRA_DIST = $(man_MANS) b10-d2.xml d2.spec EXTRA_DIST = $(man_MANS) b10-dhcp-ddns.xml dhcp-ddns.spec
if GENERATE_DOCS if GENERATE_DOCS
b10-d2.8: b10-d2.xml b10-dhcp-ddns.8: b10-dhcp-ddns.xml
@XSLTPROC@ --novalid --xinclude --nonet -o $@ \ @XSLTPROC@ --novalid --xinclude --nonet -o $@ \
http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl \ http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl \
$(srcdir)/b10-d2.xml $(srcdir)/b10-dchdp-ddns.xml
else else
...@@ -44,23 +44,23 @@ d2_messages.h d2_messages.cc: d2_messages.mes ...@@ -44,23 +44,23 @@ d2_messages.h d2_messages.cc: d2_messages.mes
BUILT_SOURCES = spec_config.h d2_messages.h d2_messages.cc BUILT_SOURCES = spec_config.h d2_messages.h d2_messages.cc
pkglibexec_PROGRAMS = b10-d2 pkglibexec_PROGRAMS = b10-dhcp-ddns
b10_d2_SOURCES = main.cc b10_dhcp_ddns_SOURCES = main.cc
b10_d2_SOURCES += d2_log.cc d2_log.h b10_dhcp_ddns_SOURCES += d2_log.cc d2_log.h
b10_d2_SOURCES += d_process.h b10_dhcp_ddns_SOURCES += d_process.h
b10_d2_SOURCES += d2_process.cc d2_process.h b10_dhcp_ddns_SOURCES += d2_process.cc d2_process.h
b10_d2_SOURCES += d_controller.cc d_controller.h b10_dhcp_ddns_SOURCES += d_controller.cc d_controller.h
b10_d2_SOURCES += d2_controller.cc d2_controller.h b10_dhcp_ddns_SOURCES += d2_controller.cc d2_controller.h
nodist_b10_d2_SOURCES = d2_messages.h d2_messages.cc nodist_b10_dhcp_ddns_SOURCES = d2_messages.h d2_messages.cc
EXTRA_DIST += d2_messages.mes EXTRA_DIST += d2_messages.mes
b10_d2_LDADD = $(top_builddir)/src/lib/log/libb10-log.la b10_dhcp_ddns_LDADD = $(top_builddir)/src/lib/log/libb10-log.la
b10_d2_LDADD += $(top_builddir)/src/lib/exceptions/libb10-exceptions.la b10_dhcp_ddns_LDADD += $(top_builddir)/src/lib/exceptions/libb10-exceptions.la
b10_d2_LDADD += $(top_builddir)/src/lib/cc/libb10-cc.la b10_dhcp_ddns_LDADD += $(top_builddir)/src/lib/cc/libb10-cc.la
b10_d2_LDADD += $(top_builddir)/src/lib/asiolink/libb10-asiolink.la b10_dhcp_ddns_LDADD += $(top_builddir)/src/lib/asiolink/libb10-asiolink.la
b10_d2_LDADD += $(top_builddir)/src/lib/config/libb10-cfgclient.la b10_dhcp_ddns_LDADD += $(top_builddir)/src/lib/config/libb10-cfgclient.la
b10_d2dir = $(pkgdatadir) b10_dhcp_ddnsdir = $(pkgdatadir)
b10_d2_DATA = d2.spec b10_dhcp_ddns_DATA = dhcp-ddns.spec
...@@ -24,13 +24,13 @@ ...@@ -24,13 +24,13 @@
</refentryinfo> </refentryinfo>
<refmeta> <refmeta>
<refentrytitle>b10-d2</refentrytitle> <refentrytitle>b10-dhcp-ddns</refentrytitle>
<manvolnum>8</manvolnum> <manvolnum>8</manvolnum>
<refmiscinfo>BIND10</refmiscinfo> <refmiscinfo>BIND10</refmiscinfo>
</refmeta> </refmeta>
<refnamediv> <refnamediv>
<refname>b10-d2</refname> <refname>b10-dhcp-ddns</refname>
<refpurpose>D2 process in BIND 10 architecture</refpurpose> <refpurpose>D2 process in BIND 10 architecture</refpurpose>
</refnamediv> </refnamediv>
...@@ -43,14 +43,14 @@ ...@@ -43,14 +43,14 @@
<refsynopsisdiv> <refsynopsisdiv>
<cmdsynopsis> <cmdsynopsis>
<command>b10-d2</command> <command>b10-dhcp-ddns</command>
<arg><option>-v</option></arg> <arg><option>-v</option></arg>
</cmdsynopsis> </cmdsynopsis>
</refsynopsisdiv> </refsynopsisdiv>
<refsynopsisdiv> <refsynopsisdiv>
<cmdsynopsis> <cmdsynopsis>
<command>b10-d2</command> <command>b10-dhcp-ddns</command>
<arg><option>-s</option></arg> <arg><option>-s</option></arg>
</cmdsynopsis> </cmdsynopsis>
</refsynopsisdiv> </refsynopsisdiv>
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<refsect1> <refsect1>
<title>DESCRIPTION</title> <title>DESCRIPTION</title>
<para> <para>
The <command>b10-d2</command> daemon processes requests to The <command>b10-dhcp-ddns</command> daemon processes requests to
to update DNS mapping based on DHCP lease change events. to update DNS mapping based on DHCP lease change events.
</para> </para>
...@@ -95,7 +95,7 @@ ...@@ -95,7 +95,7 @@
<title>SEE ALSO</title> <title>SEE ALSO</title>
<para> <para>
<citerefentry> <citerefentry>
<refentrytitle>b10-d2</refentrytitle><manvolnum>8</manvolnum> <refentrytitle>b10-dhcp-ddns</refentrytitle><manvolnum>8</manvolnum>
</citerefentry>, </citerefentry>,
<citerefentry> <citerefentry>
<refentrytitle>bind10</refentrytitle><manvolnum>8</manvolnum> <refentrytitle>bind10</refentrytitle><manvolnum>8</manvolnum>
...@@ -106,7 +106,7 @@ ...@@ -106,7 +106,7 @@
<refsect1> <refsect1>
<title>HISTORY</title> <title>HISTORY</title>
<para> <para>
The <command>b10-d2</command> process was first coded in The <command>b10-dhcp-ddns</command> process was first coded in
May 2013 by the ISC Kea/Dhcp team. May 2013 by the ISC Kea/Dhcp team.
</para> </para>
</refsect1> </refsect1>
......
...@@ -23,10 +23,11 @@ DControllerBasePtr& ...@@ -23,10 +23,11 @@ DControllerBasePtr&
D2Controller::instance() { D2Controller::instance() {
// If the instance hasn't been created yet, create it. Note this method // 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 use the base class singleton instance methods. The base class
// must own the singleton in order to use it within BIND10 static function // must have access to the singleton in order to use it within BIND10
// callbacks. // static function callbacks.
if (!getController()) { if (!getController()) {
setController(new D2Controller()); DControllerBasePtr controller_ptr(new D2Controller());
setController(controller_ptr);
} }
return (getController()); return (getController());
......
...@@ -21,7 +21,7 @@ namespace d2 { ...@@ -21,7 +21,7 @@ namespace d2 {
/// @brief Defines the service name which is used in the controller constructor /// @brief Defines the service name which is used in the controller constructor
/// and ultimately defines the BIND10 module name. /// and ultimately defines the BIND10 module name.
const char* const D2_MODULE_NAME = "b10-d2"; const char* const D2_MODULE_NAME = "b10-dhpc-ddns";
/// @brief Defines the logger used within D2. /// @brief Defines the logger used within D2.
isc::log::Logger d2_logger(D2_MODULE_NAME); isc::log::Logger d2_logger(D2_MODULE_NAME);
......
...@@ -27,11 +27,11 @@ This is a debug message issued when the service process has been instructed ...@@ -27,11 +27,11 @@ This is a debug message issued when the service process has been instructed
to shut down by the controller. to shut down by the controller.
% D2PRC_PROCESS_INIT DHCP-DDNS application init invoked % D2PRC_PROCESS_INIT DHCP-DDNS application init invoked
This is a debug message issued when the D2 process enters it's This is a debug message issued when the D2 process enters its
init method. init method.
% D2PRC_RUN_ENTER process has entered the event loop % D2PRC_RUN_ENTER process has entered the event loop
This is a debug message issued when the D2 process enters it's This is a debug message issued when the D2 process enters its
run method. run method.
% D2PRC_RUN_EXIT process is exiting the event loop % D2PRC_RUN_EXIT process is exiting the event loop
...@@ -52,15 +52,17 @@ has been invoked. ...@@ -52,15 +52,17 @@ has been invoked.
% D2CTL_INIT_PROCESS initializing application proces % D2CTL_INIT_PROCESS initializing application proces
This debug message is issued just before the controller attempts This debug message is issued just before the controller attempts
to create and initialize it's process instance. to create and initialize its process instance.
% D2CTL_SESSION_FAIL failed to establish BIND 10 session: %1 % D2CTL_SESSION_FAIL failed to establish BIND 10 session: %1
The controller has failed to establish communication with the rest of BIND The controller has failed to establish communication with the rest of BIND
10 and will exit. 10 and will exit.
% D2CTL_DISCONNECT_FAIL failed to disconnect from BIND 10 session: %1 % D2CTL_DISCONNECT_FAIL failed to disconnect from BIND 10 session: %1
The controller has failed to terminate communication with the rest of BIND This message indicates that while shutting down, the DHCP-DDNS controller
10. encountered an error terminating communication with the BIND10. The service
will still exit. While theoretically possible, this situation is rather
unlikely.
% D2CTL_STANDALONE skipping message queue, running standalone % D2CTL_STANDALONE skipping message queue, running standalone
This is a debug message indicating that the controller is running in the This is a debug message indicating that the controller is running in the
......
...@@ -45,7 +45,7 @@ D2Process::run() { ...@@ -45,7 +45,7 @@ D2Process::run() {
} catch (const std::exception& ex) { } catch (const std::exception& ex) {
LOG_FATAL(d2_logger, D2PRC_FAILED).arg(ex.what()); LOG_FATAL(d2_logger, D2PRC_FAILED).arg(ex.what());
isc_throw (DProcessBaseError, isc_throw (DProcessBaseError,
std::string("Process run method failed:") + ex.what()); "Process run method failed:" << ex.what());
} }
} }
......
...@@ -32,7 +32,7 @@ DControllerBase::DControllerBase(const char* name) ...@@ -32,7 +32,7 @@ DControllerBase::DControllerBase(const char* name)
} }
void void
DControllerBase::setController(DControllerBase* controller) { DControllerBase::setController(const DControllerBasePtr& controller) {
if (controller_) { if (controller_) {
// This shouldn't happen, but let's make sure it can't be done. // This shouldn't happen, but let's make sure it can't be done.
// It represents a programmatic error. // It represents a programmatic error.
...@@ -40,41 +40,34 @@ DControllerBase::setController(DControllerBase* controller) { ...@@ -40,41 +40,34 @@ DControllerBase::setController(DControllerBase* controller) {
"Multiple controller instances attempted."); "Multiple controller instances attempted.");
} }
controller_ = DControllerBasePtr(controller); controller_ = controller;
} }
int void
DControllerBase::launch(int argc, char* argv[]) { DControllerBase::launch(int argc, char* argv[]) {
int ret = d2::NORMAL_EXIT;
// Step 1 is to parse the command line arguments. // Step 1 is to parse the command line arguments.
try { try {
parseArgs(argc, argv); parseArgs(argc, argv);
} catch (const InvalidUsage& ex) { } catch (const InvalidUsage& ex) {
usage(ex.what()); usage(ex.what());
return (d2::INVALID_USAGE); throw; // rethrow it
} }
#if 1
//@TODO During initial development default to max log, no buffer
isc::log::initLogger(name_, isc::log::DEBUG,
isc::log::MAX_DEBUG_LEVEL, NULL, false);
#else
// Now that we know what the mode flags are, we can init logging. // Now that we know what the mode flags are, we can init logging.
// If standalone is enabled, do not buffer initial log messages // If standalone is enabled, do not buffer initial log messages
isc::log::initLogger(name_, isc::log::initLogger(name_,
((verbose_ && stand_alone_) ((verbose_ && stand_alone_)
? isc::log::DEBUG : isc::log::INFO), ? isc::log::DEBUG : isc::log::INFO),
isc::log::MAX_DEBUG_LEVEL, NULL, !stand_alone_); isc::log::MAX_DEBUG_LEVEL, NULL, !stand_alone_);
#endif
LOG_DEBUG(d2_logger, DBGLVL_START_SHUT, D2CTL_STARTING).arg(getpid()); LOG_DEBUG(d2_logger, DBGLVL_START_SHUT, D2CTL_STARTING).arg(getpid());
try { try {
// Step 2 is to create and initialize the application process. // Step 2 is to create and initialize the application process object.
initProcess(); initProcess();
} catch (const std::exception& ex) { } catch (const std::exception& ex) {
LOG_ERROR(d2_logger, D2CTL_SESSION_FAIL).arg(ex.what()); LOG_FATAL(d2_logger, D2CTL_INIT_PROCESS).arg(ex.what());
return (PROCESS_INIT_ERROR); isc_throw (ProcessInitError,
"Application Process initialization failed:" << ex.what());
} }
// Next we connect if we are running integrated. // Next we connect if we are running integrated.
...@@ -84,8 +77,9 @@ DControllerBase::launch(int argc, char* argv[]) { ...@@ -84,8 +77,9 @@ DControllerBase::launch(int argc, char* argv[]) {
try { try {
establishSession(); establishSession();
} catch (const std::exception& ex) { } catch (const std::exception& ex) {
LOG_ERROR(d2_logger, D2CTL_SESSION_FAIL).arg(ex.what()); LOG_FATAL(d2_logger, D2CTL_SESSION_FAIL).arg(ex.what());
return (d2::SESSION_START_ERROR); isc_throw (SessionStartError,
"Session start up failed:" << ex.what());
} }
} }
...@@ -95,24 +89,25 @@ DControllerBase::launch(int argc, char* argv[]) { ...@@ -95,24 +89,25 @@ DControllerBase::launch(int argc, char* argv[]) {
runProcess(); runProcess();
} catch (const std::exception& ex) { } catch (const std::exception& ex) {
LOG_FATAL(d2_logger, D2CTL_FAILED).arg(ex.what()); LOG_FATAL(d2_logger, D2CTL_FAILED).arg(ex.what());
ret = d2::RUN_ERROR; isc_throw (ProcessRunError,
"Application process event loop failed:" << ex.what());
} }
// If running integrated, always try to disconnect. // If running integrated, disconnect.
if (!stand_alone_) { if (!stand_alone_) {
try { try {
disconnectSession(); disconnectSession();
} catch (const std::exception& ex) { } catch (const std::exception& ex) {
LOG_ERROR(d2_logger, D2CTL_DISCONNECT_FAIL).arg(ex.what()); LOG_ERROR(d2_logger, D2CTL_DISCONNECT_FAIL).arg(ex.what());
ret = d2::SESSION_END_ERROR; isc_throw (SessionEndError, "Session end failed:" << ex.what());
} }
} }
// All done, so bail out. // All done, so bail out.
LOG_INFO(d2_logger, D2CTL_STOPPING); LOG_INFO(d2_logger, D2CTL_STOPPING);
return (ret);
} }
void void
DControllerBase::parseArgs(int argc, char* argv[]) DControllerBase::parseArgs(int argc, char* argv[])
{ {
...@@ -137,11 +132,10 @@ DControllerBase::parseArgs(int argc, char* argv[]) ...@@ -137,11 +132,10 @@ DControllerBase::parseArgs(int argc, char* argv[])
case '?': { case '?': {
// We hit an invalid option. // We hit an invalid option.
std::stringstream tmp; isc_throw(InvalidUsage, "unsupported option: ["
tmp << " unsupported option: [" << (char)optopt << "] " << static_cast<char>(optopt) << "] "
<< (!optarg ? "" : optarg); << (!optarg ? "" : optarg));
isc_throw(InvalidUsage,tmp.str());
break; break;
} }
...@@ -149,10 +143,9 @@ DControllerBase::parseArgs(int argc, char* argv[]) ...@@ -149,10 +143,9 @@ DControllerBase::parseArgs(int argc, char* argv[])
// We hit a valid custom option // We hit a valid custom option
if (!customOption(ch, optarg)) { if (!customOption(ch, optarg)) {
// This would be a programmatic error. // This would be a programmatic error.
std::stringstream tmp; isc_throw(InvalidUsage, " Option listed but implemented?: ["
tmp << " Option listed but implemented?: [" << << static_cast<char>(ch) << "] "
(char)ch << "] " << (!optarg ? "" : optarg); << (!optarg ? "" : optarg));
isc_throw(InvalidUsage,tmp.str());
} }
break; break;
} }
...@@ -160,9 +153,7 @@ DControllerBase::parseArgs(int argc, char* argv[]) ...@@ -160,9 +153,7 @@ DControllerBase::parseArgs(int argc, char* argv[])
// There was too much information on the command line. // There was too much information on the command line.
if (argc > optind) { if (argc > optind) {
std::stringstream tmp; isc_throw(InvalidUsage, "extraneous command line information");
tmp << "extraneous command line information";
isc_throw(InvalidUsage,tmp.str());
} }
} }
...@@ -181,13 +172,13 @@ DControllerBase::initProcess() { ...@@ -181,13 +172,13 @@ DControllerBase::initProcess() {
try { try {
process_.reset(createProcess()); process_.reset(createProcess());
} catch (const std::exception& ex) { } catch (const std::exception& ex) {
isc_throw (DControllerBaseError, std::string("createProcess failed:") isc_throw(DControllerBaseError, std::string("createProcess failed:")
+ ex.what()); + ex.what());
} }
// This is pretty unlikely, but will test for it just to be safe.. // This is pretty unlikely, but will test for it just to be safe..
if (!process_) { if (!process_) {
isc_throw (DControllerBaseError, "createProcess returned NULL"); isc_throw(DControllerBaseError, "createProcess returned NULL");
} }
// Invoke application's init method (Note this call should throw // Invoke application's init method (Note this call should throw
...@@ -300,7 +291,7 @@ DControllerBase::configHandler(isc::data::ConstElementPtr new_config) { ...@@ -300,7 +291,7 @@ DControllerBase::configHandler(isc::data::ConstElementPtr new_config) {
// Static callback which invokes non-static handler on singleton // Static callback which invokes non-static handler on singleton
isc::data::ConstElementPtr isc::data::ConstElementPtr
DControllerBase::commandHandler(const std::string& command, DControllerBase::commandHandler(const std::string& command,
isc::data::ConstElementPtr args) { isc::data::ConstElementPtr args) {
LOG_DEBUG(d2_logger, DBGLVL_COMMAND, D2CTL_COMMAND_RECEIVED) LOG_DEBUG(d2_logger, DBGLVL_COMMAND, D2CTL_COMMAND_RECEIVED)
.arg(command).arg(args->str()); .arg(command).arg(args->str());
...@@ -403,14 +394,6 @@ DControllerBase::customControllerCommand(const std::string& command, ...@@ -403,14 +394,6 @@ DControllerBase::customControllerCommand(const std::string& command,
isc::data::ConstElementPtr isc::data::ConstElementPtr
DControllerBase::shutdown() { DControllerBase::shutdown() {
// @TODO (tmark) - not sure about io_service_->stop here
// IF application is using this service for all of its IO, stopping
// here would mean, no more work by the application.. UNLESS it resets
// it. People have discussed letting the application finish any in-progress
// updates before shutting down. If we don't stop it here, then
// application can't use io_service_->run(), it will never "see" the
// shutdown.
io_service_->stop();
if (process_) { if (process_) {
process_->shutdown(); process_->shutdown();
} else { } else {
......
...@@ -35,19 +35,6 @@ namespace d2 { ...@@ -35,19 +35,6 @@ namespace d2 {
/// normal or otherwise, the Controller's launch method will return one of /// normal or otherwise, the Controller's launch method will return one of
/// these values. /// these values.
/// @brief Indicates normal shutdown.
static const int NORMAL_EXIT = 0;
/// @brief Indicates invalid command line.
static const int INVALID_USAGE = 1;
/// @brief Failed to create and initialize application process.
static const int PROCESS_INIT_ERROR = 2;
/// @brief Could not connect to BIND10 (integrated mode only).
static const int SESSION_START_ERROR = 3;
/// @brief A fatal error occurred in the application process.
static const int RUN_ERROR = 4;
/// @brief Error occurred disconnecting from BIND10 (integrated mode only).
static const int SESSION_END_ERROR = 5;
/// @brief Exception thrown when the command line is invalid. /// @brief Exception thrown when the command line is invalid.
class InvalidUsage : public isc::Exception { class InvalidUsage : public isc::Exception {
public: public:
...@@ -55,6 +42,36 @@ public: ...@@ -55,6 +42,36 @@ public:
isc::Exception(file, line, what) { }; isc::Exception(file, line, what) { };
}; };
/// @brief Exception thrown when the application process fails.
class ProcessInitError: public isc::Exception {
public:
ProcessInitError (const char* file, size_t line, const char* what) :
isc::Exception(file, line, what) { };
};
/// @brief Exception thrown when the session start up fails.
class SessionStartError: public isc::Exception {
public:
SessionStartError (const char* file, size_t line, const char* what) :
isc::Exception(file, line, what) { };
};
/// @brief Exception thrown when the application process encounters an
/// operation in its event loop (i.e. run method).
class ProcessRunError: public isc::Exception {
public:
ProcessRunError (const char* file, size_t line, const char* what) :
isc::Exception(file, line, what) { };
};
/// @brief Exception thrown when the session end fails.
class SessionEndError: public isc::Exception {
public:
SessionEndError (const char* file, size_t line, const char* what) :
isc::Exception(file, line, what) { };
};
/// @brief Exception thrown when the controller encounters an operational error. /// @brief Exception thrown when the controller encounters an operational error.
class DControllerBaseError : public isc::Exception { class DControllerBaseError : public isc::Exception {
public: public:
...@@ -82,15 +99,24 @@ typedef boost::shared_ptr<isc::config::ModuleCCSession> ModuleCCSessionPtr; ...@@ -82,15 +99,24 @@ typedef boost::shared_ptr<isc::config::ModuleCCSession> ModuleCCSessionPtr;
/// integrated mode as a BIND10 module or stand-alone. It coordinates command /// integrated mode as a BIND10 module or stand-alone. It coordinates command
/// line argument parsing, process instantiation and initialization, and runtime /// line argument parsing, process instantiation and initialization, and runtime
/// control through external command and configuration event handling. /// control through external command and configuration event handling.
/// It creates the io_service_ instance which is used for runtime control /// It creates the IOService instance which is used for runtime control
/// events and passes the io_service into the application process at process /// events and passes the IOService into the application process at process
/// creation. In integrated mode it is responsible for establishing BIND10 /// creation. In integrated mode it is responsible for establishing BIND10
/// session(s) and passes this io_service_ into the session creation method(s). /// session(s) and passes this IOService into the session creation method(s).
/// It also provides the callback handlers for command and configuration events. /// It also provides the callback handlers for command and configuration events
/// 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,
/// DControllerBase::commandHandler().
///
/// NOTE: Derivations must supply their own static singleton instance method(s) /// NOTE: Derivations must supply their own static singleton instance method(s)
/// for creating and fetching the instance. The base class declares the instance /// 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 /// 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 { class DControllerBase : public boost::noncopyable {
public: public:
/// @brief Constructor /// @brief Constructor
...@@ -119,16 +145,16 @@ public: ...@@ -119,16 +145,16 @@ public:
/// @param argc is the number of command line arguments supplied /// @param argc is the number of command line arguments supplied
/// @param argv is the array of string (char *) command line arguments /// @param argv is the array of string (char *) command line arguments
/// ///
/// @return returns one of the following integer values: /// @throw throws one of the following exceptions:
/// d2::NORMAL_EXIT - Indicates normal shutdown. /// InvalidUsage - Indicates invalid command line.
/// d2::INVALID_USAGE - Indicates invalid command line. /// ProcessInitError - Failed to create and initialize application
/// d2::PROCESS_INIT_ERROR - Failed to create and initialize application /// process object.
/// process /// SessionStartError - Could not connect to BIND10 (integrated mode only).
/// d2::SESSION_START_ERROR - Could not connect to BIND10 (integrated mode /// ProcessRunError - A fatal error occurred while in the application
/// process event loop.
/// SessionEndError - Could not disconnect from BIND10 (integrated mode
/// only). /// only).
/// d2::RUN_ERROR - An fatal error occurred in the application process void launch(int argc, char* argv[]);
/// d2::SESSION_END_ERROR = 4;
int launch(int argc, char* argv[]);
/// @brief A dummy configuration handler that always returns success. /// @brief A dummy configuration handler that always returns success.
/// ///
...@@ -240,11 +266,11 @@ protected: ...@@ -240,11 +266,11 @@ protected:
virtual bool customOption(int option, char *optarg); virtual bool customOption(int option, char *optarg);
/// @brief Abstract method that is responsible for instantiating the /// @brief Abstract method that is responsible for instantiating the
/// application process instance. It is invoked by the controller after /// application process object. It is invoked by the controller after
/// command line argument parsing as part of the process initialization /// command line argument parsing as part of the process initialization
/// (see initProcess method). /// (see initProcess method).
/// ///
/// @return returns a pointer to the new process instance (DProcessBase*) /// @return returns a pointer to the new process object (DProcessBase*)
/// or NULL if the create fails. /// or NULL if the create fails.
/// Note this value is subsequently wrapped in a smart pointer. /// Note this value is subsequently wrapped in a smart pointer.
virtual DProcessBase* createProcess() = 0; virtual DProcessBase* createProcess() = 0;
...@@ -294,7 +320,7 @@ protected: ...@@ -294,7 +320,7 @@ protected:
/// invalid usage conditions. /// invalid usage conditions.
/// ///
/// @return returns the desired text. /// @return returns the desired text.
virtual const std::string getUsageText() { virtual const std::string getUsageText() const {
return (""); return ("");
} }
...@@ -304,21 +330,21 @@ protected: ...@@ -304,21 +330,21 @@ protected:
/// line interpretation. /// line interpretation.
/// ///
/// @return returns a string containing the custom option letters. /// @return returns a string containing the custom option letters.
virtual const std::string getCustomOpts() { virtual const std::string getCustomOpts() const {
return (""); return ("");
} }
/// @brief Supplies the controller name. /// @brief Supplies the controller name.
/// ///
/// @return returns the controller name string