blob: 8200e743b6086b2b1e7c347b9710d3bbff1eb82f [file] [log] [blame]
Tom Josephe088bf02017-04-03 02:07:06 +05301#include "command/payload_cmds.hpp"
Vernon Mauery9e801a22018-10-12 13:20:49 -07002#include "command/sol_cmds.hpp"
Tom Josephe088bf02017-04-03 02:07:06 +05303#include "command_table.hpp"
4#include "main.hpp"
5#include "session.hpp"
6
7namespace sol
8{
9
10namespace command
11{
12
13void registerCommands()
14{
Vernon Mauery9e801a22018-10-12 13:20:49 -070015 static const ::command::CmdDetails commands[] = {
Tom Josephe088bf02017-04-03 02:07:06 +053016 // SOL Payload Handler
Vernon Mauery9e801a22018-10-12 13:20:49 -070017 {{(static_cast<uint32_t>(message::PayloadType::SOL) << 16)},
18 &payloadHandler,
19 session::Privilege::HIGHEST_MATCHING,
20 false},
Tom Josephe088bf02017-04-03 02:07:06 +053021 // Activate Payload Command
Vernon Mauery9e801a22018-10-12 13:20:49 -070022 {{(static_cast<uint32_t>(message::PayloadType::IPMI) << 16) |
23 static_cast<uint16_t>(::command::NetFns::APP) | 0x48},
24 &activatePayload,
25 session::Privilege::USER,
26 false},
Tom Josephe088bf02017-04-03 02:07:06 +053027 // Deactivate Payload Command
Vernon Mauery9e801a22018-10-12 13:20:49 -070028 {{(static_cast<uint32_t>(message::PayloadType::IPMI) << 16) |
29 static_cast<uint16_t>(::command::NetFns::APP) | 0x49},
30 &deactivatePayload,
31 session::Privilege::USER,
32 false},
Tom Josephe088bf02017-04-03 02:07:06 +053033 // Get Payload Activation Status
Vernon Mauery9e801a22018-10-12 13:20:49 -070034 {{(static_cast<uint32_t>(message::PayloadType::IPMI) << 16) |
35 static_cast<uint16_t>(::command::NetFns::APP) | 0x4A},
36 &getPayloadStatus,
37 session::Privilege::USER,
38 false},
Tom Joseph80938492018-03-22 10:05:20 +053039 // Get Payload Instance Info 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) | 0x4B},
42 &getPayloadInfo,
43 session::Privilege::USER,
44 false},
Tom Joseph15771d12017-04-28 01:34:53 +053045 // Set SOL Configuration Parameters
Vernon Mauery9e801a22018-10-12 13:20:49 -070046 {{(static_cast<uint32_t>(message::PayloadType::IPMI) << 16) |
47 static_cast<uint16_t>(::command::NetFns::TRANSPORT) | 0x21},
48 &setConfParams,
49 session::Privilege::ADMIN,
50 false},
Tom Joseph15771d12017-04-28 01:34:53 +053051 // Get SOL Configuration Parameters
Vernon Mauery9e801a22018-10-12 13:20:49 -070052 {{(static_cast<uint32_t>(message::PayloadType::IPMI) << 16) |
53 static_cast<uint16_t>(::command::NetFns::TRANSPORT) | 0x22},
54 &getConfParams,
55 session::Privilege::USER,
56 false},
Tom Josephe088bf02017-04-03 02:07:06 +053057 };
58
59 for (const 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 Josephe088bf02017-04-03 02:07:06 +053066 }
67}
68
69} // namespace command
70
71} // namespace sol