epona.h

Go to the documentation of this file.
00001 /* Horsepower.
00002  *
00003  * Epona (c) 2000-2002, 2004 PegSoft
00004  * Contact us at epona@pegsoft.net
00005  *
00006  * Based on the original code of Services by Andy Church.
00007  *
00008  * This program is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 2 of the License, or
00011  * (at your option) any later version.
00012  *
00013  * This program is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program (see the file COPYING); if not, write to the
00020  * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00021  */
00022 
00026 #ifndef CORE_EPONA_H
00027 #define CORE_EPONA_H
00028 
00029 /*************************************************************************/
00030 
00031 #include <string>
00032 
00033 #include <modules/core.h>
00034 
00035 /*************************************************************************/
00036 
00037 namespace conf { class ConfGlobalQ; }
00038 
00039 /*************************************************************************/
00040 
00042 
00043 namespace core
00044 {
00045 
00046 /*************************************************************************/
00047 
00048 namespace hidden
00049 {
00050     class Directives;
00051 }
00052 
00053 /*************************************************************************/
00054 
00056 
00061 class Epona : public modules::Core
00062 {
00063     private:
00064         friend class ECmdLineParser;
00065     public:
00066         /* Constants */
00068         static uint32_t const efTakeOver = 0x80000000;
00070         static uint32_t const efNoExpire = 0x40000000;
00071         
00072         /* Typedefs */
00073         typedef hidden::Directives Directives;
00074     
00075         /* Functions */
00076     
00078         Epona(int ac, char const *const *av, char const *const *envp);
00080         ~Epona();
00081         
00083         virtual conf::ConfQ *config(modules::Core &core,
00084                 conf::ConfGlobalQ &global);
00085         
00087 
00092         void dump_core(bool dump);
00093         
00095         virtual void fatal(char const *msg = 0);
00096         
00098         virtual void notify(Module &sender, int msg, void *arg);
00099         
00101 
00104         void pid_erase(const char *filename);
00105         
00107 
00110         void pid_write(const char *filename);
00111         
00113 
00115         void run();
00116         
00118         virtual cmdline::CmdLineParser &clp() { return *m_clp; }
00119         
00121         hidden::Directives const &cd() const { return *m_cd; }
00123         std::string const &conffile() const { return m_conffile; }
00124         
00126         virtual conf::ConfLogger &conf_logger() { return *m_conflogger; }
00127         
00129         virtual xlog::Logger &logger() { return *m_logger; }
00130         
00132         virtual modules::ModManager &modules() { return *m_modules; }
00133         
00135         virtual scheduler::Scheduler &tasks() { return *m_tasks; }
00136         
00138         virtual int version() const;
00140         virtual std::string const version_string() const;
00141     private:
00142         cmdline::CmdLineParser *m_clp;
00143         
00144         conf::ConfLogger *m_conflogger;
00145         hidden::Directives *m_cd;
00146         std::string m_conffile;
00147         conf::ConfGlobalQ *m_global;
00148         
00149         xlog::Logger *m_logger;
00150         
00151         modules::ModManager *m_modules;
00152         
00153         scheduler::Scheduler *m_tasks;
00154         
00155         bool config(bool reload);
00156         
00157         void init_signals();
00158         void load_modules();
00159         
00160         void load();
00161         void restart();
00162         void start();
00163         void stop();
00164 };
00165 
00166 /*************************************************************************/
00167 
00168 } /* namespace core */
00169 
00170 /*************************************************************************/
00171 
00172 #endif /* CORE_EPONA_H */

Generated on Wed Aug 15 00:37:22 2007 for Epona API by  doxygen 1.5.2