Tom Joseph | e088bf0 | 2017-04-03 02:07:06 +0530 | [diff] [blame] | 1 | #include "command/payload_cmds.hpp" |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 2 | #include "command/sol_cmds.hpp" |
Tom Joseph | e088bf0 | 2017-04-03 02:07:06 +0530 | [diff] [blame] | 3 | #include "command_table.hpp" |
| 4 | #include "main.hpp" |
| 5 | #include "session.hpp" |
| 6 | |
| 7 | namespace sol |
| 8 | { |
| 9 | |
| 10 | namespace command |
| 11 | { |
| 12 | |
| 13 | void registerCommands() |
| 14 | { |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 15 | static const ::command::CmdDetails commands[] = { |
Tom Joseph | e088bf0 | 2017-04-03 02:07:06 +0530 | [diff] [blame] | 16 | // SOL Payload Handler |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 17 | {{(static_cast<uint32_t>(message::PayloadType::SOL) << 16)}, |
| 18 | &payloadHandler, |
| 19 | session::Privilege::HIGHEST_MATCHING, |
| 20 | false}, |
Tom Joseph | e088bf0 | 2017-04-03 02:07:06 +0530 | [diff] [blame] | 21 | // Activate Payload Command |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 22 | {{(static_cast<uint32_t>(message::PayloadType::IPMI) << 16) | |
| 23 | static_cast<uint16_t>(::command::NetFns::APP) | 0x48}, |
| 24 | &activatePayload, |
| 25 | session::Privilege::USER, |
| 26 | false}, |
Tom Joseph | e088bf0 | 2017-04-03 02:07:06 +0530 | [diff] [blame] | 27 | // Deactivate Payload Command |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 28 | {{(static_cast<uint32_t>(message::PayloadType::IPMI) << 16) | |
| 29 | static_cast<uint16_t>(::command::NetFns::APP) | 0x49}, |
| 30 | &deactivatePayload, |
| 31 | session::Privilege::USER, |
| 32 | false}, |
Tom Joseph | e088bf0 | 2017-04-03 02:07:06 +0530 | [diff] [blame] | 33 | // Get Payload Activation Status |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 34 | {{(static_cast<uint32_t>(message::PayloadType::IPMI) << 16) | |
| 35 | static_cast<uint16_t>(::command::NetFns::APP) | 0x4A}, |
| 36 | &getPayloadStatus, |
| 37 | session::Privilege::USER, |
| 38 | false}, |
Tom Joseph | 8093849 | 2018-03-22 10:05:20 +0530 | [diff] [blame] | 39 | // Get Payload Instance Info Command |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 40 | {{(static_cast<uint32_t>(message::PayloadType::IPMI) << 16) | |
| 41 | static_cast<uint16_t>(::command::NetFns::APP) | 0x4B}, |
| 42 | &getPayloadInfo, |
| 43 | session::Privilege::USER, |
| 44 | false}, |
Tom Joseph | 15771d1 | 2017-04-28 01:34:53 +0530 | [diff] [blame] | 45 | // Set SOL Configuration Parameters |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 46 | {{(static_cast<uint32_t>(message::PayloadType::IPMI) << 16) | |
| 47 | static_cast<uint16_t>(::command::NetFns::TRANSPORT) | 0x21}, |
| 48 | &setConfParams, |
| 49 | session::Privilege::ADMIN, |
| 50 | false}, |
Tom Joseph | 15771d1 | 2017-04-28 01:34:53 +0530 | [diff] [blame] | 51 | // Get SOL Configuration Parameters |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 52 | {{(static_cast<uint32_t>(message::PayloadType::IPMI) << 16) | |
| 53 | static_cast<uint16_t>(::command::NetFns::TRANSPORT) | 0x22}, |
| 54 | &getConfParams, |
| 55 | session::Privilege::USER, |
| 56 | false}, |
Tom Joseph | e088bf0 | 2017-04-03 02:07:06 +0530 | [diff] [blame] | 57 | }; |
| 58 | |
| 59 | for (const auto& iter : commands) |
| 60 | { |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 61 | std::get<::command::Table&>(singletonPool) |
| 62 | .registerCommand(iter.command, |
| 63 | std::make_unique<::command::NetIpmidEntry>( |
| 64 | iter.command, iter.functor, iter.privilege, |
| 65 | iter.sessionless)); |
Tom Joseph | e088bf0 | 2017-04-03 02:07:06 +0530 | [diff] [blame] | 66 | } |
| 67 | } |
| 68 | |
| 69 | } // namespace command |
| 70 | |
| 71 | } // namespace sol |