00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _pserverapp_h_
00021 #define _pserverapp_h_
00022
00023 #include <pclasses/config.h>
00024 #include <pclasses/pexport.h>
00025 #include <pclasses/psimpleapp.h>
00026 #include <pclasses/pexception.h>
00027 #include <pclasses/plog.h>
00028 #include <pclasses/pconfig.h>
00029
00030 namespace P {
00031
00033
00037 class PCORE_EXPORT ServerApp: public SimpleApp {
00038 public:
00039 ServerApp(const AboutData& about);
00040 ~ServerApp();
00041
00043 inline SystemLog& syslog() throw()
00044 { return *m_syslog; }
00045
00047 inline bool hasSyslog() const throw()
00048 { return m_syslog ? true : false; }
00049
00051 inline Config& config() throw()
00052 { return *m_config; }
00053
00055 inline bool hasConfig() const throw()
00056 { return m_config ? true : false; }
00057
00059
00065 virtual void reload();
00066
00067 protected:
00068 virtual int init(int argc, char* argv[]);
00069
00071 void daemonize() throw(SystemError);
00072
00074 void setSyslog(SystemLog* log) throw();
00075
00077 void setConfig(Config* cfg) throw();
00078
00079 static RETSIGTYPE SIGHUP_handler(int);
00080
00081 private:
00082 ServerApp(const ServerApp&);
00083 ServerApp& operator=(const ServerApp&);
00084
00085 SystemLog* m_syslog;
00086 Config* m_config;
00087 };
00088
00089 }
00090
00091 #endif