X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/6ce56fd8481f4fc5ae2cf9383e6b6ecbff42b41d..458b15bd1de32319a96a909e2797ed2ca3a4aed1:/projects/sgauthstress/user.h?ds=sidebyside diff --git a/projects/sgauthstress/user.h b/projects/sgauthstress/user.h index 1ab31d93..ef63a907 100644 --- a/projects/sgauthstress/user.h +++ b/projects/sgauthstress/user.h @@ -1,24 +1,50 @@ #ifndef __USER_H__ #define __USER_H__ +#include #include #include "stg/os_int.h" -#include "stg/ia.h" +#include "stg/blowfish.h" class USER { public: USER(const std::string & login, - const std::string & password); + const std::string & password, + uint32_t ip); + USER(const USER & rvalue); ~USER(); - void Connect(); - void Disconnect(); + USER & operator=(const USER & rvalue); + + bool InitNetwork(); + + const std::string & GetLogin() const { return login; } + uint32_t GetIP() const { return ip; } + uint32_t GetAliveTimeout() const { return aliveTimeout; } + uint32_t GetUserTimeout() const { return userTimeout; } + int GetPhase() const { return phase; } + uint32_t GetRnd() const { return rnd; } + int GetSocket() const { return sock; } + time_t GetPhaseChangeTime() const { return phaseChangeTime; } + + BLOWFISH_CTX * GetCtx() { return &ctx; } + + void SetPhase(int p) { phase = p; time(&phaseChangeTime); } + void SetRnd(uint32_t r) { rnd = r; } + uint32_t IncRnd() { return ++rnd; } + void SetAliveTimeout(uint32_t timeout) { aliveTimeout = timeout; } + void SetUserTimeout(uint32_t timeout) { userTimeout = timeout; } private: - const std::string login; + std::string login; + std::string password; + uint32_t ip; + uint32_t aliveTimeout; + uint32_t userTimeout; int phase; - int rnd; + time_t phaseChangeTime; + uint32_t rnd; int sock; BLOWFISH_CTX ctx; };