]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/authorization/inetaccess/inetaccess.h
Merge branch 'master' of madf.dyndns.org:/var/git/stg
[stg.git] / projects / stargazer / plugins / authorization / inetaccess / inetaccess.h
index 0e194db6d18e6ba8b099d1365d7c448dbddc0971..92cd29fe97c90c87590d9efd2a34adcc606078d4 100644 (file)
@@ -29,6 +29,7 @@
 
 #include <sys/time.h>
 #include <pthread.h>
+
 #include <cstring>
 #include <ctime>
 #include <string>
@@ -121,15 +122,14 @@ private:
 struct IA_USER
 {
     IA_USER()
+        : lastSendAlive(0),
+          rnd(random()),
+          port(0),
+          protoVer(0),
+          password("NO PASSWORD")
     {
-        //phase     = 1;
-        //phaseTime = 0;
-        lastSendAlive = 0;
-        rnd       = random();
-        port      = 0;
-        password = "NO PASSWORD";
         // +++ Preparing CTX +++
-        unsigned char keyL[PASSWD_LEN];  // ðÁÒÏÌØ ÄÌÑ ÛÉÆÒÏ×ËÉ
+        unsigned char keyL[PASSWD_LEN];
         memset(keyL, 0, PASSWD_LEN);
         strncpy((char *)keyL, password.c_str(), PASSWD_LEN);
         Blowfish_Init(&ctx, keyL, PASSWD_LEN);
@@ -140,15 +140,15 @@ struct IA_USER
     };
 
     IA_USER(const IA_USER & u)
+        : user(u.user),
+          phase(u.phase),
+          lastSendAlive(u.lastSendAlive),
+          rnd(u.rnd),
+          port(u.port),
+          messagesToSend(u.messagesToSend),
+          protoVer(u.protoVer),
+          password(u.password)
     {
-        user          = u.user;
-        phase         = u.phase;
-        //phaseTime     = u.phaseTime;
-        lastSendAlive = u.lastSendAlive;
-        rnd           = u.rnd;
-        password      = u.password;
-        protoVer      = u.protoVer;
-        port          = u.port;
         #ifdef IA_DEBUG
         aliveSent  = u.aliveSent;
         #endif
@@ -199,10 +199,10 @@ public:
     virtual             ~AUTH_IA();
 
     void                SetUsers(USERS * u) { users = u; };
-    void                SetTariffs(TARIFFS *){};
-    void                SetAdmins(ADMINS *){};
-    void                SetTraffcounter(TRAFFCOUNTER *){};
-    void                SetStore(BASE_STORE *){};
+    void                SetTariffs(TARIFFS *) {};
+    void                SetAdmins(ADMINS *) {};
+    void                SetTraffcounter(TRAFFCOUNTER *) {};
+    void                SetStore(BASE_STORE *) {};
     void                SetStgSettings(const SETTINGS * s) { stgSettings = s; };
     void                SetSettings(const MODULE_SETTINGS & s) { settings = s; };
     int                 ParseSettings();
@@ -217,8 +217,6 @@ public:
     uint16_t            GetStartPosition() const { return 50; };
     uint16_t            GetStopPosition() const { return 50; };
 
-    void                DelUser(user_iter u);
-
     int                 SendMessage(const STG_MSG & msg, uint32_t ip) const;
 
 private:
@@ -226,6 +224,7 @@ private:
     static void *       RunTimeouter(void * d);
     int                 PrepareNet();
     int                 FinalizeNet();
+    void                DelUser(user_iter u);
     int                 RecvData(char * buffer, int bufferSize);
     int                 CheckHeader(const char * buffer, int * protoVer);
     int                 PacketProcessor(char * buff, int dataLen, uint32_t sip, uint16_t sport, int protoVer, user_iter * user);
@@ -280,10 +279,6 @@ private:
 
     int                 Timeouter();
 
-    void                InitEncrypt(BLOWFISH_CTX * ctx, const string & password);
-    void                Decrypt(BLOWFISH_CTX * ctx, char * dst, const char * src, int len8);
-    void                Encrypt(BLOWFISH_CTX * ctx, char * dst, const char * src, int len8);
-
     int                 SendError(uint32_t ip, uint16_t port, int protoVer, const string & text);
     int                 Send(uint32_t ip, uint16_t port, const char * buffer, int len);
     int                 RealSendMessage6(const STG_MSG & msg, uint32_t ip, IA_USER & user);