14 #include <boost/shared_ptr.hpp>
31 static const std::string VERSION_GET_COMMAND(
"version-get");
34 static const std::string BUILD_REPORT_COMMAND(
"build-report");
37 static const std::string CONFIG_GET_COMMAND(
"config-get");
40 static const std::string CONFIG_WRITE_COMMAND(
"config-write");
43 static const std::string CONFIG_TEST_COMMAND(
"config-test");
46 static const std::string CONFIG_RELOAD_COMMAND(
"config-reload");
49 static const std::string CONFIG_SET_COMMAND(
"config-set");
52 static const std::string SERVER_TAG_GET_COMMAND(
"server-tag-get");
55 static const std::string SHUT_DOWN_COMMAND(
"shutdown");
58 static const std::string STATUS_GET_COMMAND(
"status-get");
61 static const int COMMAND_SUCCESS = 0;
64 static const int COMMAND_ERROR = 1;
67 static const int COMMAND_INVALID = 2;
95 : app_name_(app_name), io_service_(io_service), shut_down_flag_(false),
111 virtual void init() = 0;
118 virtual void run() = 0;
151 bool check_only =
false) = 0;
160 return (shut_down_flag_);
167 shut_down_flag_ = value;
181 return (io_service_);
202 std::string app_name_;
208 std::atomic<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.
virtual isc::data::ConstElementPtr shutdown(isc::data::ConstElementPtr args)=0
Initiates the process's shutdown process.
boost::shared_ptr< DProcessBase > DProcessBasePtr
Defines a shared pointer to DProcessBase.
bool shouldShutdown() const
Checks if the process has been instructed to shut down.
#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.
const std::string getAppName() const
Fetches the application name.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
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.