]> git.stg.codes - stg.git/blobdiff - projects/sgauthstress/user.h
User info holder implemented
[stg.git] / projects / sgauthstress / user.h
index 1ab31d93ba890b4b1eceb0c8dd4154d35e7214af..f494e5dbfefbc7ab9135341262254da89f796940 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef __USER_H__
 #define __USER_H__
 
+#include <ctime>
 #include <string>
 
 #include "stg/os_int.h"
 class USER {
     public:
         USER(const std::string & login,
-             const std::string & password);
+             const std::string & password,
+             uint32_t ip);
         ~USER();
 
-        void Connect();
-        void Disconnect();
+        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; }
+        int 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(int r) { rnd = r; }
+        int 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;
+        time_t phaseChangeTime;
         int rnd;
         int sock;
         BLOWFISH_CTX ctx;