Andrew Jeffery | dae6e18 | 2021-05-21 16:23:07 +0930 | [diff] [blame^] | 1 | #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 | |
| 11 | struct 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 | |
| 27 | using NVMEMap = boost::container::flat_map<int, std::shared_ptr<NVMeContext>>; |
| 28 | |
| 29 | namespace nvmeMCTP |
| 30 | { |
| 31 | void init(void); |
| 32 | } |
| 33 | |
| 34 | NVMEMap& getNVMEMap(void); |