limal-runlevel

LSBService.hpp

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                                                                      |
00003 |                     _     _   _   _     __     _                     |
00004 |                    | |   | | | \_/ |   /  \   | |                    |
00005 |                    | |   | | | |_| |  / /\ \  | |                    |
00006 |                    | |__ | | | | | | / ____ \ | |__                  |
00007 |                    |____||_| |_| |_|/ /    \ \|____|                 |
00008 |                                                                      |
00009 |                             runlevel library                         |
00010 |                                                                      |
00011 |                                         (C) SUSE Linux Products GmbH |
00012 \----------------------------------------------------------------------/
00013 
00014   File:       LSBService.hpp
00015 
00016   Author:     Marius Tomaschewski
00017   Maintainer: Marius Tomaschewski
00018 
00019   Purpose:
00020 
00021 /-*/
00033 #ifndef   LIMAL_RUNLEVEL_LSB_SERVICE_HPP
00034 #define   LIMAL_RUNLEVEL_LSB_SERVICE_HPP
00035 
00036 #include <limal/runlevel/config.h>
00037 #include <limal/runlevel/Service.hpp>
00038 #include <limal/runlevel/Runlevel.hpp>
00039 #include <blocxx/String.hpp>
00040 #include <blocxx/Array.hpp>
00041 #include <blocxx/Map.hpp>
00042 
00043 
00044 // -------------------------------------------------------------------
00045 namespace LIMAL_NAMESPACE
00046 {
00047 namespace RUNLEVEL_NAMESPACE
00048 {
00049 
00050 // -------------------------------------------------------------------
00084 typedef blocxx::Int32       LSBExitCode;
00085 
00088 
00089 const LSBExitCode LSB_RC_SUCCESS          = 0; 
00090 const LSBExitCode LSB_RC_FAILURE          = 1; 
00091 const LSBExitCode LSB_RC_INVALID_ARGUMENT = 2; 
00092 const LSBExitCode LSB_RC_NOT_IMPLEMENTED  = 3; 
00093 const LSBExitCode LSB_RC_NOT_ALLOWED      = 4; 
00094 const LSBExitCode LSB_RC_NOT_INSTALLED    = 5; 
00095 const LSBExitCode LSB_RC_NOT_CONFIGURED   = 6; 
00096 const LSBExitCode LSB_RC_NOT_RUNNING      = 7; 
00097 
00098 
00101 
00102 const LSBExitCode LSB_ST_RUNNING          = 0; 
00103 const LSBExitCode LSB_ST_DEAD_PID_EXISTS  = 1; 
00104 const LSBExitCode LSB_ST_DEAD_LOCK_EXISTS = 2; 
00105 const LSBExitCode LSB_ST_NOT_RUNNING      = 3; 
00106 const LSBExitCode LSB_ST_UNKNOWN          = 4; 
00107 
00108 
00109 
00110 typedef blocxx::Map<blocxx::String, blocxx::String> LSBInitInfo;
00111 
00112 
00113 // -------------------------------------------------------------------
00119 class LSBService: public Service
00120 {
00121 public:
00128         LSBService(const blocxx::String &name);
00129 
00130 
00134         ~LSBService();
00135 
00136 
00140         bool
00141         isServiceEnabled() const;
00142 
00143 
00149         bool
00150         isServiceEnabledInRunlevel(Runlevel runlevel) const;
00151 
00152 
00158         bool enableService() const;
00159 
00160 
00165         bool disableService() const;
00166 
00167 
00176         LSBInitInfo
00177         getServiceInitInfo() const;
00178 
00179 
00188         blocxx::Array<blocxx::String>
00189         getServiceActions() const;
00190 
00191 
00203         blocxx::Array<blocxx::String>
00204         getDefaultActions() const;
00205 
00206 
00251         LSBExitCode
00252         executeAction(const blocxx::String   &action,
00253                       const ServiceCmdArgs   &cmdArgs,
00254                       blocxx::String         &stdOutput,
00255                       blocxx::String         &errOutput,
00256                       const ServiceEnvVars   &envVars,
00257                       const blocxx::String   &stdInput,
00258                       int                    timeoutSecs,
00259                       int                    outputLimit);
00260 
00261 
00278         LSBExitCode
00279         executeAction(const blocxx::String   &action,
00280                       const ServiceCmdArgs   &cmdArgs);
00281 
00282 
00297         LSBExitCode
00298         executeAction(const blocxx::String    &action);
00299 
00300 
00309         LSBExitCode
00310         executeAction(const blocxx::String   &action,
00311                       const ServiceCmdArgs   &cmdArgs,
00312                       blocxx::String         &stdOutput,
00313                       blocxx::String         &errOutput,
00314                       int                    &execStatus,
00315                       const ServiceEnvVars   &envVars,
00316                       const blocxx::String   &stdInput,
00317                       int                    timeoutSecs,
00318                       int                    outputLimit)
00319                       // BLOCXX_DEPRECATED
00320                       ;
00321 
00322 
00323 protected:
00324         void
00325         addServiceAction(const blocxx::String &action);
00326 
00327 private:
00328         blocxx::Array<blocxx::String> m_actions;
00329 };
00330 
00331 
00332 // -------------------------------------------------------------------
00333 }      // End of RUNLEVEL_NAMESPACE
00334 }      // End of LIMAL_NAMESPACE
00335 
00336 #endif // LIMAL_RUNLEVEL_LSB_SERVICE_HPP
00337 /* vim: set ts=8 sts=8 sw=8 ai noet: */