Tom Joseph | 4a8f34d | 2016-12-06 17:07:46 +0530 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Tom Joseph | 4a8f34d | 2016-12-06 17:07:46 +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 | 4a8f34d | 2016-12-06 17:07:46 +0530 | [diff] [blame] | 7 | namespace command |
| 8 | { |
| 9 | |
Tom Joseph | 3563f8f | 2017-05-08 15:42:54 +0530 | [diff] [blame] | 10 | /** |
| 11 | * @struct GetChannelCapabilitiesReq |
Tom Joseph | 4a8f34d | 2016-12-06 17:07:46 +0530 | [diff] [blame] | 12 | * |
| 13 | * IPMI Request data for Get Channel Authentication Capabilities command |
| 14 | */ |
| 15 | struct GetChannelCapabilitiesReq |
| 16 | { |
| 17 | uint8_t channelNumber; |
| 18 | uint8_t reqMaxPrivLevel; |
| 19 | } __attribute__((packed)); |
| 20 | |
Tom Joseph | 3563f8f | 2017-05-08 15:42:54 +0530 | [diff] [blame] | 21 | /** |
| 22 | * @struct GetChannelCapabilitiesResp |
Tom Joseph | 4a8f34d | 2016-12-06 17:07:46 +0530 | [diff] [blame] | 23 | * |
| 24 | * IPMI Response data for Get Channel Authentication Capabilities command |
| 25 | */ |
| 26 | struct GetChannelCapabilitiesResp |
| 27 | { |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 28 | uint8_t completionCode; // Completion Code |
Tom Joseph | 4a8f34d | 2016-12-06 17:07:46 +0530 | [diff] [blame] | 29 | |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 30 | uint8_t channelNumber; // Channel number that the request was |
Tom Joseph | 4a8f34d | 2016-12-06 17:07:46 +0530 | [diff] [blame] | 31 | // received on |
| 32 | |
| 33 | #if BYTE_ORDER == LITTLE_ENDIAN |
| 34 | uint8_t none : 1; |
| 35 | uint8_t md2 : 1; |
| 36 | uint8_t md5 : 1; |
| 37 | uint8_t reserved2 : 1; |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 38 | uint8_t straightKey : 1; // Straight password/key support |
Tom Joseph | 4a8f34d | 2016-12-06 17:07:46 +0530 | [diff] [blame] | 39 | // Support OEM identified by the IANA OEM ID in RMCP+ ping response |
| 40 | uint8_t oem : 1; |
| 41 | uint8_t reserved1 : 1; |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 42 | uint8_t ipmiVersion : 1; // 0b = IPMIV1.5 support only, 1B = IPMI V2.0 |
Tom Joseph | 4a8f34d | 2016-12-06 17:07:46 +0530 | [diff] [blame] | 43 | // support |
| 44 | #endif |
| 45 | |
| 46 | #if BYTE_ORDER == BIG_ENDIAN |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 47 | uint8_t ipmiVersion : 1; // 0b = IPMIV1.5 support only, 1B = IPMI V2.0 |
Tom Joseph | 4a8f34d | 2016-12-06 17:07:46 +0530 | [diff] [blame] | 48 | // support |
| 49 | uint8_t reserved1 : 1; |
| 50 | // Support OEM identified by the IANA OEM ID in RMCP+ ping response |
| 51 | uint8_t oem : 1; |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 52 | uint8_t straightKey : 1; // Straight password/key support |
Tom Joseph | 4a8f34d | 2016-12-06 17:07:46 +0530 | [diff] [blame] | 53 | uint8_t reserved2 : 1; |
| 54 | uint8_t md5 : 1; |
| 55 | uint8_t md2 : 1; |
| 56 | uint8_t none : 1; |
| 57 | #endif |
| 58 | |
| 59 | #if BYTE_ORDER == LITTLE_ENDIAN |
Tom Joseph | 4a8f34d | 2016-12-06 17:07:46 +0530 | [diff] [blame] | 60 | // Anonymous login status for anonymous login enabled/disabled |
| 61 | uint8_t anonymousLogin : 1; |
Tom Joseph | dc3e8b9 | 2019-02-09 20:21:33 +0530 | [diff] [blame] | 62 | // Anonymous login status for null usernames enabled/disabled |
| 63 | uint8_t nullUsers : 1; |
| 64 | // Anonymous login status for non-null usernames enabled/disabled |
| 65 | uint8_t nonNullUsers : 1; |
| 66 | uint8_t userAuth : 1; // User level authentication status |
| 67 | uint8_t perMessageAuth : 1; // Per-message authentication support |
| 68 | // Two key login status . only for IPMI V2.0 RMCP+ RAKP |
| 69 | uint8_t KGStatus : 1; |
Tom Joseph | 4a8f34d | 2016-12-06 17:07:46 +0530 | [diff] [blame] | 70 | uint8_t reserved3 : 2; |
| 71 | #endif |
| 72 | |
| 73 | #if BYTE_ORDER == BIG_ENDIAN |
| 74 | uint8_t reserved3 : 2; |
Tom Joseph | 4a8f34d | 2016-12-06 17:07:46 +0530 | [diff] [blame] | 75 | // Two key login status . only for IPMI V2.0 RMCP+ RAKP |
| 76 | uint8_t KGStatus : 1; |
Tom Joseph | dc3e8b9 | 2019-02-09 20:21:33 +0530 | [diff] [blame] | 77 | uint8_t perMessageAuth : 1; // Per-message authentication support |
| 78 | uint8_t userAuth : 1; // User level authentication status |
| 79 | // Anonymous login status for non-null usernames enabled/disabled |
| 80 | uint8_t nonNullUsers : 1; |
| 81 | // Anonymous login status for null usernames enabled/disabled |
| 82 | uint8_t nullUsers : 1; |
| 83 | // Anonymous login status for anonymous login enabled/disabled |
| 84 | uint8_t anonymousLogin : 1; |
Tom Joseph | 4a8f34d | 2016-12-06 17:07:46 +0530 | [diff] [blame] | 85 | #endif |
| 86 | |
| 87 | #if BYTE_ORDER == LITTLE_ENDIAN |
| 88 | // Extended capabilities will be present only if IPMI version is V2.0 |
| 89 | uint8_t extCapabilities : 2; // Channel support for IPMI V2.0 connections |
| 90 | uint8_t reserved4 : 6; |
| 91 | #endif |
| 92 | |
| 93 | #if BYTE_ORDER == BIG_ENDIAN |
| 94 | // Extended capabilities will be present only if IPMI version is V2.0 |
| 95 | uint8_t reserved4 : 6; |
| 96 | uint8_t extCapabilities : 2; // Channel support for IPMI V2.0 connections |
| 97 | #endif |
| 98 | |
| 99 | // Below 4 bytes will all the 0's if no OEM authentication type available. |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 100 | uint8_t oemID[3]; // IANA enterprise number for OEM/organization |
| 101 | uint8_t oemAuxillary; // Addition OEM specific information.. |
Tom Joseph | 4a8f34d | 2016-12-06 17:07:46 +0530 | [diff] [blame] | 102 | } __attribute__((packed)); |
| 103 | |
Tom Joseph | 3563f8f | 2017-05-08 15:42:54 +0530 | [diff] [blame] | 104 | /** |
Tom Joseph | 4a8f34d | 2016-12-06 17:07:46 +0530 | [diff] [blame] | 105 | * @brief Get Channel Authentication Capabilities |
| 106 | * |
| 107 | * This message exchange provides a way for a remote console to discover what |
| 108 | * IPMI version is supported i.e. whether or not the BMC supports the IPMI |
| 109 | * v2.0 / RMCP+ packet format. It also provides information that the remote |
| 110 | * console can use to determine whether anonymous, “one-key”, or “two-key” |
| 111 | * logins are used.This information can guide a remote console in how it |
| 112 | * presents queries to users for username and password information. This is a |
| 113 | * ‘session-less’ command that the BMC accepts in both IPMI v1.5 and v2.0/RMCP+ |
| 114 | * packet formats. |
| 115 | * |
| 116 | * @param[in] inPayload - Request Data for the command |
| 117 | * @param[in] handler - Reference to the Message Handler |
| 118 | * |
| 119 | * @return Response data for the command |
| 120 | */ |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 121 | std::vector<uint8_t> |
| 122 | GetChannelCapabilities(const std::vector<uint8_t>& inPayload, |
Vernon Mauery | 41ff9b5 | 2021-06-11 11:37:40 -0700 | [diff] [blame] | 123 | std::shared_ptr<message::Handler>& handler); |
Tom Joseph | 4a8f34d | 2016-12-06 17:07:46 +0530 | [diff] [blame] | 124 | |
Vernon Mauery | 60d6e4e | 2021-07-26 13:51:35 -0700 | [diff] [blame] | 125 | /** |
| 126 | * @brief Get Channel Cipher Suites |
| 127 | * |
| 128 | * This command is used to look up what authentication, integrity, and |
| 129 | * confidentiality algorithms are supported. The algorithms are used in |
| 130 | * combination as ‘Cipher Suites’. This command only applies to implementations |
| 131 | * that support IPMI v2.0/RMCP+ sessions. This command can be executed prior to |
| 132 | * establishing a session with the BMC. |
| 133 | * |
| 134 | * @param[in] inPayload - Request Data for the command |
| 135 | * @param[in] handler - Reference to the Message Handler |
| 136 | * |
| 137 | * @return Response data for the command |
| 138 | */ |
| 139 | std::vector<uint8_t> |
| 140 | getChannelCipherSuites(const std::vector<uint8_t>& inPayload, |
| 141 | std::shared_ptr<message::Handler>& handler); |
| 142 | |
Tom Joseph | 4a8f34d | 2016-12-06 17:07:46 +0530 | [diff] [blame] | 143 | } // namespace command |