14 #include <boost/shared_ptr.hpp> 29 static const std::string VERSION_GET_COMMAND(
"version-get");
32 static const std::string BUILD_REPORT_COMMAND(
"build-report");
35 static const std::string CONFIG_GET_COMMAND(
"config-get");
38 static const std::string CONFIG_WRITE_COMMAND(
"config-write");
41 static const std::string CONFIG_TEST_COMMAND(
"config-test");
44 static const std::string SHUT_DOWN_COMMAND(
"shutdown");
47 static const int COMMAND_SUCCESS = 0;
50 static const int COMMAND_ERROR = 1;
53 static const int COMMAND_INVALID = 2;
81 : app_name_(app_name), io_service_(io_service), shut_down_flag_(false),
97 virtual void init() = 0;
104 virtual void run() = 0;
137 bool check_only =
false) = 0;
146 return (shut_down_flag_);
153 shut_down_flag_ = value;
167 return (io_service_);
188 std::string app_name_;
194 bool shut_down_flag_;
virtual ~DProcessBase()
Destructor.
void setShutdownFlag(bool value)
Sets the process shut down flag to the given value.
boost::shared_ptr< DCfgMgrBase > DCfgMgrBasePtr
Defines a shared pointer to DCfgMgrBase.
boost::shared_ptr< IOService > IOServicePtr
Defines a smart pointer to an IOService instance.
const std::string getAppName() const
Fetches the application name.
virtual isc::data::ConstElementPtr shutdown(isc::data::ConstElementPtr args)=0
Initiates the process's shutdown process.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
boost::shared_ptr< DProcessBase > DProcessBasePtr
Defines a shared pointer to DProcessBase.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
DCfgMgrBasePtr & getCfgMgr()
Fetches the process's configuration manager.
boost::shared_ptr< const Element > ConstElementPtr
DProcessBaseError(const char *file, size_t line, const char *what)
void stopIOService()
Convenience method for stopping IOservice processing.
virtual void run()=0
Implements the process's event loop.
This is a base class for exceptions thrown from the DNS library module.
Defines the logger used by the top-level component of kea-dhcp-ddns.
virtual isc::data::ConstElementPtr configure(isc::data::ConstElementPtr config_set, bool check_only=false)=0
Processes the given configuration.
asiolink::IOServicePtr & getIoService()
Fetches the controller's IOService.
Exception thrown if the process encountered an operational error.
virtual void init()=0
May be used after instantiation to perform initialization unique to application.
Application Process Interface.
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.