1 #pragma once 2 3 #include "control.hpp" 4 5 #include <ipmid/api.h> 6 7 #include <cstdint> 8 #include <memory> 9 10 namespace pid_control 11 { 12 namespace ipmi 13 { 14 15 // Implements validation of IPMI commands and handles sending back the 16 // responses. 17 class ZoneControlIpmiHandler 18 { 19 public: 20 explicit ZoneControlIpmiHandler( 21 std::unique_ptr<ZoneControlInterface> control) : 22 _control(std::move(control)) 23 {} 24 25 ipmi_ret_t getFailsafeModeState(const uint8_t* reqBuf, uint8_t* replyBuf, 26 size_t* dataLen); 27 28 ipmi_ret_t getManualModeState(const uint8_t* reqBuf, uint8_t* replyBuf, 29 size_t* dataLen); 30 31 ipmi_ret_t setManualModeState(const uint8_t* reqBuf, uint8_t* replyBuf, 32 const size_t* dataLen); 33 34 private: 35 std::unique_ptr<ZoneControlInterface> _control; 36 }; 37 38 ipmi_ret_t manualModeControl(ZoneControlIpmiHandler* handler, ipmi_cmd_t cmd, 39 const uint8_t* reqBuf, uint8_t* replyCmdBuf, 40 size_t* dataLen); 41 42 } // namespace ipmi 43 } // namespace pid_control 44