X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/d05a2f0b9869c82f8c02c37e2a8a158dee671a4c..1d95c81b71982af419d945a964cc657c44ef40b1:/include/stg/user.h?ds=inline diff --git a/include/stg/user.h b/include/stg/user.h index f0f77bc0..7772a298 100644 --- a/include/stg/user.h +++ b/include/stg/user.h @@ -21,20 +21,26 @@ #ifndef USER_H #define USER_H -#include -#include - -#include "os_int.h" #include "notifer.h" #include "message.h" #include "tariff.h" #include "user_traff.h" +#include "os_int.h" + +#include +#include + +#include class USER_PROPERTIES; class AUTH; +typedef PROPERTY_NOTIFIER_BASE CURR_IP_NOTIFIER; +typedef PROPERTY_NOTIFIER_BASE CONNECTED_NOTIFIER; + class USER { public: + virtual ~USER() {} virtual int WriteConf() = 0; virtual int WriteStat() = 0; @@ -43,17 +49,17 @@ public: virtual uint32_t GetCurrIP() const = 0; virtual time_t GetCurrIPModificationTime() const = 0; - virtual void AddCurrIPBeforeNotifier(PROPERTY_NOTIFIER_BASE * notifier) = 0; - virtual void DelCurrIPBeforeNotifier(PROPERTY_NOTIFIER_BASE * notifier) = 0; + virtual void AddCurrIPBeforeNotifier(CURR_IP_NOTIFIER * notifier) = 0; + virtual void DelCurrIPBeforeNotifier(const CURR_IP_NOTIFIER * notifier) = 0; - virtual void AddCurrIPAfterNotifier(PROPERTY_NOTIFIER_BASE * notifier) = 0; - virtual void DelCurrIPAfterNotifier(PROPERTY_NOTIFIER_BASE * notifier) = 0; + virtual void AddCurrIPAfterNotifier(CURR_IP_NOTIFIER * notifier) = 0; + virtual void DelCurrIPAfterNotifier(const CURR_IP_NOTIFIER * notifier) = 0; - virtual void AddConnectedBeforeNotifier(PROPERTY_NOTIFIER_BASE * notifier) = 0; - virtual void DelConnectedBeforeNotifier(PROPERTY_NOTIFIER_BASE * notifier) = 0; + virtual void AddConnectedBeforeNotifier(CONNECTED_NOTIFIER * notifier) = 0; + virtual void DelConnectedBeforeNotifier(const CONNECTED_NOTIFIER * notifier) = 0; - virtual void AddConnectedAfterNotifier(PROPERTY_NOTIFIER_BASE * notifier) = 0; - virtual void DelConnectedAfterNotifier(PROPERTY_NOTIFIER_BASE * notifier) = 0; + virtual void AddConnectedAfterNotifier(CONNECTED_NOTIFIER * notifier) = 0; + virtual void DelConnectedAfterNotifier(const CONNECTED_NOTIFIER * notifier) = 0; virtual int GetID() const = 0; @@ -64,15 +70,17 @@ public: virtual const DIR_TRAFF & GetSessionUpload() const = 0; virtual const DIR_TRAFF & GetSessionDownload() const = 0; + virtual time_t GetSessionUploadModificationTime() const = 0; + virtual time_t GetSessionDownloadModificationTime() const = 0; virtual bool GetConnected() const = 0; virtual time_t GetConnectedModificationTime() const = 0; + virtual const std::string & GetLastDisconnectReason() const = 0; virtual int GetAuthorized() const = 0; - virtual int Authorize(uint32_t ip, - uint32_t enabledDirs, - const AUTH * auth) = 0; - virtual void Unauthorize(const AUTH * auth) = 0; + virtual time_t GetAuthorizedModificationTime() const = 0; + virtual bool IsAuthorizedBy(const AUTH * auth) const = 0; + virtual std::vector GetAuthorizers() const = 0; virtual int AddMessage(STG_MSG * msg) = 0; @@ -92,12 +100,15 @@ public: virtual time_t GetLastWriteStatTime() const = 0; virtual bool IsInetable() = 0; - virtual std::string GetEnabledDirs() = 0; + virtual std::string GetEnabledDirs() const = 0; virtual void OnAdd() = 0; virtual void OnDelete() = 0; + + virtual std::string GetParamValue(const std::string & name) const = 0; }; typedef USER * USER_PTR; +typedef const USER * CONST_USER_PTR; #endif