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     ZoneControlIpmiHandler(std::unique_ptr<ZoneControlInterface> control) :
21         _control(std::move(control))
22     {}
23 
24     ipmi_ret_t getFailsafeModeState(const uint8_t* reqBuf, uint8_t* replyBuf,
25                                     size_t* dataLen);
26 
27     ipmi_ret_t getManualModeState(const uint8_t* reqBuf, uint8_t* replyBuf,
28                                   size_t* dataLen);
29 
30     ipmi_ret_t setManualModeState(const uint8_t* reqBuf, uint8_t* replyBuf,
31                                   size_t* dataLen);
32 
33   private:
34     std::unique_ptr<ZoneControlInterface> _control;
35 };
36 
37 ipmi_ret_t manualModeControl(ZoneControlIpmiHandler* handler, ipmi_cmd_t cmd,
38                              const uint8_t* reqBuf, uint8_t* replyCmdBuf,
39                              size_t* dataLen);
40 
41 } // namespace ipmi
42 } // namespace pid_control
43