blob: 700c78421894b68501c660034b4a60c512b9d243 [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
Vernon Mauery9e801a22018-10-12 13:20:49 -070020 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
Vernon Mauery9e801a22018-10-12 13:20:49 -070025 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
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 Mauery9e801a22018-10-12 13:20:49 -070052 uint8_t intPayloadLen;
Tom Joseph8e832ee2016-12-06 17:47:08 +053053
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 Mauery9e801a22018-10-12 13:20:49 -070069 uint8_t confPayloadLen;
Tom Joseph8e832ee2016-12-06 17:47:08 +053070
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 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
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 Mauery9e801a22018-10-12 13:20:49 -0700128 uint8_t intPayloadLen;
Tom Joseph8e832ee2016-12-06 17:47:08 +0530129
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 Mauery9e801a22018-10-12 13:20:49 -0700146 uint8_t confPayloadLen;
Tom Joseph8e832ee2016-12-06 17:47:08 +0530147
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 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,
Tom Joseph8e832ee2016-12-06 17:47:08 +0530178 const message::Handler& handler);
179
180} // namespace command