#pragma once #include "message_handler.hpp" #include namespace command { constexpr uint8_t IPMI_CC_INVALID_PRIV_LEVEL = 0x80; constexpr uint8_t IPMI_CC_EXCEEDS_USER_PRIV = 0x81; // bits 30 & 31 (MSB) hold the instanceID, hence shifting by 30 bits constexpr uint8_t myNetInstanceSessionIdShiftMask = 30; // bits 6 & 7 (MSB) hold the instanceID, hence shifting by 6 bits constexpr uint8_t myNetInstanceSessionHandleShiftMask = 6; /** * @struct SetSessionPrivLevelReq * * IPMI Request data for Set Session Privilege Level command */ struct SetSessionPrivLevelReq { #if BYTE_ORDER == LITTLE_ENDIAN uint8_t reqPrivLevel : 4; uint8_t reserved : 4; #endif #if BYTE_ORDER == BIG_ENDIAN uint8_t reserved : 4; uint8_t reqPrivLevel : 4; #endif } __attribute__((packed)); /** * @struct SetSessionPrivLevelResp * * IPMI Response data for Set Session Privilege Level command */ struct SetSessionPrivLevelResp { uint8_t completionCode; #if BYTE_ORDER == LITTLE_ENDIAN uint8_t newPrivLevel : 4; uint8_t reserved : 4; #endif #if BYTE_ORDER == BIG_ENDIAN uint8_t reserved : 4; uint8_t newPrivLevel : 4; #endif } __attribute__((packed)); /** * @brief Set Session Privilege Command * * This command is sent in authenticated format. When a session is activated, * the session is set to an initial privilege level. A session that is * activated at a maximum privilege level of Callback is set to an initial * privilege level of Callback and cannot be changed. All other sessions are * initially set to USER level, regardless of the maximum privilege level * requested in the RAKP Message 1. * * This command cannot be used to set a privilege level higher than the lowest * of the privilege level set for the user(via the Set User Access command) and * the privilege limit for the channel that was set via the Set Channel Access * command. * * @param[in] inPayload - Request Data for the command * @param[in] handler - Reference to the Message Handler * * @return Response data for the command */ std::vector setSessionPrivilegeLevel(const std::vector& inPayload, std::shared_ptr& handler); /** * @struct CloseSessionRequest * * IPMI Request data for Close Session command */ struct CloseSessionRequest { uint32_t sessionID; uint8_t sessionHandle; } __attribute__((packed)); /** * @struct CloseSessionResponse * * IPMI Response data for Close Session command */ struct CloseSessionResponse { uint8_t completionCode; } __attribute__((packed)); /** * @brief Close Session Command * * This command is used to immediately terminate a session in progress. It is * typically used to close the session that the user is communicating over, * though it can be used to other terminate sessions in progress (provided that * the user is operating at the appropriate privilege level, or the command is * executed over a local channel - e.g. the system interface). Closing * sessionless session ( session zero) is restricted in this command * * @param[in] inPayload - Request Data for the command * @param[in] handler - Reference to the Message Handler * * @return Response data for the command */ std::vector closeSession(const std::vector& inPayload, std::shared_ptr& handler); } // namespace command