X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/9701b7ab4dc4cd709ad4dcaa750fc0021f15e231..d2b05df9aed6362e0e9f560d610108aaf3acdd19:/include/stg/user.h diff --git a/include/stg/user.h b/include/stg/user.h index adf140de..0adb342a 100644 --- a/include/stg/user.h +++ b/include/stg/user.h @@ -24,17 +24,24 @@ #include #include +#include +#include + #include "os_int.h" #include "notifer.h" -#include "stg_message.h" +#include "message.h" #include "tariff.h" #include "user_traff.h" 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 +50,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; @@ -62,25 +69,18 @@ public: virtual const TARIFF * GetTariff() const = 0; virtual void ResetNextTariff() = 0; - #ifdef TRAFF_STAT_WITH_PORTS - virtual void AddTraffStatU(int dir, uint32_t ip, uint16_t port, uint32_t len) = 0; - virtual void AddTraffStatD(int dir, uint32_t ip, uint16_t port, uint32_t len) = 0; - #else - virtual void AddTraffStatU(int dir, uint32_t ip, uint32_t len) = 0; - virtual void AddTraffStatD(int dir, uint32_t ip, uint32_t len) = 0; - #endif - virtual const DIR_TRAFF & GetSessionUpload() const = 0; virtual const DIR_TRAFF & GetSessionDownload() const = 0; virtual bool GetConnected() const = 0; virtual time_t GetConnectedModificationTime() const = 0; virtual int GetAuthorized() const = 0; - virtual int Authorize(uint32_t ip, + /*virtual int Authorize(uint32_t ip, uint32_t enabledDirs, const AUTH * auth) = 0; - virtual void Unauthorize(const AUTH * auth) = 0; + virtual void Unauthorize(const AUTH * auth) = 0;*/ virtual bool IsAuthorizedBy(const AUTH * auth) const = 0; + virtual std::vector GetAuthorizers() const = 0; virtual int AddMessage(STG_MSG * msg) = 0; @@ -107,5 +107,6 @@ public: }; typedef USER * USER_PTR; +typedef const USER * CONST_USER_PTR; #endif