blob: ed6ca925fea94c6464017d1824ab208ba16657e2 [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 */
111std::vector<uint8_t> activatePayload(std::vector<uint8_t>& inPayload,
112 const message::Handler& handler);
113
114} // namespace command
115
116} // namespace sol