blob: f2d804ae7de43a9230a8be960a2cfbdaa4b06fc2 [file] [log] [blame]
Andrew Jefferydae6e182021-05-21 16:23:07 +09301#pragma once
2
3#include "NVMeSensor.hpp"
4
5#include <boost/asio/deadline_timer.hpp>
6#include <boost/asio/io_service.hpp>
7#include <boost/asio/ip/tcp.hpp>
8
9#include <memory>
10
11struct NVMeContext : std::enable_shared_from_this<NVMeContext>
12{
13 NVMeContext(boost::asio::io_service& io, int rootBus);
14
15 virtual ~NVMeContext();
16
17 void pollNVMeDevices();
18 void close();
19
20 boost::asio::deadline_timer scanTimer;
21 int rootBus; // Root bus for this drive
22 boost::asio::deadline_timer mctpResponseTimer;
23 boost::asio::ip::tcp::socket nvmeSlaveSocket;
24 std::list<std::shared_ptr<NVMeSensor>> sensors; // used as a poll queue
25};
26
27using NVMEMap = boost::container::flat_map<int, std::shared_ptr<NVMeContext>>;
28
29namespace nvmeMCTP
30{
31void init(void);
32}
33
34NVMEMap& getNVMEMap(void);