2 #include "radproto/error.h"
3 #include "stg/common.h"
4 #include <boost/tokenizer.hpp>
10 extern "C" STG::Plugin* GetPlugin()
19 m_logger(PluginLogger::get("radius"))
23 int RADIUS::ParseSettings()
25 auto ret = m_config.ParseSettings(m_settings);
27 m_errorStr = m_config.GetStrError();
32 std::string RADIUS::GetVersion() const
34 return "Radius v.1.0";
39 m_thread = std::jthread([this](auto token){ Run(std::move(token)); });
45 if (!m_thread.joinable())
48 m_thread.request_stop();
57 bool RADIUS::IsRunning()
59 const std::lock_guard lock(m_mutex);
63 void RADIUS::SetRunning(bool val)
65 const std::lock_guard lock(m_mutex);
69 int RADIUS::Run(std::stop_token token)
76 m_server = std::make_unique<Server>(m_ioContext, m_config.GetSecret(), m_config.GetPort(), m_config.GetDictionaries(), std::move(token), m_logger, m_users, m_config);
79 catch (const std::exception& e)
81 m_errorStr = "Exception in RADIUS::Run(): " + std::string(e.what());
82 m_logger("Exception in RADIUS:: Run(): %s", e.what());
83 printfd(__FILE__, "Exception in RADIUS:: Run(). Message: '%s'\n", e.what());