blob: f916c1142eeb9b4d17d6bde862e51c4238f7e164 [file] [log] [blame]
Tom Joseph5c846a82017-04-03 01:59:39 +05301#pragma once
2
Tom Joseph5c846a82017-04-03 01:59:39 +05303#include "message_handler.hpp"
4
Vernon Mauery9e801a22018-10-12 13:20:49 -07005#include <vector>
6
Tom Joseph5c846a82017-04-03 01:59:39 +05307namespace sol
8{
9
10namespace command
11{
12
13constexpr uint8_t IPMI_CC_PAYLOAD_ALREADY_ACTIVE = 0x80;
14constexpr uint8_t IPMI_CC_PAYLOAD_TYPE_DISABLED = 0x81;
15constexpr uint8_t IPMI_CC_PAYLOAD_ACTIVATION_LIMIT = 0x82;
16constexpr uint8_t IPMI_CC_PAYLOAD_WITH_ENCRYPTION = 0x83;
17constexpr uint8_t IPMI_CC_PAYLOAD_WITHOUT_ENCRYPTION = 0x84;
18
19/** @struct ActivatePayloadRequest
20 *
21 * IPMI payload for Activate Payload command request.
22 */
23struct ActivatePayloadRequest
24{
25#if BYTE_ORDER == LITTLE_ENDIAN
Vernon Mauery9e801a22018-10-12 13:20:49 -070026 uint8_t payloadType : 6; //!< Payload type.
27 uint8_t reserved1 : 2; //!< Reserved.
Tom Joseph5c846a82017-04-03 01:59:39 +053028#endif
29
30#if BYTE_ORDER == BIG_ENDIAN
Vernon Mauery9e801a22018-10-12 13:20:49 -070031 uint8_t reserved1 : 2; //!< Payload type.
32 uint8_t payloadType : 6; //!< Payload type.
Tom Joseph5c846a82017-04-03 01:59:39 +053033#endif
34
35#if BYTE_ORDER == LITTLE_ENDIAN
Vernon Mauery9e801a22018-10-12 13:20:49 -070036 uint8_t payloadInstance : 4; //!< Payload instance.
37 uint8_t reserved2 : 4; //!< Reserved.
Tom Joseph5c846a82017-04-03 01:59:39 +053038#endif
39
40#if BYTE_ORDER == BIG_ENDIAN
Vernon Mauery9e801a22018-10-12 13:20:49 -070041 uint8_t reserved2 : 4; //!< Reserved.
42 uint8_t payloadInstance : 4; //!< Payload instance.
Tom Joseph5c846a82017-04-03 01:59:39 +053043#endif
44
45 /** @brief The following Auxiliary Request Data applies only for payload
46 * SOL only.
47 */
48#if BYTE_ORDER == LITTLE_ENDIAN
49 uint8_t reserved4 : 1; //!< Reserved.
50 uint8_t handshake : 1; //!< SOL startup handshake.
51 uint8_t alert : 2; //!< Shared serial alert behavior.
52 uint8_t reserved3 : 1; //!< Reserved.
53 uint8_t testMode : 1; //!< Test mode.
54 uint8_t auth : 1; //!< If true, activate payload with authentication.
55 uint8_t encryption : 1; //!< If true, activate payload with encryption.
56#endif
57
58#if BYTE_ORDER == BIG_ENDIAN
59 uint8_t encryption : 1; //!< If true, activate payload with encryption.
60 uint8_t auth : 1; //!< If true, activate payload with authentication.
61 uint8_t testMode : 1; //!< Test mode.
62 uint8_t reserved3 : 1; //!< Reserved.
63 uint8_t alert : 2; //!< Shared serial alert behavior.
64 uint8_t handshake : 1; //!< SOL startup handshake.
65 uint8_t reserved4 : 1; //!< Reserved.
66#endif
67
Vernon Mauery9e801a22018-10-12 13:20:49 -070068 uint8_t reserved5; //!< Reserved.
69 uint8_t reserved6; //!< Reserved.
70 uint8_t reserved7; //!< Reserved.
Tom Joseph5c846a82017-04-03 01:59:39 +053071} __attribute__((packed));
72
73/** @struct ActivatePayloadResponse
74 *
75 * IPMI payload for Activate Payload command response.
76 */
77struct ActivatePayloadResponse
78{
Vernon Mauery9e801a22018-10-12 13:20:49 -070079 uint8_t completionCode; //!< Completion code.
80 uint8_t reserved1; //!< Reserved.
81 uint8_t reserved2; //!< Reserved.
82 uint8_t reserved3; //!< Reserved.
Tom Joseph5c846a82017-04-03 01:59:39 +053083
84 // Test Mode
85#if BYTE_ORDER == LITTLE_ENDIAN
Vernon Mauery9e801a22018-10-12 13:20:49 -070086 uint8_t testMode : 1; //!< Test mode.
87 uint8_t reserved4 : 7; //!< Reserved.
Tom Joseph5c846a82017-04-03 01:59:39 +053088#endif
89
90#if BYTE_ORDER == BIG_ENDIAN
Vernon Mauery9e801a22018-10-12 13:20:49 -070091 uint8_t reserved4 : 7; //!< Reserved.
92 uint8_t testMode : 1; //!< Test mode.
Tom Joseph5c846a82017-04-03 01:59:39 +053093#endif
94
Vernon Mauery9e801a22018-10-12 13:20:49 -070095 uint16_t inPayloadSize; //!< Inbound payload size
96 uint16_t outPayloadSize; //!< Outbound payload size.
97 uint16_t portNum; //!< Payload UDP port number.
98 uint16_t vlanNum; //!< Payload VLAN number.
Tom Joseph5c846a82017-04-03 01:59:39 +053099} __attribute__((packed));
100
101/** @brief Activate Payload Command.
102 *
103 * This command is used for activating and deactivating a payload type under a
104 * given IPMI session. The UDP Port number for SOL is the same as the port that
105 * was used to establish the IPMI session.
106 *
107 * @param[in] inPayload - Request data for the command.
108 * @param[in] handler - Reference to the message handler.
109 *
110 * @return Response data for the command
111 */
Tom Joseph18a45e92017-04-11 11:30:44 +0530112std::vector<uint8_t> activatePayload(const std::vector<uint8_t>& inPayload,
Tom Joseph5c846a82017-04-03 01:59:39 +0530113 const message::Handler& handler);
114
Tom Josephe2f0a8e2017-04-03 02:01:49 +0530115constexpr uint8_t IPMI_CC_PAYLOAD_DEACTIVATED = 0x80;
116
117/** @struct DeactivatePayloadRequest
118 *
119 * IPMI payload for Deactivate Payload command request.
120 */
121struct DeactivatePayloadRequest
122{
123#if BYTE_ORDER == LITTLE_ENDIAN
Vernon Mauery9e801a22018-10-12 13:20:49 -0700124 uint8_t payloadType : 6; //!< Payload type.
125 uint8_t reserved1 : 2; //!< Reserved.
Tom Josephe2f0a8e2017-04-03 02:01:49 +0530126#endif
127
128#if BYTE_ORDER == BIG_ENDIAN
Vernon Mauery9e801a22018-10-12 13:20:49 -0700129 uint8_t reserved1 : 2; //!< Payload type.
130 uint8_t payloadType : 6; //!< Reserved.
Tom Josephe2f0a8e2017-04-03 02:01:49 +0530131#endif
132
133#if BYTE_ORDER == LITTLE_ENDIAN
Vernon Mauery9e801a22018-10-12 13:20:49 -0700134 uint8_t payloadInstance : 4; //!< Payload instance.
135 uint8_t reserved2 : 4; //!< Reserved.
Tom Josephe2f0a8e2017-04-03 02:01:49 +0530136#endif
137
138#if BYTE_ORDER == BIG_ENDIAN
Vernon Mauery9e801a22018-10-12 13:20:49 -0700139 uint8_t reserved2 : 4; //!< Reserved.
140 uint8_t payloadInstance : 4; //!< Payload instance.
Tom Josephe2f0a8e2017-04-03 02:01:49 +0530141#endif
142
143 /** @brief No auxiliary data for payload type SOL */
Vernon Mauery9e801a22018-10-12 13:20:49 -0700144 uint8_t auxData1; //!< Auxiliary data 1
145 uint8_t auxData2; //!< Auxiliary data 2
146 uint8_t auxData3; //!< Auxiliary data 3
Tom Josephe2f0a8e2017-04-03 02:01:49 +0530147} __attribute__((packed));
148
149/** @struct DeactivatePayloadResponse
150 *
151 * IPMI payload for Deactivate Payload Command response.
152 */
153struct DeactivatePayloadResponse
154{
Vernon Mauery9e801a22018-10-12 13:20:49 -0700155 uint8_t completionCode; //!< Completion code
Tom Josephe2f0a8e2017-04-03 02:01:49 +0530156} __attribute__((packed));
157
158/** @brief Deactivate Payload Command.
159 *
160 * This command is used to terminate use of a given payload on an IPMI session.
161 * This type of traffic then becomes freed for activation by another session,
162 * or for possible re-activation under the present session.The Deactivate
163 * Payload command does not cause the session to be terminated. The Close
164 * Session command should be used for that purpose. A remote console
165 * terminating a application does not need to explicitly deactivate payload(s)
166 * prior to session. When a session terminates all payloads that were active
167 * under that session are automatically deactivated by the BMC.
168 *
169 * @param[in] inPayload - Request data for the command.
170 * @param[in] handler - Reference to the message handler.
171 *
172 * @return Response data for the command.
173 */
Tom Joseph18a45e92017-04-11 11:30:44 +0530174std::vector<uint8_t> deactivatePayload(const std::vector<uint8_t>& inPayload,
Tom Josephe2f0a8e2017-04-03 02:01:49 +0530175 const message::Handler& handler);
176
Tom Josephe1ae56c2017-04-03 02:03:41 +0530177/** @struct GetPayloadStatusRequest
178 *
179 * IPMI payload for Get Payload Activation Status command request.
180 */
181struct GetPayloadStatusRequest
182{
Vernon Mauery9e801a22018-10-12 13:20:49 -0700183 uint8_t payloadType; //!< Payload type
Tom Josephe1ae56c2017-04-03 02:03:41 +0530184} __attribute__((packed));
185
186/** @struct GetPayloadStatusResponse
187 *
188 * IPMI payload for Get Payload Activation Status command response.
189 */
190struct GetPayloadStatusResponse
191{
192 uint8_t completionCode; //!< Completion code.
193
Vernon Mauery9e801a22018-10-12 13:20:49 -0700194 uint8_t capacity; //!< Instance capacity.
Tom Josephe1ae56c2017-04-03 02:03:41 +0530195
196 /* @brief Activation Status. */
197#if BYTE_ORDER == LITTLE_ENDIAN
Vernon Mauery9e801a22018-10-12 13:20:49 -0700198 uint8_t instance1 : 1; //!< If true, Instance 1 is activated.
199 uint8_t instance2 : 1; //!< If true, Instance 2 is activated.
200 uint8_t instance3 : 1; //!< If true, Instance 3 is activated.
201 uint8_t instance4 : 1; //!< If true, Instance 4 is activated.
202 uint8_t instance5 : 1; //!< If true, Instance 5 is activated.
203 uint8_t instance6 : 1; //!< If true, Instance 6 is activated.
204 uint8_t instance7 : 1; //!< If true, Instance 7 is activated.
205 uint8_t instance8 : 1; //!< If true, Instance 8 is activated.
Tom Josephe1ae56c2017-04-03 02:03:41 +0530206#endif
207
208#if BYTE_ORDER == BIG_ENDIAN
Vernon Mauery9e801a22018-10-12 13:20:49 -0700209 uint8_t instance8 : 1; //!< If true, Instance 8 is activated.
210 uint8_t instance7 : 1; //!< If true, Instance 7 is activated.
211 uint8_t instance6 : 1; //!< If true, Instance 6 is activated.
212 uint8_t instance5 : 1; //!< If true, Instance 5 is activated.
213 uint8_t instance4 : 1; //!< If true, Instance 4 is activated.
214 uint8_t instance3 : 1; //!< If true, Instance 3 is activated.
215 uint8_t instance2 : 1; //!< If true, Instance 2 is activated.
216 uint8_t instance1 : 1; //!< If true, Instance 1 is activated.
Tom Josephe1ae56c2017-04-03 02:03:41 +0530217#endif
218
219#if BYTE_ORDER == LITTLE_ENDIAN
Vernon Mauery9e801a22018-10-12 13:20:49 -0700220 uint8_t instance9 : 1; //!< If true, Instance 9 is activated.
Tom Josephe1ae56c2017-04-03 02:03:41 +0530221 uint8_t instance10 : 1; //!< If true, Instance 10 is activated.
222 uint8_t instance11 : 1; //!< If true, Instance 11 is activated.
223 uint8_t instance12 : 1; //!< If true, Instance 12 is activated.
224 uint8_t instance13 : 1; //!< If true, Instance 13 is activated.
225 uint8_t instance14 : 1; //!< If true, Instance 14 is activated.
226 uint8_t instance15 : 1; //!< If true, Instance 15 is activated.
227 uint8_t instance16 : 1; //!< If true, Instance 16 is activated.
228#endif
229
230#if BYTE_ORDER == BIG_ENDIAN
231 uint8_t instance16 : 1; //!< If true, Instance 16 is activated.
232 uint8_t instance15 : 1; //!< If true, Instance 15 is activated.
233 uint8_t instance14 : 1; //!< If true, Instance 14 is activated.
234 uint8_t instance13 : 1; //!< If true, Instance 13 is activated.
235 uint8_t instance12 : 1; //!< If true, Instance 12 is activated.
236 uint8_t instance11 : 1; //!< If true, Instance 11 is activated.
237 uint8_t instance10 : 1; //!< If true, Instance 10 is activated.
Vernon Mauery9e801a22018-10-12 13:20:49 -0700238 uint8_t instance9 : 1; //!< If true, Instance 9 is activated.
Tom Josephe1ae56c2017-04-03 02:03:41 +0530239#endif
240} __attribute__((packed));
241
242/** @brief Get Payload Activation Status Command.
243 *
244 * This command returns how many instances of a given payload type are
245 * presently activated, and how many total instances can be activated.
246 *
247 * @param[in] inPayload - Request Data for the command.
248 * @param[in] handler - Reference to the Message Handler.
249 *
250 * @return Response data for the command
251 */
Tom Joseph18a45e92017-04-11 11:30:44 +0530252std::vector<uint8_t> getPayloadStatus(const std::vector<uint8_t>& inPayload,
Tom Josephe1ae56c2017-04-03 02:03:41 +0530253 const message::Handler& handler);
254
Tom Joseph80938492018-03-22 10:05:20 +0530255/** @struct GetPayloadInfoRequest
256 *
257 * IPMI payload for Get Payload Instance info command request.
258 */
259struct GetPayloadInfoRequest
260{
Vernon Mauery9e801a22018-10-12 13:20:49 -0700261 uint8_t payloadType; //!< Payload type
262 uint8_t payloadInstance; //!< Payload instance
Tom Joseph80938492018-03-22 10:05:20 +0530263} __attribute__((packed));
264
265/** @struct GetPayloadInfoResponse
266 *
267 * IPMI payload for Get Payload Instance info command response.
268 */
269struct GetPayloadInfoResponse
270{
271 uint8_t completionCode; //!< Completion code.
272 uint32_t sessionID; //!< Session ID
273 uint8_t portNumber; //!< Port number
274 uint8_t reserved[7]; //!< Reserved
275} __attribute__((packed));
276
277/** @brief Get Payload Instance Info Command.
278 *
279 * This command returns information about a specific instance of a payload
280 * type. Session ID is returned by this command
281 *
282 * @param[in] inPayload - Request Data for the command.
283 * @param[in] handler - Reference to the Message Handler.
284 *
285 * @return Response data for the command
286 */
287std::vector<uint8_t> getPayloadInfo(const std::vector<uint8_t>& inPayload,
288 const message::Handler& handler);
289
Tom Joseph5c846a82017-04-03 01:59:39 +0530290} // namespace command
291
292} // namespace sol