]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/other/radius/radius.h
Виправлено роботу з перекодуванням рядків
[stg.git] / projects / stargazer / plugins / other / radius / radius.h
index b26a3bb30ad7f674900f8dc8b4c99a431025fa4e..69d3b9d980096b78724f3d073c6749c040e9fbe5 100644 (file)
 #ifndef RADIUS_H
 #define RADIUS_H
 
+#include <pthread.h>
+
+#include <cstring>
+#include <cstdlib>
 #include <string>
 #include <list>
-#include <pthread.h>
-#include <string.h>
-#include <stdlib.h>
 
 #include "os_int.h"
 #include "base_auth.h"
@@ -55,26 +56,24 @@ class RADIUS;
 class RAD_SETTINGS
 {
 public:
-    virtual         ~RAD_SETTINGS(){};
-    const string&   GetStrError() const { return errorStr; };
-    int             ParseSettings(const MODULE_SETTINGS & s);
-    uint16_t        GetPort() const;
-    uint32_t        GetServerIP() const;
-    int             GetPassword(string * password) const;
-    int             GetAuthServices(list<string> * svcs) const;
-    int             GetAcctServices(list<string> * svcs) const;
+    RAD_SETTINGS() : port(0) {}
+    virtual ~RAD_SETTINGS() {}
+    const string & GetStrError() const { return errorStr; }
+    int ParseSettings(const MODULE_SETTINGS & s);
+    uint16_t GetPort() const { return port; }
+    const std::string & GetPassword() const { return password; }
+    const list<string> & GetAuthServices() const { return authServices; }
+    const list<string> & GetAcctServices() const { return acctServices; }
 
 private:
-    int             ParseIntInRange(const string & str, int min, int max, int * val);
-    int             ParseIP(const string & str, uint32_t * routerIP);
-    int             ParseServices(const vector<string> & str, list<string> * lst);
-
-    uint16_t            port;
-    string              errorStr;
-    string              password;
-    uint32_t            serverIP;
-    list<string>        authServices;
-    list<string>        acctServices;
+    int ParseIntInRange(const string & str, int min, int max, int * val);
+    int ParseServices(const vector<string> & str, list<string> * lst);
+
+    uint16_t port;
+    string errorStr;
+    string password;
+    list<string> authServices;
+    list<string> acctServices;
 };
 //-----------------------------------------------------------------------------
 struct RAD_SESSION {
@@ -114,12 +113,8 @@ private:
     int                 PrepareNet();
     int                 FinalizeNet();
 
-    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                 Send(const RAD_PACKET & packet);
-    int                 RecvData(RAD_PACKET * packet);
+    int                 Send(const RAD_PACKET & packet, struct sockaddr_in * outerAddr);
+    int                 RecvData(RAD_PACKET * packet, struct sockaddr_in * outerAddr);
     int                 ProcessData(RAD_PACKET * packet);
 
     int                 ProcessAutzPacket(RAD_PACKET * packet);
@@ -135,9 +130,6 @@ private:
     bool                CanAcctService(const std::string & svc) const;
     bool                IsAllowedService(const std::string & svc) const;
 
-    void                SetUserNotifier(user_iter u);
-    void                UnSetUserNotifier(user_iter u);
-
     bool                WaitPackets(int sd) const;
 
     void                PrintServices(const std::list<std::string> & svcs);
@@ -167,7 +159,6 @@ private:
     map<string, RAD_SESSION> sessions;
 
     bool                nonstop;
-
     bool                isRunning;
 
     USERS *             users;
@@ -178,12 +169,6 @@ private:
     pthread_mutex_t     mutex;
 
     int                 sock;
-    struct sockaddr_in  inAddr;
-    socklen_t           inAddrLen;
-    uint16_t            port;
-    uint32_t            serverIP;
-    struct sockaddr_in  outerAddr;
-    socklen_t           outerAddrLen;
 
     RAD_PACKET          packet;
 
@@ -191,4 +176,3 @@ private:
 //-----------------------------------------------------------------------------
 
 #endif
-