]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/other/radius/server.h
Update async-radius.
[stg.git] / projects / stargazer / plugins / other / radius / server.h
index b88889be960b820674344de460e2111809411d64..e33a23b3f20bcc99113776a0a08792b91956b42c 100644 (file)
@@ -3,7 +3,9 @@
 #include "radproto/socket.h"
 #include "radproto/packet.h"
 #include "radproto/dictionaries.h"
+#include "stg/logger.h"
 #include <boost/asio.hpp>
+#include <stop_token.hpp>
 #include <optional>
 #include <cstdint> //uint8_t, uint32_t
 
@@ -12,15 +14,19 @@ namespace STG
     class Server
     {
         public:
-            Server(boost::asio::io_service& io_service, const std::string& secret, uint16_t port, const std::string& filePath);
-
+            Server(boost::asio::io_service& io_service, const std::string& secret, uint16_t port, const std::string& filePath, std::stop_token token, PluginLogger& logger);
+            void stop();
         private:
             RadProto::Packet makeResponse(const RadProto::Packet& request);
             void handleReceive(const boost::system::error_code& error, const std::optional<RadProto::Packet>& packet, const boost::asio::ip::udp::endpoint& source);
             void handleSend(const boost::system::error_code& ec);
+            void start();
             void startReceive();
 
             RadProto::Socket m_radius;
             RadProto::Dictionaries m_dictionaries;
+            std::stop_token m_token;
+
+            PluginLogger& m_logger;
     };
 }