3 #include "radproto/error.h"
5 #include "stg/common.h"
7 #include <boost/asio.hpp>
10 #include <cstdint> //uint8_t, uint32_t
14 extern "C" STG::Plugin* GetPlugin()
20 std::string RADIUS::GetVersion() const
22 return "Radius v.1.0";
26 : m_logger(PluginLogger::get("radius")),
33 m_thread = std::jthread([this](auto token){ Run(std::move(token)); });
39 if (!m_thread.joinable())
42 m_thread.request_stop();
48 void RADIUS::SetRunning(bool val)
50 const std::lock_guard lock(m_mutex);
54 bool RADIUS::IsRunning()
56 const std::lock_guard lock(m_mutex);
60 int RADIUS::Run(std::stop_token token)
66 boost::asio::io_service ioService;
67 Server server(ioService, "secret", 1812, "/usr/share/freeradius/dictionary");
70 catch (const std::exception& e)
72 m_errorStr = "Exception in RADIUS::Run(): " + std::string(e.what());
73 m_logger("Exception in RADIUS:: Run(): %s", e.what());
74 printfd(__FILE__, "Exception in RADIUS:: Run(). Message: '%s'\n", e.what());