Tom Joseph | 5c846a8 | 2017-04-03 01:59:39 +0530 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include <vector> |
| 4 | #include "message_handler.hpp" |
| 5 | |
| 6 | namespace sol |
| 7 | { |
| 8 | |
| 9 | namespace command |
| 10 | { |
| 11 | |
| 12 | constexpr uint8_t IPMI_CC_PAYLOAD_ALREADY_ACTIVE = 0x80; |
| 13 | constexpr uint8_t IPMI_CC_PAYLOAD_TYPE_DISABLED = 0x81; |
| 14 | constexpr uint8_t IPMI_CC_PAYLOAD_ACTIVATION_LIMIT = 0x82; |
| 15 | constexpr uint8_t IPMI_CC_PAYLOAD_WITH_ENCRYPTION = 0x83; |
| 16 | constexpr uint8_t IPMI_CC_PAYLOAD_WITHOUT_ENCRYPTION = 0x84; |
| 17 | |
| 18 | /** @struct ActivatePayloadRequest |
| 19 | * |
| 20 | * IPMI payload for Activate Payload command request. |
| 21 | */ |
| 22 | struct 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 | */ |
| 76 | struct 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 | */ |
| 111 | std::vector<uint8_t> activatePayload(std::vector<uint8_t>& inPayload, |
| 112 | const message::Handler& handler); |
| 113 | |
Tom Joseph | e2f0a8e | 2017-04-03 02:01:49 +0530 | [diff] [blame^] | 114 | constexpr uint8_t IPMI_CC_PAYLOAD_DEACTIVATED = 0x80; |
| 115 | |
| 116 | /** @struct DeactivatePayloadRequest |
| 117 | * |
| 118 | * IPMI payload for Deactivate Payload command request. |
| 119 | */ |
| 120 | struct 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 | */ |
| 152 | struct 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 | */ |
| 173 | std::vector<uint8_t> deactivatePayload(std::vector<uint8_t>& inPayload, |
| 174 | const message::Handler& handler); |
| 175 | |
Tom Joseph | 5c846a8 | 2017-04-03 01:59:39 +0530 | [diff] [blame] | 176 | } // namespace command |
| 177 | |
| 178 | } // namespace sol |