blob: a58ca5dfafd7a113fc9394ea31b0318a171e1f76 [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"
9#include "main.hpp"
10#include "session.hpp"
11
Vernon Mauery9e801a22018-10-12 13:20:49 -070012#include <algorithm>
13#include <cstring>
14#include <iomanip>
15#include <iostream>
16
Tom Josephd8be3362016-12-06 17:54:13 +053017namespace command
18{
19
20void sessionSetupCommands()
21{
Vernon Mauery9e801a22018-10-12 13:20:49 -070022 static const command::CmdDetails commands[] = {
Tom Josephd8be3362016-12-06 17:54:13 +053023 // Open Session Request/Response
Vernon Mauery9e801a22018-10-12 13:20:49 -070024 {{(static_cast<uint32_t>(message::PayloadType::OPEN_SESSION_REQUEST)
25 << 16)},
26 &openSession,
27 session::Privilege::HIGHEST_MATCHING,
28 true},
Tom Josephd8be3362016-12-06 17:54:13 +053029 // RAKP1 & RAKP2 Message
Vernon Mauery9e801a22018-10-12 13:20:49 -070030 {{(static_cast<uint32_t>(message::PayloadType::RAKP1) << 16)},
31 &RAKP12,
32 session::Privilege::HIGHEST_MATCHING,
33 true},
Tom Josephd8be3362016-12-06 17:54:13 +053034 // RAKP3 & RAKP4 Message
Vernon Mauery9e801a22018-10-12 13:20:49 -070035 {{(static_cast<uint32_t>(message::PayloadType::RAKP3) << 16)},
36 &RAKP34,
37 session::Privilege::HIGHEST_MATCHING,
38 true},
Tom Josephd8be3362016-12-06 17:54:13 +053039 // Get Channel Authentication Capabilities Command
Vernon Mauery9e801a22018-10-12 13:20:49 -070040 {{(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 Josephd8be3362016-12-06 17:54:13 +053045 // Set Session Privilege Command
Vernon Mauery9e801a22018-10-12 13:20:49 -070046 {{(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 Josephd8be3362016-12-06 17:54:13 +053051 // Close Session Command
Vernon Mauery9e801a22018-10-12 13:20:49 -070052 {{(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 Josephd8be3362016-12-06 17:54:13 +053057 };
58
59 for (auto& iter : commands)
60 {
Vernon Mauery9e801a22018-10-12 13:20:49 -070061 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 Josephd8be3362016-12-06 17:54:13 +053066 }
67}
68
69} // namespace command