]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/store/files/file_store.h
Merge branch 'stg-2.409-radius'
[stg.git] / projects / stargazer / plugins / store / files / file_store.h
index cd81dcda52a0f0d8cc94048401467d71198f98fd..2fe41326cfe14b35837ceb1a37d4204d11020e85 100644 (file)
 #include "stg/store.h"
 #include "stg/conffiles.h"
 #include "stg/user_traff.h"
+#include "stg/logger.h"
 
-//-----------------------------------------------------------------------------
-extern "C" STORE * GetStore();
 //-----------------------------------------------------------------------------
 class FILES_STORE_SETTINGS {
 public:
     FILES_STORE_SETTINGS();
-    virtual ~FILES_STORE_SETTINGS();
-    virtual int ParseSettings(const MODULE_SETTINGS & s);
-    virtual const std::string & GetStrError() const;
+    int ParseSettings(const MODULE_SETTINGS & s);
+    const std::string & GetStrError() const;
 
-    std::string  GetWorkDir() const;
-    std::string  GetUsersDir() const;
-    std::string  GetAdminsDir() const;
-    std::string  GetTariffsDir() const;
+    std::string  GetWorkDir() const { return workDir; }
+    std::string  GetUsersDir() const { return usersDir; }
+    std::string  GetAdminsDir() const { return adminsDir; }
+    std::string  GetTariffsDir() const { return tariffsDir; }
+    std::string  GetServicesDir() const { return servicesDir; }
 
-    mode_t  GetStatMode() const;
+    mode_t  GetStatMode() const { return statMode; }
     mode_t  GetStatModeDir() const;
-    uid_t   GetStatUID() const;
-    gid_t   GetStatGID() const;
+    uid_t   GetStatUID() const { return statUID; }
+    gid_t   GetStatGID() const { return statGID; }
 
-    mode_t  GetConfMode() const;
+    mode_t  GetConfMode() const { return confMode; }
     mode_t  GetConfModeDir() const;
-    uid_t   GetConfUID() const;
-    gid_t   GetConfGID() const;
+    uid_t   GetConfUID() const { return confUID; }
+    gid_t   GetConfGID() const { return confGID; }
 
-    mode_t  GetLogMode() const;
-    uid_t   GetLogUID() const;
-    gid_t   GetLogGID() const;
+    mode_t  GetLogMode() const { return userLogMode; }
+    uid_t   GetLogUID() const { return userLogUID; }
+    gid_t   GetLogGID() const { return userLogGID; }
 
-    bool    GetRemoveBak() const;
-    bool    GetReadBak() const;
+    bool    GetRemoveBak() const { return removeBak; }
+    bool    GetReadBak() const { return readBak; }
 
 private:
+    FILES_STORE_SETTINGS(const FILES_STORE_SETTINGS & rvalue);
+    FILES_STORE_SETTINGS & operator=(const FILES_STORE_SETTINGS & rvalue);
+
     const MODULE_SETTINGS * settings;
 
     int     User2UID(const char * user, uid_t * uid);
@@ -87,6 +89,7 @@ private:
     std::string  usersDir;
     std::string  adminsDir;
     std::string  tariffsDir;
+    std::string  servicesDir;
 
     mode_t  statMode;
     uid_t   statUID;
@@ -107,8 +110,8 @@ private:
 class FILES_STORE: public STORE {
 public:
     FILES_STORE();
-    virtual ~FILES_STORE();
-    virtual const std::string & GetStrError() const;
+    virtual ~FILES_STORE() {}
+    virtual const std::string & GetStrError() const { return errorStr; }
 
     //User
     virtual int GetUsersList(std::vector<std::string> * usersList) const;
@@ -174,17 +177,20 @@ public:
     virtual int DelCorp(const std::string &) const { return 0; }
 
     // Services
-    virtual int GetServicesList(std::vector<std::string> *) const { return 0; }
-    virtual int SaveService(const SERVICE_CONF &) const { return 0; }
-    virtual int RestoreService(SERVICE_CONF *, const std::string &) const { return 0; }
-    virtual int AddService(const std::string &) const { return 0; }
-    virtual int DelService(const std::string &) const { return 0; }
+    virtual int GetServicesList(std::vector<std::string> *) const;
+    virtual int SaveService(const SERVICE_CONF &) const;
+    virtual int RestoreService(SERVICE_CONF *, const std::string &) const;
+    virtual int AddService(const std::string &) const;
+    virtual int DelService(const std::string &) const;
 
-    virtual void SetSettings(const MODULE_SETTINGS & s);
+    virtual void SetSettings(const MODULE_SETTINGS & s) { settings = s; }
     virtual int ParseSettings();
-    virtual const std::string & GetVersion() const;
+    virtual const std::string & GetVersion() const { return version; }
 
 private:
+    FILES_STORE(const FILES_STORE & rvalue);
+    FILES_STORE & operator=(const FILES_STORE & rvalue);
+
     virtual int RestoreUserStat(USER_STAT * stat, const std::string & login, const std::string & fileName) const;
     virtual int RestoreUserConf(USER_CONF * conf, const std::string & login, const std::string & fileName) const;
 
@@ -193,11 +199,13 @@ private:
     int RemoveDir(const char * path) const;
     int Touch(const std::string & path) const;
 
-    mutable string errorStr;
+    mutable std::string errorStr;
     std::string version;
     FILES_STORE_SETTINGS storeSettings;
     MODULE_SETTINGS settings;
     mutable pthread_mutex_t mutex;
+
+    PLUGIN_LOGGER logger;
 };
 //-----------------------------------------------------------------------------