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" |
| 9 | #include "main.hpp" |
| 10 | #include "session.hpp" |
| 11 | |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 12 | #include <algorithm> |
| 13 | #include <cstring> |
| 14 | #include <iomanip> |
| 15 | #include <iostream> |
| 16 | |
Tom Joseph | d8be336 | 2016-12-06 17:54:13 +0530 | [diff] [blame] | 17 | namespace command |
| 18 | { |
| 19 | |
| 20 | void sessionSetupCommands() |
| 21 | { |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 22 | static const command::CmdDetails commands[] = { |
Tom Joseph | d8be336 | 2016-12-06 17:54:13 +0530 | [diff] [blame] | 23 | // Open Session Request/Response |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 24 | {{(static_cast<uint32_t>(message::PayloadType::OPEN_SESSION_REQUEST) |
| 25 | << 16)}, |
| 26 | &openSession, |
| 27 | session::Privilege::HIGHEST_MATCHING, |
| 28 | true}, |
Tom Joseph | d8be336 | 2016-12-06 17:54:13 +0530 | [diff] [blame] | 29 | // RAKP1 & RAKP2 Message |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 30 | {{(static_cast<uint32_t>(message::PayloadType::RAKP1) << 16)}, |
| 31 | &RAKP12, |
| 32 | session::Privilege::HIGHEST_MATCHING, |
| 33 | true}, |
Tom Joseph | d8be336 | 2016-12-06 17:54:13 +0530 | [diff] [blame] | 34 | // RAKP3 & RAKP4 Message |
Vernon Mauery | 9e801a2 | 2018-10-12 13:20:49 -0700 | [diff] [blame] | 35 | {{(static_cast<uint32_t>(message::PayloadType::RAKP3) << 16)}, |
| 36 | &RAKP34, |
| 37 | session::Privilege::HIGHEST_MATCHING, |
| 38 | true}, |
Tom Joseph | d8be336 | 2016-12-06 17:54:13 +0530 | [diff] [blame] | 39 | // Get Channel Authentication Capabilities 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) | 0x38}, |
| 42 | &GetChannelCapabilities, |
| 43 | session::Privilege::HIGHEST_MATCHING, |
| 44 | true}, |
Tom Joseph | d8be336 | 2016-12-06 17:54:13 +0530 | [diff] [blame] | 45 | // Set Session Privilege Command |
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::APP) | 0x3B}, |
| 48 | &setSessionPrivilegeLevel, |
| 49 | session::Privilege::USER, |
| 50 | false}, |
Tom Joseph | d8be336 | 2016-12-06 17:54:13 +0530 | [diff] [blame] | 51 | // Close Session Command |
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::APP) | 0x3C}, |
| 54 | &closeSession, |
| 55 | session::Privilege::CALLBACK, |
| 56 | false}, |
Tom Joseph | d8be336 | 2016-12-06 17:54:13 +0530 | [diff] [blame] | 57 | }; |
| 58 | |
| 59 | for (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 | d8be336 | 2016-12-06 17:54:13 +0530 | [diff] [blame] | 66 | } |
| 67 | } |
| 68 | |
| 69 | } // namespace command |