15 #include <boost/noncopyable.hpp>
16 #include <boost/date_time/posix_time/posix_time.hpp>
48 class Daemon :
public boost::noncopyable {
85 static void loggerInit(
const char* log_name,
bool verbose);
168 static void setProcName(
const std::string& proc_name);
208 return (default_logger_name_);
216 default_logger_name_ =
logger;
221 return (exit_value_);
267 std::string config_file_;
270 static std::string proc_name_;
274 std::string pid_file_dir_;
280 static bool verbose_;
283 static std::string default_logger_name_;
286 bool am_file_author_;
std::string getPIDFileDir() const
Returns the directory used when forming default PID file name.
virtual size_t writeConfigFile(const std::string &config_file, isc::data::ConstElementPtr cfg=isc::data::ConstElementPtr()) const
Writes current configuration to specified file.
void setPIDFileName(const std::string &pid_file_name)
Sets PID file name.
static std::string getDefaultLoggerName()
Returns default logger name.
virtual void shutdown()
Initiates shutdown procedure for the whole server.
boost::posix_time::ptime start_
Timestamp of the start of the daemon.
virtual void cleanup()
Performs final deconfiguration.
virtual ~Daemon()
Destructor.
int getExitValue()
Fetches the exit value.
static void setDefaultLoggerName(const std::string &logger)
Sets the default logger name.
static void setProcName(const std::string &proc_name)
Sets the process name.
void setConfigFile(const std::string &config_file)
Sets the configuration file name.
boost::shared_ptr< const Element > ConstElementPtr
isc::asiolink::IOSignalSetPtr signal_set_
A pointer to the object installing custom signal handlers.
isc::data::ConstElementPtr redactConfig(isc::data::ConstElementPtr const &config)
Redact a configuration.
static std::string getVersion(bool extended)
returns Kea version on stdout and exits.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
boost::shared_ptr< IOSignalSet > IOSignalSetPtr
Defines a pointer to an IOSignalSet.
static void setVerbose(const bool verbose)
Sets or clears verbose mode.
virtual std::list< std::list< std::string > > jsonPathsToRedact() const
Return a list of all paths that contain passwords or secrets.
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.
isc::log::Logger logger("asiodns")
Use the ASIO logger.
static void loggerInit(const char *log_name, bool verbose)
Initializes logger.
void setExitValue(int value)
Sets the exit value.
boost::shared_ptr< PIDFile > PIDFilePtr
Defines a shared pointer to a PIDFile.
std::string getConfigFile() const
Returns config file name.
Base class for all services.
DaemonPIDExists(const char *file, size_t line, const char *what)
static bool getVerbose()
Returns if running in verbose mode.
static std::string getProcName()
returns the process name This value is used as when forming the default PID file name ...
void setPIDFileDir(const std::string &pid_file_dir)
Sets the PID file directory.
Exception thrown when the PID file points to a live PID.
std::string makePIDFileName() const
Manufacture the pid file name.
void createPIDFile(int pid=0)
Creates the PID file.
void checkConfigFile() const
Checks the configuration file name.
Daemon()
Default constructor.
std::string getPIDFileName() const
Returns the current PID file name.
boost::shared_ptr< ConfigBase > ConfigPtr
Non-const pointer to the ConfigBase.
static void configureLogger(const isc::data::ConstElementPtr &log_config, const isc::process::ConfigPtr &storage)
Configures logger.