blob: 057ffc95f46d8baef12666e045c00e8accb7570f [file] [log] [blame]
#pragma once
#include "control.hpp"
#include <ipmid/api.h>
#include <cstdint>
#include <memory>
namespace pid_control
{
namespace ipmi
{
// Implements validation of IPMI commands and handles sending back the
// responses.
class ZoneControlIpmiHandler
{
public:
explicit ZoneControlIpmiHandler(
std::unique_ptr<ZoneControlInterface> control) :
_control(std::move(control))
{}
ipmi_ret_t getFailsafeModeState(const uint8_t* reqBuf, uint8_t* replyBuf,
size_t* dataLen);
ipmi_ret_t getManualModeState(const uint8_t* reqBuf, uint8_t* replyBuf,
size_t* dataLen);
ipmi_ret_t setManualModeState(const uint8_t* reqBuf, uint8_t* replyBuf,
const size_t* dataLen);
private:
std::unique_ptr<ZoneControlInterface> _control;
};
ipmi_ret_t manualModeControl(ZoneControlIpmiHandler* handler, ipmi_cmd_t cmd,
const uint8_t* reqBuf, uint8_t* replyCmdBuf,
size_t* dataLen);
} // namespace ipmi
} // namespace pid_control