Tom Joseph | d8be336 | 2016-12-06 17:54:13 +0530 | [diff] [blame] | 1 | #include "comm_module.hpp" |
| 2 | |
Tom Joseph | d8be336 | 2016-12-06 17:54:13 +0530 | [diff] [blame] | 3 | #include "command/channel_auth.hpp" |
| 4 | #include "command/open_session.hpp" |
| 5 | #include "command/rakp12.hpp" |
| 6 | #include "command/rakp34.hpp" |
| 7 | #include "command/session_cmds.hpp" |
| 8 | #include "command_table.hpp" |
Tom Joseph | d8be336 | 2016-12-06 17:54:13 +0530 | [diff] [blame] | 9 | #include "session.hpp" |
| 10 | |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 11 | #include <algorithm> |
| 12 | #include <cstring> |
| 13 | #include <iomanip> |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 14 | |
Tom Joseph | d8be336 | 2016-12-06 17:54:13 +0530 | [diff] [blame] | 15 | namespace command |
| 16 | { |
| 17 | |
| 18 | void sessionSetupCommands() |
| 19 | { |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 20 | static const command::CmdDetails commands[] = { |
Tom Joseph | d8be336 | 2016-12-06 17:54:13 +0530 | [diff] [blame] | 21 | // Open Session Request/Response |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 22 | {{(static_cast<uint32_t>(message::PayloadType::OPEN_SESSION_REQUEST) |
| 23 | << 16)}, |
| 24 | &openSession, |
| 25 | session::Privilege::HIGHEST_MATCHING, |
| 26 | true}, |
Tom Joseph | d8be336 | 2016-12-06 17:54:13 +0530 | [diff] [blame] | 27 | // RAKP1 & RAKP2 Message |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 28 | {{(static_cast<uint32_t>(message::PayloadType::RAKP1) << 16)}, |
| 29 | &RAKP12, |
| 30 | session::Privilege::HIGHEST_MATCHING, |
| 31 | true}, |
Tom Joseph | d8be336 | 2016-12-06 17:54:13 +0530 | [diff] [blame] | 32 | // RAKP3 & RAKP4 Message |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 33 | {{(static_cast<uint32_t>(message::PayloadType::RAKP3) << 16)}, |
| 34 | &RAKP34, |
| 35 | session::Privilege::HIGHEST_MATCHING, |
| 36 | true}, |
Tom Joseph | d8be336 | 2016-12-06 17:54:13 +0530 | [diff] [blame] | 37 | // Get Channel Authentication Capabilities Command |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 38 | {{(static_cast<uint32_t>(message::PayloadType::IPMI) << 16) | |
| 39 | static_cast<uint16_t>(command::NetFns::APP) | 0x38}, |
| 40 | &GetChannelCapabilities, |
| 41 | session::Privilege::HIGHEST_MATCHING, |
| 42 | true}, |
Vernon Mauery | 60d6e4e | 2021-07-26 13:51:35 -0700 | [diff] [blame] | 43 | // Get Channel Cipher Suites Command |
| 44 | {{(static_cast<uint32_t>(message::PayloadType::IPMI) << 16) | |
| 45 | static_cast<uint16_t>(::command::NetFns::APP) | 0x54}, |
| 46 | &getChannelCipherSuites, |
| 47 | session::Privilege::HIGHEST_MATCHING, |
| 48 | true}, |
Tom Joseph | d8be336 | 2016-12-06 17:54:13 +0530 | [diff] [blame] | 49 | // Set Session Privilege Command |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 50 | {{(static_cast<uint32_t>(message::PayloadType::IPMI) << 16) | |
| 51 | static_cast<uint16_t>(command::NetFns::APP) | 0x3B}, |
| 52 | &setSessionPrivilegeLevel, |
| 53 | session::Privilege::USER, |
| 54 | false}, |
Tom Joseph | d8be336 | 2016-12-06 17:54:13 +0530 | [diff] [blame] | 55 | // Close Session Command |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 56 | {{(static_cast<uint32_t>(message::PayloadType::IPMI) << 16) | |
| 57 | static_cast<uint16_t>(command::NetFns::APP) | 0x3C}, |
| 58 | &closeSession, |
| 59 | session::Privilege::CALLBACK, |
| 60 | false}, |
Tom Joseph | d8be336 | 2016-12-06 17:54:13 +0530 | [diff] [blame] | 61 | }; |
| 62 | |
| 63 | for (auto& iter : commands) |
| 64 | { |
Vernon Mauery | 2085ae0 | 2021-06-10 11:51:00 -0700 | [diff] [blame] | 65 | command::Table::get().registerCommand( |
| 66 | iter.command, |
| 67 | std::make_unique<command::NetIpmidEntry>( |
| 68 | iter.command, iter.functor, iter.privilege, iter.sessionless)); |
Tom Joseph | d8be336 | 2016-12-06 17:54:13 +0530 | [diff] [blame] | 69 | } |
| 70 | } |
| 71 | |
| 72 | } // namespace command |