summaryrefslogtreecommitdiffstats
path: root/comm_module.cpp
diff options
context:
space:
mode:
authorTom Joseph <tomjoseph@in.ibm.com>2016-12-06 17:54:13 +0530
committerTom Joseph <tomjoseph@in.ibm.com>2017-01-09 17:04:10 +0530
commitd8be3364964d91f9e02e5eef261fc4260251a714 (patch)
treee710709b3e64145ef0b5a18ddb7c7e0b0342a081 /comm_module.cpp
parent9662c3a92be94b45957984d2bdf3b49b5bf99136 (diff)
downloadphosphor-net-ipmid-d8be3364964d91f9e02e5eef261fc4260251a714.tar.gz
phosphor-net-ipmid-d8be3364964d91f9e02e5eef261fc4260251a714.zip
Communication Module Implementation
Registers the commands related to the Session Setup sequence. Change-Id: I7214087a1779d106173b05925dc6857c7223a503 Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
Diffstat (limited to 'comm_module.cpp')
-rw-r--r--comm_module.cpp77
1 files changed, 77 insertions, 0 deletions
diff --git a/comm_module.cpp b/comm_module.cpp
new file mode 100644
index 0000000..d780e21
--- /dev/null
+++ b/comm_module.cpp
@@ -0,0 +1,77 @@
+#include "comm_module.hpp"
+
+#include <algorithm>
+#include <cstring>
+#include <iomanip>
+#include <iostream>
+
+#include "command/channel_auth.hpp"
+#include "command/open_session.hpp"
+#include "command/rakp12.hpp"
+#include "command/rakp34.hpp"
+#include "command/session_cmds.hpp"
+#include "command_table.hpp"
+#include "main.hpp"
+#include "session.hpp"
+
+namespace command
+{
+
+void sessionSetupCommands()
+{
+ static const command::CmdDetails commands[] =
+ {
+ // Open Session Request/Response
+ {
+ {
+ (static_cast<uint32_t>
+ (message::PayloadType::OPEN_SESSION_REQUEST) << 16)
+ },
+ &openSession, session::Privilege::HIGHEST_MATCHING, true
+ },
+ // RAKP1 & RAKP2 Message
+ {
+ {(static_cast<uint32_t>(message::PayloadType::RAKP1) << 16)},
+ &RAKP12, session::Privilege::HIGHEST_MATCHING, true
+ },
+ // RAKP3 & RAKP4 Message
+ {
+ {(static_cast<uint32_t>(message::PayloadType::RAKP3) << 16)},
+ &RAKP34, session::Privilege::HIGHEST_MATCHING, true
+ },
+ // Get Channel Authentication Capabilities Command
+ {
+ {
+ (static_cast<uint32_t>(message::PayloadType::IPMI) << 16) |
+ static_cast<uint16_t>(command::NetFns::APP) | 0x38
+ },
+ &GetChannelCapabilities,
+ session::Privilege::HIGHEST_MATCHING, true
+ },
+ // Set Session Privilege Command
+ {
+ {
+ (static_cast<uint32_t>(message::PayloadType::IPMI) << 16) |
+ static_cast<uint16_t>(command::NetFns::APP) | 0x3B
+ },
+ &setSessionPrivilegeLevel, session::Privilege::USER, false
+ },
+ // Close Session Command
+ {
+ {
+ (static_cast<uint32_t>(message::PayloadType::IPMI) << 16) |
+ static_cast<uint16_t>(command::NetFns::APP) | 0x3C
+ },
+ &closeSession, session::Privilege::CALLBACK, false
+ },
+ };
+
+ for (auto& iter : commands)
+ {
+ std::get<command::Table&>(singletonPool).registerCommand(
+ iter.command, std::make_unique<command::NetIpmidEntry>
+ (iter.command, iter.functor, iter.privilege, iter.sessionless));
+ }
+}
+
+} // namespace command
OpenPOWER on IntegriCloud