Tom Joseph | 5c846a8 | 2017-04-03 01:59:39 +0530 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Tom Joseph | 5c846a8 | 2017-04-03 01:59:39 +0530 | [diff] [blame] | 3 | #include "message_handler.hpp" |
| 4 | |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 5 | #include <vector> |
| 6 | |
Tom Joseph | 5c846a8 | 2017-04-03 01:59:39 +0530 | [diff] [blame] | 7 | namespace sol |
| 8 | { |
| 9 | |
| 10 | namespace command |
| 11 | { |
| 12 | |
| 13 | constexpr uint8_t IPMI_CC_PAYLOAD_ALREADY_ACTIVE = 0x80; |
| 14 | constexpr uint8_t IPMI_CC_PAYLOAD_TYPE_DISABLED = 0x81; |
| 15 | constexpr uint8_t IPMI_CC_PAYLOAD_ACTIVATION_LIMIT = 0x82; |
| 16 | constexpr uint8_t IPMI_CC_PAYLOAD_WITH_ENCRYPTION = 0x83; |
| 17 | constexpr uint8_t IPMI_CC_PAYLOAD_WITHOUT_ENCRYPTION = 0x84; |
| 18 | |
| 19 | /** @struct ActivatePayloadRequest |
| 20 | * |
| 21 | * IPMI payload for Activate Payload command request. |
| 22 | */ |
| 23 | struct ActivatePayloadRequest |
| 24 | { |
| 25 | #if BYTE_ORDER == LITTLE_ENDIAN |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 26 | uint8_t payloadType : 6; //!< Payload type. |
| 27 | uint8_t reserved1 : 2; //!< Reserved. |
Tom Joseph | 5c846a8 | 2017-04-03 01:59:39 +0530 | [diff] [blame] | 28 | #endif |
| 29 | |
| 30 | #if BYTE_ORDER == BIG_ENDIAN |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 31 | uint8_t reserved1 : 2; //!< Payload type. |
| 32 | uint8_t payloadType : 6; //!< Payload type. |
Tom Joseph | 5c846a8 | 2017-04-03 01:59:39 +0530 | [diff] [blame] | 33 | #endif |
| 34 | |
| 35 | #if BYTE_ORDER == LITTLE_ENDIAN |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 36 | uint8_t payloadInstance : 4; //!< Payload instance. |
| 37 | uint8_t reserved2 : 4; //!< Reserved. |
Tom Joseph | 5c846a8 | 2017-04-03 01:59:39 +0530 | [diff] [blame] | 38 | #endif |
| 39 | |
| 40 | #if BYTE_ORDER == BIG_ENDIAN |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 41 | uint8_t reserved2 : 4; //!< Reserved. |
| 42 | uint8_t payloadInstance : 4; //!< Payload instance. |
Tom Joseph | 5c846a8 | 2017-04-03 01:59:39 +0530 | [diff] [blame] | 43 | #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 Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 68 | uint8_t reserved5; //!< Reserved. |
| 69 | uint8_t reserved6; //!< Reserved. |
| 70 | uint8_t reserved7; //!< Reserved. |
Tom Joseph | 5c846a8 | 2017-04-03 01:59:39 +0530 | [diff] [blame] | 71 | } __attribute__((packed)); |
| 72 | |
| 73 | /** @struct ActivatePayloadResponse |
| 74 | * |
| 75 | * IPMI payload for Activate Payload command response. |
| 76 | */ |
| 77 | struct ActivatePayloadResponse |
| 78 | { |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 79 | uint8_t completionCode; //!< Completion code. |
| 80 | uint8_t reserved1; //!< Reserved. |
| 81 | uint8_t reserved2; //!< Reserved. |
| 82 | uint8_t reserved3; //!< Reserved. |
Tom Joseph | 5c846a8 | 2017-04-03 01:59:39 +0530 | [diff] [blame] | 83 | |
| 84 | // Test Mode |
| 85 | #if BYTE_ORDER == LITTLE_ENDIAN |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 86 | uint8_t testMode : 1; //!< Test mode. |
| 87 | uint8_t reserved4 : 7; //!< Reserved. |
Tom Joseph | 5c846a8 | 2017-04-03 01:59:39 +0530 | [diff] [blame] | 88 | #endif |
| 89 | |
| 90 | #if BYTE_ORDER == BIG_ENDIAN |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 91 | uint8_t reserved4 : 7; //!< Reserved. |
| 92 | uint8_t testMode : 1; //!< Test mode. |
Tom Joseph | 5c846a8 | 2017-04-03 01:59:39 +0530 | [diff] [blame] | 93 | #endif |
| 94 | |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 95 | 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 Joseph | 5c846a8 | 2017-04-03 01:59:39 +0530 | [diff] [blame] | 99 | } __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 | */ |
Vernon Mauery | 41ff9b5 | 2021-06-11 11:37:40 -0700 | [diff] [blame^] | 112 | std::vector<uint8_t> |
| 113 | activatePayload(const std::vector<uint8_t>& inPayload, |
| 114 | std::shared_ptr<message::Handler>& handler); |
Tom Joseph | 5c846a8 | 2017-04-03 01:59:39 +0530 | [diff] [blame] | 115 | |
Tom Joseph | e2f0a8e | 2017-04-03 02:01:49 +0530 | [diff] [blame] | 116 | constexpr uint8_t IPMI_CC_PAYLOAD_DEACTIVATED = 0x80; |
| 117 | |
| 118 | /** @struct DeactivatePayloadRequest |
| 119 | * |
| 120 | * IPMI payload for Deactivate Payload command request. |
| 121 | */ |
| 122 | struct DeactivatePayloadRequest |
| 123 | { |
| 124 | #if BYTE_ORDER == LITTLE_ENDIAN |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 125 | uint8_t payloadType : 6; //!< Payload type. |
| 126 | uint8_t reserved1 : 2; //!< Reserved. |
Tom Joseph | e2f0a8e | 2017-04-03 02:01:49 +0530 | [diff] [blame] | 127 | #endif |
| 128 | |
| 129 | #if BYTE_ORDER == BIG_ENDIAN |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 130 | uint8_t reserved1 : 2; //!< Payload type. |
| 131 | uint8_t payloadType : 6; //!< Reserved. |
Tom Joseph | e2f0a8e | 2017-04-03 02:01:49 +0530 | [diff] [blame] | 132 | #endif |
| 133 | |
| 134 | #if BYTE_ORDER == LITTLE_ENDIAN |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 135 | uint8_t payloadInstance : 4; //!< Payload instance. |
| 136 | uint8_t reserved2 : 4; //!< Reserved. |
Tom Joseph | e2f0a8e | 2017-04-03 02:01:49 +0530 | [diff] [blame] | 137 | #endif |
| 138 | |
| 139 | #if BYTE_ORDER == BIG_ENDIAN |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 140 | uint8_t reserved2 : 4; //!< Reserved. |
| 141 | uint8_t payloadInstance : 4; //!< Payload instance. |
Tom Joseph | e2f0a8e | 2017-04-03 02:01:49 +0530 | [diff] [blame] | 142 | #endif |
| 143 | |
| 144 | /** @brief No auxiliary data for payload type SOL */ |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 145 | uint8_t auxData1; //!< Auxiliary data 1 |
| 146 | uint8_t auxData2; //!< Auxiliary data 2 |
| 147 | uint8_t auxData3; //!< Auxiliary data 3 |
Sumanth Bhat | b9631f8 | 2019-03-07 11:51:53 +0530 | [diff] [blame] | 148 | uint8_t auxData4; //!< Auxiliary data 4 |
Tom Joseph | e2f0a8e | 2017-04-03 02:01:49 +0530 | [diff] [blame] | 149 | } __attribute__((packed)); |
| 150 | |
| 151 | /** @struct DeactivatePayloadResponse |
| 152 | * |
| 153 | * IPMI payload for Deactivate Payload Command response. |
| 154 | */ |
| 155 | struct DeactivatePayloadResponse |
| 156 | { |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 157 | uint8_t completionCode; //!< Completion code |
Tom Joseph | e2f0a8e | 2017-04-03 02:01:49 +0530 | [diff] [blame] | 158 | } __attribute__((packed)); |
| 159 | |
| 160 | /** @brief Deactivate Payload Command. |
| 161 | * |
| 162 | * This command is used to terminate use of a given payload on an IPMI session. |
| 163 | * This type of traffic then becomes freed for activation by another session, |
| 164 | * or for possible re-activation under the present session.The Deactivate |
| 165 | * Payload command does not cause the session to be terminated. The Close |
| 166 | * Session command should be used for that purpose. A remote console |
| 167 | * terminating a application does not need to explicitly deactivate payload(s) |
| 168 | * prior to session. When a session terminates all payloads that were active |
| 169 | * under that session are automatically deactivated by the BMC. |
| 170 | * |
| 171 | * @param[in] inPayload - Request data for the command. |
| 172 | * @param[in] handler - Reference to the message handler. |
| 173 | * |
| 174 | * @return Response data for the command. |
| 175 | */ |
Vernon Mauery | 41ff9b5 | 2021-06-11 11:37:40 -0700 | [diff] [blame^] | 176 | std::vector<uint8_t> |
| 177 | deactivatePayload(const std::vector<uint8_t>& inPayload, |
| 178 | std::shared_ptr<message::Handler>& handler); |
Tom Joseph | e2f0a8e | 2017-04-03 02:01:49 +0530 | [diff] [blame] | 179 | |
Tom Joseph | e1ae56c | 2017-04-03 02:03:41 +0530 | [diff] [blame] | 180 | /** @struct GetPayloadStatusRequest |
| 181 | * |
| 182 | * IPMI payload for Get Payload Activation Status command request. |
| 183 | */ |
| 184 | struct GetPayloadStatusRequest |
| 185 | { |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 186 | uint8_t payloadType; //!< Payload type |
Tom Joseph | e1ae56c | 2017-04-03 02:03:41 +0530 | [diff] [blame] | 187 | } __attribute__((packed)); |
| 188 | |
| 189 | /** @struct GetPayloadStatusResponse |
| 190 | * |
| 191 | * IPMI payload for Get Payload Activation Status command response. |
| 192 | */ |
| 193 | struct GetPayloadStatusResponse |
| 194 | { |
| 195 | uint8_t completionCode; //!< Completion code. |
| 196 | |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 197 | uint8_t capacity; //!< Instance capacity. |
Tom Joseph | e1ae56c | 2017-04-03 02:03:41 +0530 | [diff] [blame] | 198 | |
| 199 | /* @brief Activation Status. */ |
| 200 | #if BYTE_ORDER == LITTLE_ENDIAN |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 201 | uint8_t instance1 : 1; //!< If true, Instance 1 is activated. |
| 202 | uint8_t instance2 : 1; //!< If true, Instance 2 is activated. |
| 203 | uint8_t instance3 : 1; //!< If true, Instance 3 is activated. |
| 204 | uint8_t instance4 : 1; //!< If true, Instance 4 is activated. |
| 205 | uint8_t instance5 : 1; //!< If true, Instance 5 is activated. |
| 206 | uint8_t instance6 : 1; //!< If true, Instance 6 is activated. |
| 207 | uint8_t instance7 : 1; //!< If true, Instance 7 is activated. |
| 208 | uint8_t instance8 : 1; //!< If true, Instance 8 is activated. |
Tom Joseph | e1ae56c | 2017-04-03 02:03:41 +0530 | [diff] [blame] | 209 | #endif |
| 210 | |
| 211 | #if BYTE_ORDER == BIG_ENDIAN |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 212 | uint8_t instance8 : 1; //!< If true, Instance 8 is activated. |
| 213 | uint8_t instance7 : 1; //!< If true, Instance 7 is activated. |
| 214 | uint8_t instance6 : 1; //!< If true, Instance 6 is activated. |
| 215 | uint8_t instance5 : 1; //!< If true, Instance 5 is activated. |
| 216 | uint8_t instance4 : 1; //!< If true, Instance 4 is activated. |
| 217 | uint8_t instance3 : 1; //!< If true, Instance 3 is activated. |
| 218 | uint8_t instance2 : 1; //!< If true, Instance 2 is activated. |
| 219 | uint8_t instance1 : 1; //!< If true, Instance 1 is activated. |
Tom Joseph | e1ae56c | 2017-04-03 02:03:41 +0530 | [diff] [blame] | 220 | #endif |
| 221 | |
| 222 | #if BYTE_ORDER == LITTLE_ENDIAN |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 223 | uint8_t instance9 : 1; //!< If true, Instance 9 is activated. |
Tom Joseph | e1ae56c | 2017-04-03 02:03:41 +0530 | [diff] [blame] | 224 | uint8_t instance10 : 1; //!< If true, Instance 10 is activated. |
| 225 | uint8_t instance11 : 1; //!< If true, Instance 11 is activated. |
| 226 | uint8_t instance12 : 1; //!< If true, Instance 12 is activated. |
| 227 | uint8_t instance13 : 1; //!< If true, Instance 13 is activated. |
| 228 | uint8_t instance14 : 1; //!< If true, Instance 14 is activated. |
| 229 | uint8_t instance15 : 1; //!< If true, Instance 15 is activated. |
| 230 | uint8_t instance16 : 1; //!< If true, Instance 16 is activated. |
| 231 | #endif |
| 232 | |
| 233 | #if BYTE_ORDER == BIG_ENDIAN |
| 234 | uint8_t instance16 : 1; //!< If true, Instance 16 is activated. |
| 235 | uint8_t instance15 : 1; //!< If true, Instance 15 is activated. |
| 236 | uint8_t instance14 : 1; //!< If true, Instance 14 is activated. |
| 237 | uint8_t instance13 : 1; //!< If true, Instance 13 is activated. |
| 238 | uint8_t instance12 : 1; //!< If true, Instance 12 is activated. |
| 239 | uint8_t instance11 : 1; //!< If true, Instance 11 is activated. |
| 240 | uint8_t instance10 : 1; //!< If true, Instance 10 is activated. |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 241 | uint8_t instance9 : 1; //!< If true, Instance 9 is activated. |
Tom Joseph | e1ae56c | 2017-04-03 02:03:41 +0530 | [diff] [blame] | 242 | #endif |
| 243 | } __attribute__((packed)); |
| 244 | |
| 245 | /** @brief Get Payload Activation Status Command. |
| 246 | * |
| 247 | * This command returns how many instances of a given payload type are |
| 248 | * presently activated, and how many total instances can be activated. |
| 249 | * |
| 250 | * @param[in] inPayload - Request Data for the command. |
| 251 | * @param[in] handler - Reference to the Message Handler. |
| 252 | * |
| 253 | * @return Response data for the command |
| 254 | */ |
Vernon Mauery | 41ff9b5 | 2021-06-11 11:37:40 -0700 | [diff] [blame^] | 255 | std::vector<uint8_t> |
| 256 | getPayloadStatus(const std::vector<uint8_t>& inPayload, |
| 257 | std::shared_ptr<message::Handler>& handler); |
Tom Joseph | e1ae56c | 2017-04-03 02:03:41 +0530 | [diff] [blame] | 258 | |
Tom Joseph | 8093849 | 2018-03-22 10:05:20 +0530 | [diff] [blame] | 259 | /** @struct GetPayloadInfoRequest |
| 260 | * |
| 261 | * IPMI payload for Get Payload Instance info command request. |
| 262 | */ |
| 263 | struct GetPayloadInfoRequest |
| 264 | { |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 265 | uint8_t payloadType; //!< Payload type |
| 266 | uint8_t payloadInstance; //!< Payload instance |
Tom Joseph | 8093849 | 2018-03-22 10:05:20 +0530 | [diff] [blame] | 267 | } __attribute__((packed)); |
| 268 | |
| 269 | /** @struct GetPayloadInfoResponse |
| 270 | * |
| 271 | * IPMI payload for Get Payload Instance info command response. |
| 272 | */ |
| 273 | struct GetPayloadInfoResponse |
| 274 | { |
| 275 | uint8_t completionCode; //!< Completion code. |
| 276 | uint32_t sessionID; //!< Session ID |
| 277 | uint8_t portNumber; //!< Port number |
| 278 | uint8_t reserved[7]; //!< Reserved |
| 279 | } __attribute__((packed)); |
| 280 | |
| 281 | /** @brief Get Payload Instance Info Command. |
| 282 | * |
| 283 | * This command returns information about a specific instance of a payload |
| 284 | * type. Session ID is returned by this command |
| 285 | * |
| 286 | * @param[in] inPayload - Request Data for the command. |
| 287 | * @param[in] handler - Reference to the Message Handler. |
| 288 | * |
| 289 | * @return Response data for the command |
| 290 | */ |
| 291 | std::vector<uint8_t> getPayloadInfo(const std::vector<uint8_t>& inPayload, |
Vernon Mauery | 41ff9b5 | 2021-06-11 11:37:40 -0700 | [diff] [blame^] | 292 | std::shared_ptr<message::Handler>& handler); |
Tom Joseph | 8093849 | 2018-03-22 10:05:20 +0530 | [diff] [blame] | 293 | |
Tom Joseph | 5c846a8 | 2017-04-03 01:59:39 +0530 | [diff] [blame] | 294 | } // namespace command |
| 295 | |
| 296 | } // namespace sol |