Tom Joseph | 8e832ee | 2016-12-06 17:47:08 +0530 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include <vector> |
| 4 | |
| 5 | #include "message_handler.hpp" |
| 6 | |
| 7 | namespace command |
| 8 | { |
| 9 | |
| 10 | /* |
| 11 | * @ struct OpenSessionRequest |
| 12 | * |
| 13 | * IPMI Payload for RMCP+ Open Session Request |
| 14 | */ |
| 15 | struct OpenSessionRequest |
| 16 | { |
| 17 | uint8_t messageTag; // Message tag from request buffer |
| 18 | |
| 19 | #if BYTE_ORDER == LITTLE_ENDIAN |
| 20 | uint8_t maxPrivLevel : 4 ;// Requested maximum privilege level |
| 21 | uint8_t reserved1 : 4; // Reserved for future definition |
| 22 | #endif |
| 23 | |
| 24 | #if BYTE_ORDER == BIG_ENDIAN |
| 25 | uint8_t reserved1 : 4; // Reserved for future definition |
| 26 | uint8_t maxPrivLevel : 4 ;// Requested maximum privilege level |
| 27 | |
| 28 | #endif |
| 29 | |
| 30 | uint16_t reserved2; |
| 31 | uint32_t remoteConsoleSessionID ; |
| 32 | |
| 33 | uint8_t authPayload ; |
| 34 | uint16_t reserved3; |
| 35 | uint8_t authPayloadLen; |
| 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; |
| 52 | uint8_t intPayloadLen; |
| 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; |
| 69 | uint8_t confPayloadLen; |
| 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 | |
| 85 | /* |
| 86 | * @ struct OpenSessionResponse |
| 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; |
| 128 | uint8_t intPayloadLen; |
| 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; |
| 146 | uint8_t confPayloadLen; |
| 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 | |
| 162 | /* |
| 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 | */ |
| 177 | std::vector<uint8_t> openSession(std::vector<uint8_t>& inPayload, |
| 178 | const message::Handler& handler); |
| 179 | |
| 180 | } // namespace command |