]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/other/radius/server.h
Merge remote-tracking branch 'github/master'
[stg.git] / 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
new file mode 100644 (file)
index 0000000..b88889b
--- /dev/null
@@ -0,0 +1,26 @@
+#pragma once
+
+#include "radproto/socket.h"
+#include "radproto/packet.h"
+#include "radproto/dictionaries.h"
+#include <boost/asio.hpp>
+#include <optional>
+#include <cstdint> //uint8_t, uint32_t
+
+namespace STG
+{
+    class Server
+    {
+        public:
+            Server(boost::asio::io_service& io_service, const std::string& secret, uint16_t port, const std::string& filePath);
+
+        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 startReceive();
+
+            RadProto::Socket m_radius;
+            RadProto::Dictionaries m_dictionaries;
+    };
+}