summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Joseph <tomjoseph@in.ibm.com>2017-04-03 02:07:06 +0530
committerPatrick Williams <patrick@stwcx.xyz>2017-04-25 14:14:44 -0500
commite088bf0f153a3a4505ae64cc67055dcefaaf11fd (patch)
tree31ef021b5a174934d357234b67347ba5e26e8ccd
parente1ae56c20cce0d75e1065c44070f90bdc6a8061e (diff)
downloadphosphor-net-ipmid-e088bf0f153a3a4505ae64cc67055dcefaaf11fd.tar.gz
phosphor-net-ipmid-e088bf0f153a3a4505ae64cc67055dcefaaf11fd.zip
Provide API to hook SOL commands to the command table.
Change-Id: Ib95ac064044f60e4cc90ea412b0992779e4b2469 Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
-rw-r--r--Makefile.am4
-rw-r--r--sol_module.cpp59
-rw-r--r--sol_module.hpp14
3 files changed, 76 insertions, 1 deletions
diff --git a/Makefile.am b/Makefile.am
index cd4682e..11c07b2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -50,7 +50,9 @@ netipmid_SOURCES = \
command/sol_cmds.hpp \
command/sol_cmds.cpp \
command/payload_cmds.hpp \
- command/payload_cmds.cpp
+ command/payload_cmds.cpp \
+ sol_module.hpp \
+ sol_module.cpp
netipmid_CPPFLAGS = -DNET_IPMID_LIB_PATH=\"/usr/lib/net-ipmid/\"
netipmid_LDFLAGS = $(SYSTEMD_LIBS) $(CRYPTO_LIBS) $(libmapper_LIBS) $(PHOSPHOR_LOGGING_LIBS) $(LIBADD_DLOPEN) -export-dynamic
diff --git a/sol_module.cpp b/sol_module.cpp
new file mode 100644
index 0000000..174f58f
--- /dev/null
+++ b/sol_module.cpp
@@ -0,0 +1,59 @@
+#include "command/sol_cmds.hpp"
+#include "command/payload_cmds.hpp"
+#include "command_table.hpp"
+#include "main.hpp"
+#include "session.hpp"
+
+namespace sol
+{
+
+namespace command
+{
+
+void registerCommands()
+{
+ static const ::command::CmdDetails commands[] =
+ {
+ // SOL Payload Handler
+ {
+ {(static_cast<uint32_t>(message::PayloadType::SOL) << 16)},
+ &payloadHandler, session::Privilege::HIGHEST_MATCHING,
+ false
+ },
+ // Activate Payload Command
+ {
+ {
+ (static_cast<uint32_t>(message::PayloadType::IPMI) << 16) |
+ static_cast<uint16_t>(::command::NetFns::APP) | 0x48
+ },
+ &activatePayload, session::Privilege::USER, false
+ },
+ // Deactivate Payload Command
+ {
+ {
+ (static_cast<uint32_t>(message::PayloadType::IPMI) << 16) |
+ static_cast<uint16_t>(::command::NetFns::APP) | 0x49
+ },
+ &deactivatePayload, session::Privilege::USER, false
+ },
+ // Get Payload Activation Status
+ {
+ {
+ (static_cast<uint32_t>(message::PayloadType::IPMI) << 16) |
+ static_cast<uint16_t>(::command::NetFns::APP) | 0x4A
+ },
+ &getPayloadStatus, session::Privilege::USER, false
+ },
+ };
+
+ for (const 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
+
+} // namespace sol
diff --git a/sol_module.hpp b/sol_module.hpp
new file mode 100644
index 0000000..f1a4beb
--- /dev/null
+++ b/sol_module.hpp
@@ -0,0 +1,14 @@
+#pragma once
+
+namespace sol
+{
+
+namespace command
+{
+
+/** @brief Register SOL commands to the Command Table */
+void registerCommands();
+
+} // namespace command
+
+} // namespace sol
OpenPOWER on IntegriCloud