#include "stg/store.h"
#include "stg/users.h"
-#include "stg/plugin_creator.h"
+#include "stg/user.h"
#include "stg/common.h"
#include <algorithm>
using STG::Config;
using STG::Conn;
-namespace
+extern "C" STG::Plugin* GetPlugin()
{
-
-PLUGIN_CREATOR<RADIUS> creator;
-
-}
-
-extern "C" PLUGIN * GetPlugin()
-{
- return creator.GetPlugin();
+ static RADIUS plugin;
+ return &plugin;
}
RADIUS::RADIUS()
- : m_config(),
- m_running(false),
+ : m_running(false),
m_stopped(true),
m_users(NULL),
m_store(NULL),
m_listenSocket(0),
- m_logger(GetPluginLogger(GetStgLogger(), "radius"))
+ m_logger(STG::PluginLogger::get("radius"))
{
}
m_logger(m_error);
return;
}
- std::string remote = inet_ntostring(addr.sin_addr.s_addr) + ":" + x2str(ntohs(addr.sin_port));
+ std::string remote = inet_ntostring(addr.sin_addr.s_addr) + ":" + std::to_string(ntohs(addr.sin_port));
printfd(__FILE__, "New TCP connection: '%s'\n", remote.c_str());
m_conns.push_back(new Conn(*m_users, m_logger, *this, m_config, res, remote));
}
-void RADIUS::authorize(const USER& user)
+void RADIUS::authorize(const STG::User& user)
{
uint32_t ip = 0;
const std::string& login(user.GetLogin());