Tom Joseph | 4a8f34d | 2016-12-06 17:07:46 +0530 | [diff] [blame] | 1 | #include "channel_auth.hpp" |
| 2 | |
Tom Joseph | 4a8f34d | 2016-12-06 17:07:46 +0530 | [diff] [blame] | 3 | #include <host-ipmid/ipmid-api.h> |
| 4 | |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 5 | #include <iostream> |
| 6 | |
Tom Joseph | 4a8f34d | 2016-12-06 17:07:46 +0530 | [diff] [blame] | 7 | namespace command |
| 8 | { |
| 9 | |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 10 | std::vector<uint8_t> |
| 11 | GetChannelCapabilities(const std::vector<uint8_t>& inPayload, |
| 12 | const message::Handler& handler) |
Tom Joseph | 4a8f34d | 2016-12-06 17:07:46 +0530 | [diff] [blame] | 13 | { |
Tom Joseph | 4a8f34d | 2016-12-06 17:07:46 +0530 | [diff] [blame] | 14 | std::vector<uint8_t> outPayload(sizeof(GetChannelCapabilitiesResp)); |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 15 | auto response = |
| 16 | reinterpret_cast<GetChannelCapabilitiesResp*>(outPayload.data()); |
Tom Joseph | 4a8f34d | 2016-12-06 17:07:46 +0530 | [diff] [blame] | 17 | |
| 18 | // A canned response, since there is no user and channel management. |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 19 | response->completionCode = IPMI_CC_OK; |
Tom Joseph | 4a8f34d | 2016-12-06 17:07:46 +0530 | [diff] [blame] | 20 | |
Gunnar Mills | 541aee7 | 2017-10-25 14:47:10 -0500 | [diff] [blame] | 21 | // Channel Number 1 is arbitrarily applied to primary LAN channel; |
Tom Joseph | 4a8f34d | 2016-12-06 17:07:46 +0530 | [diff] [blame] | 22 | response->channelNumber = 1; |
| 23 | |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 24 | response->ipmiVersion = 1; // IPMI v2.0 extended capabilities available. |
Tom Joseph | 4a8f34d | 2016-12-06 17:07:46 +0530 | [diff] [blame] | 25 | response->reserved1 = 0; |
| 26 | response->oem = 0; |
| 27 | response->straightKey = 0; |
| 28 | response->reserved2 = 0; |
| 29 | response->md5 = 0; |
| 30 | response->md2 = 0; |
| 31 | |
Tom Joseph | 4a8f34d | 2016-12-06 17:07:46 +0530 | [diff] [blame] | 32 | response->reserved3 = 0; |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 33 | response->KGStatus = 0; // KG is set to default |
| 34 | response->perMessageAuth = 0; // Per-message Authentication is enabled |
| 35 | response->userAuth = 0; // User Level Authentication is enabled |
| 36 | response->nonNullUsers = 1; // Non-null usernames enabled |
| 37 | response->nullUsers = 1; // Null usernames enabled |
| 38 | response->anonymousLogin = 0; // Anonymous Login disabled |
Tom Joseph | 4a8f34d | 2016-12-06 17:07:46 +0530 | [diff] [blame] | 39 | |
| 40 | response->reserved4 = 0; |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 41 | response->extCapabilities = 0x2; // Channel supports IPMI v2.0 connections |
Tom Joseph | 4a8f34d | 2016-12-06 17:07:46 +0530 | [diff] [blame] | 42 | |
| 43 | response->oemID[0] = 0; |
| 44 | response->oemID[1] = 0; |
| 45 | response->oemID[2] = 0; |
| 46 | response->oemAuxillary = 0; |
Tom Joseph | 4a8f34d | 2016-12-06 17:07:46 +0530 | [diff] [blame] | 47 | return outPayload; |
| 48 | } |
| 49 | |
| 50 | } // namespace command |