blob: 44c1c96037ea389e168eaaaaf8a742cd382441f5 [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
George Liu92110f82025-07-02 15:07:35 +08005#include <ipmid/api-types.hpp>
Patrick Venture9bf5cef2020-08-16 08:59:54 -07006
Ed Tanousf8b6e552025-06-27 13:27:50 -07007#include <cstddef>
Patrick Venture36ab6f62020-08-03 10:50:26 -07008#include <cstdint>
Patrick Venture09334bb2020-08-16 12:22:54 -07009#include <memory>
Ed Tanousf8b6e552025-06-27 13:27:50 -070010#include <utility>
Patrick Venture36ab6f62020-08-03 10:50:26 -070011
George Liu92110f82025-07-02 15:07:35 +080012namespace pid_control::ipmi
Patrick Venture36ab6f62020-08-03 10:50:26 -070013{
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
George Liu92110f82025-07-02 15:07:35 +080025 ::ipmi::Cc getFailsafeModeState(const uint8_t* reqBuf, uint8_t* replyBuf,
Patrick Venture09334bb2020-08-16 12:22:54 -070026 size_t* dataLen);
27
George Liu92110f82025-07-02 15:07:35 +080028 ::ipmi::Cc getManualModeState(const uint8_t* reqBuf, uint8_t* replyBuf,
Patrick Venture09334bb2020-08-16 12:22:54 -070029 size_t* dataLen);
30
George Liu92110f82025-07-02 15:07:35 +080031 ::ipmi::Cc 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
George Liu92110f82025-07-02 15:07:35 +080038::ipmi::Cc manualModeControl(ZoneControlIpmiHandler* handler, uint8_t cmd,
Patrick Venture09334bb2020-08-16 12:22:54 -070039 const uint8_t* reqBuf, uint8_t* replyCmdBuf,
40 size_t* dataLen);
Patrick Venture36ab6f62020-08-03 10:50:26 -070041
George Liu92110f82025-07-02 15:07:35 +080042} // namespace pid_control::ipmi