blob: e34ab26815f484bc52a97b2238a870a283d3f040 [file] [log] [blame]
Tom Josephd8be3362016-12-06 17:54:13 +05301#include "comm_module.hpp"
2
Tom Josephd8be3362016-12-06 17:54:13 +05303#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 Josephd8be3362016-12-06 17:54:13 +05309#include "session.hpp"
10
Vernon Mauery9e801a22018-10-12 13:20:49 -070011#include <algorithm>
12#include <cstring>
13#include <iomanip>
Vernon Mauery9e801a22018-10-12 13:20:49 -070014
Tom Josephd8be3362016-12-06 17:54:13 +053015namespace command
16{
17
18void sessionSetupCommands()
19{
Vernon Mauery9e801a22018-10-12 13:20:49 -070020 static const command::CmdDetails commands[] = {
Tom Josephd8be3362016-12-06 17:54:13 +053021 // Open Session Request/Response
Vernon Mauery9e801a22018-10-12 13:20:49 -070022 {{(static_cast<uint32_t>(message::PayloadType::OPEN_SESSION_REQUEST)
23 << 16)},
24 &openSession,
25 session::Privilege::HIGHEST_MATCHING,
26 true},
Tom Josephd8be3362016-12-06 17:54:13 +053027 // RAKP1 & RAKP2 Message
Vernon Mauery9e801a22018-10-12 13:20:49 -070028 {{(static_cast<uint32_t>(message::PayloadType::RAKP1) << 16)},
29 &RAKP12,
30 session::Privilege::HIGHEST_MATCHING,
31 true},
Tom Josephd8be3362016-12-06 17:54:13 +053032 // RAKP3 & RAKP4 Message
Vernon Mauery9e801a22018-10-12 13:20:49 -070033 {{(static_cast<uint32_t>(message::PayloadType::RAKP3) << 16)},
34 &RAKP34,
35 session::Privilege::HIGHEST_MATCHING,
36 true},
Tom Josephd8be3362016-12-06 17:54:13 +053037 // Get Channel Authentication Capabilities Command
Vernon Mauery9e801a22018-10-12 13:20:49 -070038 {{(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 Mauery60d6e4e2021-07-26 13:51:35 -070043 // 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 Josephd8be3362016-12-06 17:54:13 +053049 // Set Session Privilege Command
Vernon Mauery9e801a22018-10-12 13:20:49 -070050 {{(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 Josephd8be3362016-12-06 17:54:13 +053055 // Close Session Command
Vernon Mauery9e801a22018-10-12 13:20:49 -070056 {{(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 Josephd8be3362016-12-06 17:54:13 +053061 };
62
63 for (auto& iter : commands)
64 {
Vernon Mauery2085ae02021-06-10 11:51:00 -070065 command::Table::get().registerCommand(
66 iter.command,
67 std::make_unique<command::NetIpmidEntry>(
68 iter.command, iter.functor, iter.privilege, iter.sessionless));
Tom Josephd8be3362016-12-06 17:54:13 +053069 }
70}
71
72} // namespace command