Tom Joseph | 8e832ee | 2016-12-06 17:47:08 +0530 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Tom Joseph | 8e832ee | 2016-12-06 17:47:08 +0530 | [diff] [blame] | 3 | #include "message_handler.hpp" |
| 4 | |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 5 | #include <vector> |
| 6 | |
Tom Joseph | 8e832ee | 2016-12-06 17:47:08 +0530 | [diff] [blame] | 7 | namespace command |
| 8 | { |
| 9 | |
Tom Joseph | 3563f8f | 2017-05-08 15:42:54 +0530 | [diff] [blame] | 10 | /** |
| 11 | * @struct OpenSessionRequest |
Tom Joseph | 8e832ee | 2016-12-06 17:47:08 +0530 | [diff] [blame] | 12 | * |
| 13 | * IPMI Payload for RMCP+ Open Session Request |
| 14 | */ |
| 15 | struct OpenSessionRequest |
| 16 | { |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 17 | uint8_t messageTag; // Message tag from request buffer |
Tom Joseph | 8e832ee | 2016-12-06 17:47:08 +0530 | [diff] [blame] | 18 | |
| 19 | #if BYTE_ORDER == LITTLE_ENDIAN |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 20 | uint8_t maxPrivLevel : 4; // Requested maximum privilege level |
| 21 | uint8_t reserved1 : 4; // Reserved for future definition |
Tom Joseph | 8e832ee | 2016-12-06 17:47:08 +0530 | [diff] [blame] | 22 | #endif |
| 23 | |
| 24 | #if BYTE_ORDER == BIG_ENDIAN |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 25 | uint8_t reserved1 : 4; // Reserved for future definition |
| 26 | uint8_t maxPrivLevel : 4; // Requested maximum privilege level |
Tom Joseph | 8e832ee | 2016-12-06 17:47:08 +0530 | [diff] [blame] | 27 | |
| 28 | #endif |
| 29 | |
| 30 | uint16_t reserved2; |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 31 | uint32_t remoteConsoleSessionID; |
Tom Joseph | 8e832ee | 2016-12-06 17:47:08 +0530 | [diff] [blame] | 32 | |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 33 | uint8_t authPayload; |
| 34 | uint16_t reserved3; |
| 35 | uint8_t authPayloadLen; |
Tom Joseph | 8e832ee | 2016-12-06 17:47:08 +0530 | [diff] [blame] | 36 | |
| 37 | #if BYTE_ORDER == LITTLE_ENDIAN |
| 38 | uint8_t authAlgo : 6; |
| 39 | uint8_t reserved4 : 2; |
| 40 | #endif |
| 41 | |
| 42 | #if BYTE_ORDER == BIG_ENDIAN |
| 43 | uint8_t reserved4 : 2; |
| 44 | uint8_t authAlgo : 6; |
| 45 | #endif |
| 46 | |
| 47 | uint8_t reserved5; |
| 48 | uint16_t reserved6; |
| 49 | |
| 50 | uint8_t intPayload; |
| 51 | uint16_t reserved7; |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 52 | uint8_t intPayloadLen; |
Tom Joseph | 8e832ee | 2016-12-06 17:47:08 +0530 | [diff] [blame] | 53 | |
| 54 | #if BYTE_ORDER == LITTLE_ENDIAN |
| 55 | uint8_t intAlgo : 6; |
| 56 | uint8_t reserved8 : 2; |
| 57 | #endif |
| 58 | |
| 59 | #if BYTE_ORDER == BIG_ENDIAN |
| 60 | uint8_t reserved8 : 2; |
| 61 | uint8_t intAlgo : 6; |
| 62 | #endif |
| 63 | |
| 64 | uint8_t reserved9; |
| 65 | uint16_t reserved10; |
| 66 | |
| 67 | uint8_t confPayload; |
| 68 | uint16_t reserved11; |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 69 | uint8_t confPayloadLen; |
Tom Joseph | 8e832ee | 2016-12-06 17:47:08 +0530 | [diff] [blame] | 70 | |
| 71 | #if BYTE_ORDER == LITTLE_ENDIAN |
| 72 | uint8_t confAlgo : 6; |
| 73 | uint8_t reserved12 : 2; |
| 74 | #endif |
| 75 | |
| 76 | #if BYTE_ORDER == BIG_ENDIAN |
| 77 | uint8_t reserved12 : 2; |
| 78 | uint8_t confAlgo : 6; |
| 79 | #endif |
| 80 | |
| 81 | uint8_t reserved13; |
| 82 | uint16_t reserved14; |
| 83 | } __attribute__((packed)); |
| 84 | |
Tom Joseph | 3563f8f | 2017-05-08 15:42:54 +0530 | [diff] [blame] | 85 | /** |
| 86 | * @struct OpenSessionResponse |
Tom Joseph | 8e832ee | 2016-12-06 17:47:08 +0530 | [diff] [blame] | 87 | * |
| 88 | * IPMI Payload for RMCP+ Open Session Response |
| 89 | */ |
| 90 | struct OpenSessionResponse |
| 91 | { |
| 92 | uint8_t messageTag; |
| 93 | uint8_t status_code; |
| 94 | |
| 95 | #if BYTE_ORDER == LITTLE_ENDIAN |
| 96 | uint8_t maxPrivLevel : 4; |
| 97 | uint8_t reserved1 : 4; |
| 98 | #endif |
| 99 | |
| 100 | #if BYTE_ORDER == BIG_ENDIAN |
| 101 | uint8_t reserved1 : 4; |
| 102 | uint8_t maxPrivLevel : 4; |
| 103 | #endif |
| 104 | |
| 105 | uint8_t reserved2; |
| 106 | uint32_t remoteConsoleSessionID; |
| 107 | uint32_t managedSystemSessionID; |
| 108 | |
| 109 | uint8_t authPayload; |
| 110 | uint16_t reserved3; |
| 111 | uint8_t authPayloadLen; |
| 112 | |
| 113 | #if BYTE_ORDER == LITTLE_ENDIAN |
| 114 | uint8_t authAlgo : 6; |
| 115 | uint8_t reserved4 : 2; |
| 116 | #endif |
| 117 | |
| 118 | #if BYTE_ORDER == BIG_ENDIAN |
| 119 | uint8_t reserved4 : 2; |
| 120 | uint8_t authAlgo : 6; |
| 121 | #endif |
| 122 | |
| 123 | uint8_t reserved5; |
| 124 | uint16_t reserved6; |
| 125 | |
| 126 | uint8_t intPayload; |
| 127 | uint16_t reserved7; |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 128 | uint8_t intPayloadLen; |
Tom Joseph | 8e832ee | 2016-12-06 17:47:08 +0530 | [diff] [blame] | 129 | |
| 130 | #if BYTE_ORDER == LITTLE_ENDIAN |
| 131 | uint8_t intAlgo : 6; |
| 132 | uint8_t reserved8 : 2; |
| 133 | #endif |
| 134 | |
| 135 | #if BYTE_ORDER == BIG_ENDIAN |
| 136 | uint8_t reserved8 : 2; |
| 137 | uint8_t intAlgo : 6; |
| 138 | |
| 139 | #endif |
| 140 | |
| 141 | uint8_t reserved9; |
| 142 | uint16_t reserved10; |
| 143 | |
| 144 | uint8_t confPayload; |
| 145 | uint16_t reserved11; |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 146 | uint8_t confPayloadLen; |
Tom Joseph | 8e832ee | 2016-12-06 17:47:08 +0530 | [diff] [blame] | 147 | |
| 148 | #if BYTE_ORDER == LITTLE_ENDIAN |
| 149 | uint8_t confAlgo : 6; |
| 150 | uint8_t reserved12 : 2; |
| 151 | #endif |
| 152 | |
| 153 | #if BYTE_ORDER == BIG_ENDIAN |
| 154 | uint8_t reserved12 : 2; |
| 155 | uint8_t confAlgo : 6; |
| 156 | #endif |
| 157 | |
| 158 | uint8_t reserved13; |
| 159 | uint16_t reserved14; |
| 160 | } __attribute__((packed)); |
| 161 | |
Tom Joseph | 3563f8f | 2017-05-08 15:42:54 +0530 | [diff] [blame] | 162 | /** |
Tom Joseph | 8e832ee | 2016-12-06 17:47:08 +0530 | [diff] [blame] | 163 | * @brief RMCP+ Open Session Request, RMCP+ Open Session Response |
| 164 | * |
| 165 | * The RMCP+ Open Session request and response messages are used to enable a |
| 166 | * remote console to discover what Cipher Suite(s) can be used for establishing |
| 167 | * a session at a requested maximum privilege level. These messages are also |
| 168 | * used for transferring the sessions IDs that the remote console and BMC wish |
| 169 | * to for the session once it’s been activated, and to track each party during |
| 170 | * the exchange of messages used for establishing the session. |
| 171 | * |
| 172 | * @param[in] inPayload - Request Data for the command |
| 173 | * @param[in] handler - Reference to the Message Handler |
| 174 | * |
| 175 | * @return Response data for the command |
| 176 | */ |
Tom Joseph | 18a45e9 | 2017-04-11 11:30:44 +0530 | [diff] [blame] | 177 | std::vector<uint8_t> openSession(const std::vector<uint8_t>& inPayload, |
Vernon Mauery | 41ff9b5 | 2021-06-11 11:37:40 -0700 | [diff] [blame] | 178 | std::shared_ptr<message::Handler>& handler); |
Tom Joseph | 8e832ee | 2016-12-06 17:47:08 +0530 | [diff] [blame] | 179 | |
| 180 | } // namespace command |