blob: a626490bc1719eefb743ac2444e6f5ea63350dad (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
#pragma once
#include "sol/sol_manager.hpp"
#include <systemd/sd-event.h>
#include <boost/asio/io_context.hpp>
#include <chrono>
#include <map>
namespace eventloop
{
class EventLoop
{
public:
explicit EventLoop(std::shared_ptr<boost::asio::io_context> io) : io(io)
{
}
EventLoop() = delete;
~EventLoop() = default;
EventLoop(const EventLoop&) = delete;
EventLoop& operator=(const EventLoop&) = delete;
EventLoop(EventLoop&&) = delete;
EventLoop& operator=(EventLoop&&) = delete;
/** @brief Initialise the event loop and add the handler for incoming
* IPMI packets.
*
* @return EXIT_SUCCESS on success and EXIT_FAILURE on failure.
*/
int startEventLoop();
private:
/** @brief async handler for incoming udp packets */
void handleRmcpPacket();
/** @brief register the async handler for incoming udp packets */
void startRmcpReceive();
/** @brief boost::asio io context to run with
*/
std::shared_ptr<boost::asio::io_context> io;
/** @brief boost::asio udp socket
*/
std::shared_ptr<boost::asio::ip::udp::socket> udpSocket = nullptr;
};
} // namespace eventloop
|