blob: 057ffc95f46d8baef12666e045c00e8accb7570f [file] [log] [blame]
Patrick Venture391b8b02018-03-08 08:31:13 -08001#pragma once
Patrick Venture36ab6f62020-08-03 10:50:26 -07002
Patrick Venture09334bb2020-08-16 12:22:54 -07003#include "control.hpp"
4
Patrick Venture9bf5cef2020-08-16 08:59:54 -07005#include <ipmid/api.h>
6
Patrick Venture36ab6f62020-08-03 10:50:26 -07007#include <cstdint>
Patrick Venture09334bb2020-08-16 12:22:54 -07008#include <memory>
Patrick Venture36ab6f62020-08-03 10:50:26 -07009
10namespace pid_control
11{
12namespace ipmi
13{
14
Patrick Venture09334bb2020-08-16 12:22:54 -070015// Implements validation of IPMI commands and handles sending back the
16// responses.
17class ZoneControlIpmiHandler
18{
19 public:
Harvey Wu22579ca2022-11-07 14:53:37 +080020 explicit ZoneControlIpmiHandler(
21 std::unique_ptr<ZoneControlInterface> control) :
Patrick Venture09334bb2020-08-16 12:22:54 -070022 _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,
Harvey Wu22579ca2022-11-07 14:53:37 +080032 const size_t* dataLen);
Patrick Venture09334bb2020-08-16 12:22:54 -070033
34 private:
35 std::unique_ptr<ZoneControlInterface> _control;
36};
37
38ipmi_ret_t manualModeControl(ZoneControlIpmiHandler* handler, ipmi_cmd_t cmd,
39 const uint8_t* reqBuf, uint8_t* replyCmdBuf,
40 size_t* dataLen);
Patrick Venture36ab6f62020-08-03 10:50:26 -070041
42} // namespace ipmi
43} // namespace pid_control