X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/21ba4dfad49d2d489a9399d36d078eab8c44e0d6..4fe07d7c76c7c9006780389a5babb524560b3ff0:/projects/stargazer/plugins/other/radius/server.h diff --git a/projects/stargazer/plugins/other/radius/server.h b/projects/stargazer/plugins/other/radius/server.h index d4efef98..1523179e 100644 --- a/projects/stargazer/plugins/other/radius/server.h +++ b/projects/stargazer/plugins/other/radius/server.h @@ -2,6 +2,7 @@ #include "radproto/socket.h" #include "radproto/packet.h" +#include "config.h" #include "radproto/dictionaries.h" #include "stg/logger.h" #include @@ -12,15 +13,17 @@ namespace STG { class Users; + class User; class Server { public: - Server(boost::asio::io_context& io_context, const std::string& secret, uint16_t port, const std::string& filePath, std::stop_token token, PluginLogger& logger, Users* users); + Server(boost::asio::io_context& io_context, const std::string& secret, uint16_t port, const std::string& filePath, std::stop_token token, PluginLogger& logger, Users* users, const Config& config); void stop(); private: + std::vector makeAttributes(const User* user); RadProto::Packet makeResponse(const RadProto::Packet& request); - bool findUser(const RadProto::Packet& packet); + const User* findUser(const RadProto::Packet& packet); void handleReceive(const boost::system::error_code& error, const std::optional& packet, const boost::asio::ip::udp::endpoint& source); void handleSend(const boost::system::error_code& ec); void start(); @@ -29,6 +32,7 @@ namespace STG RadProto::Socket m_radius; RadProto::Dictionaries m_dictionaries; Users* m_users; + const Config& m_config; std::stop_token m_token; PluginLogger& m_logger;