Tom Joseph | 9662c3a | 2016-12-06 17:52:16 +0530 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include <vector> |
| 4 | |
| 5 | #include "message_handler.hpp" |
| 6 | |
| 7 | namespace command |
| 8 | { |
| 9 | |
| 10 | constexpr uint8_t IPMI_CC_INVALID_PRIV_LEVEL = 0x80; |
| 11 | constexpr uint8_t IPMI_CC_EXCEEDS_USER_PRIV = 0x81; |
| 12 | |
Tom Joseph | 3563f8f | 2017-05-08 15:42:54 +0530 | [diff] [blame] | 13 | /** |
| 14 | * @struct SetSessionPrivLevelReq |
Tom Joseph | 9662c3a | 2016-12-06 17:52:16 +0530 | [diff] [blame] | 15 | * |
| 16 | * IPMI Request data for Set Session Privilege Level command |
| 17 | */ |
| 18 | struct SetSessionPrivLevelReq |
| 19 | { |
| 20 | |
| 21 | #if BYTE_ORDER == LITTLE_ENDIAN |
| 22 | uint8_t reqPrivLevel : 4; |
| 23 | uint8_t reserved : 4; |
| 24 | #endif |
| 25 | |
| 26 | #if BYTE_ORDER == BIG_ENDIAN |
| 27 | uint8_t reserved : 4; |
| 28 | uint8_t reqPrivLevel : 4; |
| 29 | #endif |
| 30 | |
| 31 | } __attribute__((packed)); |
| 32 | |
Tom Joseph | 3563f8f | 2017-05-08 15:42:54 +0530 | [diff] [blame] | 33 | /** |
| 34 | * @struct SetSessionPrivLevelResp |
Tom Joseph | 9662c3a | 2016-12-06 17:52:16 +0530 | [diff] [blame] | 35 | * |
| 36 | * IPMI Response data for Set Session Privilege Level command |
| 37 | */ |
| 38 | struct SetSessionPrivLevelResp |
| 39 | { |
| 40 | uint8_t completionCode; |
| 41 | |
| 42 | #if BYTE_ORDER == LITTLE_ENDIAN |
| 43 | uint8_t newPrivLevel : 4; |
| 44 | uint8_t reserved : 4; |
| 45 | #endif |
| 46 | |
| 47 | #if BYTE_ORDER == BIG_ENDIAN |
| 48 | uint8_t reserved : 4; |
| 49 | uint8_t newPrivLevel : 4; |
| 50 | #endif |
| 51 | |
| 52 | } __attribute__((packed)); |
| 53 | |
Tom Joseph | 3563f8f | 2017-05-08 15:42:54 +0530 | [diff] [blame] | 54 | /** |
Tom Joseph | 9662c3a | 2016-12-06 17:52:16 +0530 | [diff] [blame] | 55 | * @brief Set Session Privilege Command |
| 56 | * |
| 57 | * This command is sent in authenticated format. When a session is activated, |
| 58 | * the session is set to an initial privilege level. A session that is |
| 59 | * activated at a maximum privilege level of Callback is set to an initial |
| 60 | * privilege level of Callback and cannot be changed. All other sessions are |
| 61 | * initially set to USER level, regardless of the maximum privilege level |
| 62 | * requested in the RAKP Message 1. |
| 63 | * |
| 64 | * This command cannot be used to set a privilege level higher than the lowest |
| 65 | * of the privilege level set for the user(via the Set User Access command) and |
| 66 | * the privilege limit for the channel that was set via the Set Channel Access |
| 67 | * command. |
| 68 | * |
| 69 | * @param[in] inPayload - Request Data for the command |
| 70 | * @param[in] handler - Reference to the Message Handler |
| 71 | * |
| 72 | * @return Response data for the command |
| 73 | */ |
Tom Joseph | 18a45e9 | 2017-04-11 11:30:44 +0530 | [diff] [blame] | 74 | std::vector<uint8_t> setSessionPrivilegeLevel( |
| 75 | const std::vector<uint8_t>& inPayload, const message::Handler& handler); |
Tom Joseph | 9662c3a | 2016-12-06 17:52:16 +0530 | [diff] [blame] | 76 | |
| 77 | constexpr uint8_t IPMI_CC_INVALID_SESSIONID = 0x87; |
| 78 | |
Tom Joseph | 3563f8f | 2017-05-08 15:42:54 +0530 | [diff] [blame] | 79 | /** |
| 80 | * @struct CloseSessionRequest |
Tom Joseph | 9662c3a | 2016-12-06 17:52:16 +0530 | [diff] [blame] | 81 | * |
| 82 | * IPMI Request data for Close Session command |
| 83 | */ |
| 84 | struct CloseSessionRequest |
| 85 | { |
| 86 | uint32_t sessionID; |
| 87 | uint8_t sessionHandle; |
| 88 | } __attribute__((packed)); |
| 89 | |
Tom Joseph | 3563f8f | 2017-05-08 15:42:54 +0530 | [diff] [blame] | 90 | /** |
| 91 | * @struct CloseSessionResponse |
Tom Joseph | 9662c3a | 2016-12-06 17:52:16 +0530 | [diff] [blame] | 92 | * |
| 93 | * IPMI Response data for Close Session command |
| 94 | */ |
| 95 | struct CloseSessionResponse |
| 96 | { |
| 97 | uint8_t completionCode; |
| 98 | } __attribute__((packed)); |
| 99 | |
Tom Joseph | 3563f8f | 2017-05-08 15:42:54 +0530 | [diff] [blame] | 100 | /** |
Tom Joseph | 9662c3a | 2016-12-06 17:52:16 +0530 | [diff] [blame] | 101 | * @brief Close Session Command |
| 102 | * |
| 103 | * This command is used to immediately terminate a session in progress. It is |
| 104 | * typically used to close the session that the user is communicating over, |
| 105 | * though it can be used to other terminate sessions in progress (provided that |
| 106 | * the user is operating at the appropriate privilege level, or the command is |
| 107 | * executed over a local channel - e.g. the system interface). Closing |
| 108 | * sessionless session ( session zero) is restricted in this command |
| 109 | * |
| 110 | * @param[in] inPayload - Request Data for the command |
| 111 | * @param[in] handler - Reference to the Message Handler |
| 112 | * |
| 113 | * @return Response data for the command |
| 114 | */ |
Tom Joseph | 18a45e9 | 2017-04-11 11:30:44 +0530 | [diff] [blame] | 115 | std::vector<uint8_t> closeSession(const std::vector<uint8_t>& inPayload, |
Tom Joseph | 9662c3a | 2016-12-06 17:52:16 +0530 | [diff] [blame] | 116 | const message::Handler& handler); |
| 117 | |
| 118 | } // namespace command |