X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/810c900ba1bcb412f12eda3a39561b0ff5a72b35..83ce40b2a471b560ec7516efebcb5ddcf7519071:/include/stg/user.h?ds=inline diff --git a/include/stg/user.h b/include/stg/user.h index b7024859..b08f3cd0 100644 --- a/include/stg/user.h +++ b/include/stg/user.h @@ -18,77 +18,83 @@ * Author : Maxim Mamontov */ -#ifndef USER_H -#define USER_H +#pragma once -#include -#include - -#include "os_int.h" #include "notifer.h" #include "message.h" -#include "tariff.h" -#include "user_traff.h" -class USER_PROPERTIES; -class AUTH; +#include +#include + +#include +#include -typedef PROPERTY_NOTIFIER_BASE CURR_IP_NOTIFIER; -typedef PROPERTY_NOTIFIER_BASE CONNECTED_NOTIFIER; +namespace STG +{ + +struct Tariff; +class UserProperties; +class DirTraff; +struct Auth; + +using CURR_IP_NOTIFIER = PropertyNotifierBase; +using CONNECTED_NOTIFIER = PropertyNotifierBase; + +struct User { + virtual ~User() = default; -class USER { -public: - virtual ~USER() {} virtual int WriteConf() = 0; virtual int WriteStat() = 0; - virtual const std::string & GetLogin() const = 0; + virtual const std::string& GetLogin() const = 0; virtual uint32_t GetCurrIP() const = 0; virtual time_t GetCurrIPModificationTime() const = 0; - virtual void AddCurrIPBeforeNotifier(CURR_IP_NOTIFIER * notifier) = 0; - virtual void DelCurrIPBeforeNotifier(const CURR_IP_NOTIFIER * notifier) = 0; + virtual void AddCurrIPBeforeNotifier(CURR_IP_NOTIFIER* notifier) = 0; + virtual void DelCurrIPBeforeNotifier(const CURR_IP_NOTIFIER* notifier) = 0; - virtual void AddCurrIPAfterNotifier(CURR_IP_NOTIFIER * notifier) = 0; - virtual void DelCurrIPAfterNotifier(const CURR_IP_NOTIFIER * notifier) = 0; + virtual void AddCurrIPAfterNotifier(CURR_IP_NOTIFIER* notifier) = 0; + virtual void DelCurrIPAfterNotifier(const CURR_IP_NOTIFIER* notifier) = 0; - virtual void AddConnectedBeforeNotifier(CONNECTED_NOTIFIER * notifier) = 0; - virtual void DelConnectedBeforeNotifier(const CONNECTED_NOTIFIER * notifier) = 0; + virtual void AddConnectedBeforeNotifier(CONNECTED_NOTIFIER* notifier) = 0; + virtual void DelConnectedBeforeNotifier(const CONNECTED_NOTIFIER* notifier) = 0; - virtual void AddConnectedAfterNotifier(CONNECTED_NOTIFIER * notifier) = 0; - virtual void DelConnectedAfterNotifier(const CONNECTED_NOTIFIER * notifier) = 0; + virtual void AddConnectedAfterNotifier(CONNECTED_NOTIFIER* notifier) = 0; + virtual void DelConnectedAfterNotifier(const CONNECTED_NOTIFIER* notifier) = 0; virtual int GetID() const = 0; virtual double GetPassiveTimePart() const = 0; - virtual const TARIFF * GetTariff() const = 0; + virtual const Tariff* GetTariff() const = 0; virtual void ResetNextTariff() = 0; - virtual const DIR_TRAFF & GetSessionUpload() const = 0; - virtual const DIR_TRAFF & GetSessionDownload() const = 0; + virtual const DirTraff& GetSessionUpload() const = 0; + virtual const DirTraff& 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 bool IsAuthorizedBy(const AUTH * auth) const = 0; + virtual time_t GetAuthorizedModificationTime() const = 0; - virtual int AddMessage(STG_MSG * msg) = 0; + virtual bool IsAuthorizedBy(const Auth * auth) const = 0; + virtual std::vector GetAuthorizers() const = 0; + + virtual int AddMessage(Message* msg) = 0; virtual void UpdatePingTime(time_t t = 0) = 0; virtual time_t GetPingTime() const = 0; virtual void Run() = 0; - virtual const std::string & GetStrError() const = 0; + virtual const std::string& GetStrError() const = 0; - virtual USER_PROPERTIES & GetProperty() = 0; - virtual const USER_PROPERTIES & GetProperty() const = 0; + virtual UserProperties& GetProperties() = 0; + virtual const UserProperties& GetProperties() const = 0; virtual bool GetDeleted() const = 0; virtual void SetDeleted() = 0; @@ -101,10 +107,7 @@ public: virtual void OnAdd() = 0; virtual void OnDelete() = 0; - virtual std::string GetParamValue(const std::string & name) const = 0; + virtual std::string GetParamValue(const std::string& name) const = 0; }; -typedef USER * USER_PTR; -typedef const USER * CONST_USER_PTR; - -#endif +}