15e70dc8cSNikhil Namjoshi // Copyright 2022 Google LLC 25e70dc8cSNikhil Namjoshi // 35e70dc8cSNikhil Namjoshi // Licensed under the Apache License, Version 2.0 (the "License"); 45e70dc8cSNikhil Namjoshi // you may not use this file except in compliance with the License. 55e70dc8cSNikhil Namjoshi // You may obtain a copy of the License at 65e70dc8cSNikhil Namjoshi // 75e70dc8cSNikhil Namjoshi // http://www.apache.org/licenses/LICENSE-2.0 85e70dc8cSNikhil Namjoshi // 95e70dc8cSNikhil Namjoshi // Unless required by applicable law or agreed to in writing, software 105e70dc8cSNikhil Namjoshi // distributed under the License is distributed on an "AS IS" BASIS, 115e70dc8cSNikhil Namjoshi // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 125e70dc8cSNikhil Namjoshi // See the License for the specific language governing permissions and 135e70dc8cSNikhil Namjoshi // limitations under the License. 145e70dc8cSNikhil Namjoshi 155e70dc8cSNikhil Namjoshi #include "bmc_mode.hpp" 165e70dc8cSNikhil Namjoshi 175e70dc8cSNikhil Namjoshi #include "commands.hpp" 185e70dc8cSNikhil Namjoshi #include "errors.hpp" 195e70dc8cSNikhil Namjoshi #include "handler.hpp" 205e70dc8cSNikhil Namjoshi 215e70dc8cSNikhil Namjoshi #include <ipmid/api-types.hpp> 22*444b5ea4SPatrick Williams 235e70dc8cSNikhil Namjoshi #include <span> 245e70dc8cSNikhil Namjoshi #include <vector> 255e70dc8cSNikhil Namjoshi 265e70dc8cSNikhil Namjoshi namespace google 275e70dc8cSNikhil Namjoshi { 285e70dc8cSNikhil Namjoshi namespace ipmi 295e70dc8cSNikhil Namjoshi { 305e70dc8cSNikhil Namjoshi getBmcMode(std::span<const uint8_t>,HandlerInterface * handler)315e70dc8cSNikhil NamjoshiResp getBmcMode(std::span<const uint8_t>, HandlerInterface* handler) 325e70dc8cSNikhil Namjoshi { 335e70dc8cSNikhil Namjoshi try 345e70dc8cSNikhil Namjoshi { 355e70dc8cSNikhil Namjoshi return ::ipmi::responseSuccess( 365e70dc8cSNikhil Namjoshi SysOEMCommands::SysGetBmcMode, 375e70dc8cSNikhil Namjoshi std::vector<std::uint8_t>{handler->getBmcMode()}); 385e70dc8cSNikhil Namjoshi } 395e70dc8cSNikhil Namjoshi catch (const IpmiException& e) 405e70dc8cSNikhil Namjoshi { 415e70dc8cSNikhil Namjoshi return ::ipmi::response(e.getIpmiError()); 425e70dc8cSNikhil Namjoshi } 435e70dc8cSNikhil Namjoshi } 445e70dc8cSNikhil Namjoshi } // namespace ipmi 455e70dc8cSNikhil Namjoshi } // namespace google 46