]> git.stg.codes - stg.git/blob - projects/stargazer/plugins/other/radius/server.h
Radius (#7)
[stg.git] / projects / stargazer / plugins / other / radius / server.h
1 #pragma once
2
3 #include "radproto/socket.h"
4 #include "radproto/packet.h"
5 #include "radproto/dictionaries.h"
6 #include <boost/asio.hpp>
7 #include <optional>
8 #include <cstdint> //uint8_t, uint32_t
9
10 namespace STG
11 {
12     class Server
13     {
14         public:
15             Server(boost::asio::io_service& io_service, const std::string& secret, uint16_t port, const std::string& filePath);
16
17         private:
18             RadProto::Packet makeResponse(const RadProto::Packet& request);
19             void handleReceive(const boost::system::error_code& error, const std::optional<RadProto::Packet>& packet, const boost::asio::ip::udp::endpoint& source);
20             void handleSend(const boost::system::error_code& ec);
21             void startReceive();
22
23             RadProto::Socket m_radius;
24             RadProto::Dictionaries m_dictionaries;
25     };
26 }