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