#include "server.hpp" #include #include #include #include #include #include #include #include namespace kcsbridge { void setAttention(sdbusplus::message_t& m, stdplus::Fd& kcs) { stdplus::fd::ioctl(kcs, IPMI_BMC_IOCTL_SET_SMS_ATN, nullptr); m.new_method_return().method_return(); } void clearAttention(sdbusplus::message_t& m, stdplus::Fd& kcs) { stdplus::fd::ioctl(kcs, IPMI_BMC_IOCTL_CLEAR_SMS_ATN, nullptr); m.new_method_return().method_return(); } void forceAbort(sdbusplus::message_t& m, stdplus::Fd& kcs) { stdplus::fd::ioctl(kcs, IPMI_BMC_IOCTL_FORCE_ABORT, nullptr); m.new_method_return().method_return(); } template int methodRsp(sd_bus_message* mptr, void* dataptr, sd_bus_error* error) noexcept { sdbusplus::message_t m(mptr); try { func(m, *reinterpret_cast(dataptr)); } catch (const std::exception& e) { stdplus::print(stderr, "Method response failed: {}\n", e.what()); sd_bus_error_set(error, "xyz.openbmc_project.Common.Error.InternalFailure", "The operation failed internally."); } return 1; } template constexpr sdbusplus::vtable::vtable_t dbusMethods[] = { sdbusplus::vtable::start(), sdbusplus::vtable::method("setAttention", "", "", methodRsp), sdbusplus::vtable::method("clearAttention", "", "", methodRsp), sdbusplus::vtable::method("forceAbort", "", "", methodRsp), sdbusplus::vtable::end(), }; sdbusplus::server::interface::interface createSMSHandler( sdbusplus::bus_t& bus, const char* obj, stdplus::Fd& kcs) { return sdbusplus::server::interface::interface( bus, obj, "xyz.openbmc_project.Ipmi.Channel.SMS", dbusMethods, reinterpret_cast(&kcs)); } } // namespace kcsbridge