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