blob: 2e17bf342fa16b2910ddbf658a64c92a7d069104 [file] [log] [blame]
Tom Joseph8e832ee2016-12-06 17:47:08 +05301#pragma once
2
Tom Joseph8e832ee2016-12-06 17:47:08 +05303#include "message_handler.hpp"
4
Vernon Mauery9e801a22018-10-12 13:20:49 -07005#include <vector>
6
Tom Joseph8e832ee2016-12-06 17:47:08 +05307namespace command
8{
9
Tom Joseph3563f8f2017-05-08 15:42:54 +053010/**
11 * @struct OpenSessionRequest
Tom Joseph8e832ee2016-12-06 17:47:08 +053012 *
13 * IPMI Payload for RMCP+ Open Session Request
14 */
15struct OpenSessionRequest
16{
Vernon Mauery9e801a22018-10-12 13:20:49 -070017 uint8_t messageTag; // Message tag from request buffer
Tom Joseph8e832ee2016-12-06 17:47:08 +053018
19#if BYTE_ORDER == LITTLE_ENDIAN
Patrick Williams7b534092023-10-20 11:18:45 -050020 uint8_t maxPrivLevel:4; // Requested maximum privilege level
21 uint8_t reserved1:4; // Reserved for future definition
Tom Joseph8e832ee2016-12-06 17:47:08 +053022#endif
23
24#if BYTE_ORDER == BIG_ENDIAN
Patrick Williams7b534092023-10-20 11:18:45 -050025 uint8_t reserved1:4; // Reserved for future definition
26 uint8_t maxPrivLevel:4; // Requested maximum privilege level
Tom Joseph8e832ee2016-12-06 17:47:08 +053027
28#endif
29
30 uint16_t reserved2;
Vernon Mauery9e801a22018-10-12 13:20:49 -070031 uint32_t remoteConsoleSessionID;
Tom Joseph8e832ee2016-12-06 17:47:08 +053032
Vernon Mauery9e801a22018-10-12 13:20:49 -070033 uint8_t authPayload;
34 uint16_t reserved3;
35 uint8_t authPayloadLen;
Tom Joseph8e832ee2016-12-06 17:47:08 +053036
37#if BYTE_ORDER == LITTLE_ENDIAN
Patrick Williams7b534092023-10-20 11:18:45 -050038 uint8_t authAlgo:6;
39 uint8_t reserved4:2;
Tom Joseph8e832ee2016-12-06 17:47:08 +053040#endif
41
42#if BYTE_ORDER == BIG_ENDIAN
Patrick Williams7b534092023-10-20 11:18:45 -050043 uint8_t reserved4:2;
44 uint8_t authAlgo:6;
Tom Joseph8e832ee2016-12-06 17:47:08 +053045#endif
46
47 uint8_t reserved5;
48 uint16_t reserved6;
49
50 uint8_t intPayload;
51 uint16_t reserved7;
Vernon Mauery9e801a22018-10-12 13:20:49 -070052 uint8_t intPayloadLen;
Tom Joseph8e832ee2016-12-06 17:47:08 +053053
54#if BYTE_ORDER == LITTLE_ENDIAN
Patrick Williams7b534092023-10-20 11:18:45 -050055 uint8_t intAlgo:6;
56 uint8_t reserved8:2;
Tom Joseph8e832ee2016-12-06 17:47:08 +053057#endif
58
59#if BYTE_ORDER == BIG_ENDIAN
Patrick Williams7b534092023-10-20 11:18:45 -050060 uint8_t reserved8:2;
61 uint8_t intAlgo:6;
Tom Joseph8e832ee2016-12-06 17:47:08 +053062#endif
63
64 uint8_t reserved9;
65 uint16_t reserved10;
66
67 uint8_t confPayload;
68 uint16_t reserved11;
Vernon Mauery9e801a22018-10-12 13:20:49 -070069 uint8_t confPayloadLen;
Tom Joseph8e832ee2016-12-06 17:47:08 +053070
71#if BYTE_ORDER == LITTLE_ENDIAN
Patrick Williams7b534092023-10-20 11:18:45 -050072 uint8_t confAlgo:6;
73 uint8_t reserved12:2;
Tom Joseph8e832ee2016-12-06 17:47:08 +053074#endif
75
76#if BYTE_ORDER == BIG_ENDIAN
Patrick Williams7b534092023-10-20 11:18:45 -050077 uint8_t reserved12:2;
78 uint8_t confAlgo:6;
Tom Joseph8e832ee2016-12-06 17:47:08 +053079#endif
80
81 uint8_t reserved13;
82 uint16_t reserved14;
83} __attribute__((packed));
84
Tom Joseph3563f8f2017-05-08 15:42:54 +053085/**
86 * @struct OpenSessionResponse
Tom Joseph8e832ee2016-12-06 17:47:08 +053087 *
88 * IPMI Payload for RMCP+ Open Session Response
89 */
90struct OpenSessionResponse
91{
92 uint8_t messageTag;
93 uint8_t status_code;
94
95#if BYTE_ORDER == LITTLE_ENDIAN
Patrick Williams7b534092023-10-20 11:18:45 -050096 uint8_t maxPrivLevel:4;
97 uint8_t reserved1:4;
Tom Joseph8e832ee2016-12-06 17:47:08 +053098#endif
99
100#if BYTE_ORDER == BIG_ENDIAN
Patrick Williams7b534092023-10-20 11:18:45 -0500101 uint8_t reserved1:4;
102 uint8_t maxPrivLevel:4;
Tom Joseph8e832ee2016-12-06 17:47:08 +0530103#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
Patrick Williams7b534092023-10-20 11:18:45 -0500114 uint8_t authAlgo:6;
115 uint8_t reserved4:2;
Tom Joseph8e832ee2016-12-06 17:47:08 +0530116#endif
117
118#if BYTE_ORDER == BIG_ENDIAN
Patrick Williams7b534092023-10-20 11:18:45 -0500119 uint8_t reserved4:2;
120 uint8_t authAlgo:6;
Tom Joseph8e832ee2016-12-06 17:47:08 +0530121#endif
122
123 uint8_t reserved5;
124 uint16_t reserved6;
125
126 uint8_t intPayload;
127 uint16_t reserved7;
Vernon Mauery9e801a22018-10-12 13:20:49 -0700128 uint8_t intPayloadLen;
Tom Joseph8e832ee2016-12-06 17:47:08 +0530129
130#if BYTE_ORDER == LITTLE_ENDIAN
Patrick Williams7b534092023-10-20 11:18:45 -0500131 uint8_t intAlgo:6;
132 uint8_t reserved8:2;
Tom Joseph8e832ee2016-12-06 17:47:08 +0530133#endif
134
135#if BYTE_ORDER == BIG_ENDIAN
Patrick Williams7b534092023-10-20 11:18:45 -0500136 uint8_t reserved8:2;
137 uint8_t intAlgo:6;
Tom Joseph8e832ee2016-12-06 17:47:08 +0530138
139#endif
140
141 uint8_t reserved9;
142 uint16_t reserved10;
143
144 uint8_t confPayload;
145 uint16_t reserved11;
Vernon Mauery9e801a22018-10-12 13:20:49 -0700146 uint8_t confPayloadLen;
Tom Joseph8e832ee2016-12-06 17:47:08 +0530147
148#if BYTE_ORDER == LITTLE_ENDIAN
Patrick Williams7b534092023-10-20 11:18:45 -0500149 uint8_t confAlgo:6;
150 uint8_t reserved12:2;
Tom Joseph8e832ee2016-12-06 17:47:08 +0530151#endif
152
153#if BYTE_ORDER == BIG_ENDIAN
Patrick Williams7b534092023-10-20 11:18:45 -0500154 uint8_t reserved12:2;
155 uint8_t confAlgo:6;
Tom Joseph8e832ee2016-12-06 17:47:08 +0530156#endif
157
158 uint8_t reserved13;
159 uint16_t reserved14;
160} __attribute__((packed));
161
Tom Joseph3563f8f2017-05-08 15:42:54 +0530162/**
Tom Joseph8e832ee2016-12-06 17:47:08 +0530163 * @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 Joseph18a45e92017-04-11 11:30:44 +0530177std::vector<uint8_t> openSession(const std::vector<uint8_t>& inPayload,
Vernon Mauery41ff9b52021-06-11 11:37:40 -0700178 std::shared_ptr<message::Handler>& handler);
Tom Joseph8e832ee2016-12-06 17:47:08 +0530179
180} // namespace command