1 #include "command/payload_cmds.hpp"
2 #include "command/sol_cmds.hpp"
3 #include "command_table.hpp"
4 #include "main.hpp"
5 #include "session.hpp"
6 
7 namespace sol
8 {
9 
10 namespace command
11 {
12 
13 void registerCommands()
14 {
15     static const ::command::CmdDetails commands[] = {
16         // SOL Payload Handler
17         {{(static_cast<uint32_t>(message::PayloadType::SOL) << 16)},
18          &payloadHandler,
19          session::Privilege::HIGHEST_MATCHING,
20          false},
21         // Activate Payload Command
22         {{(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},
27         // Deactivate Payload Command
28         {{(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},
33         // Get Payload Activation Status
34         {{(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},
39         // Get Payload Instance Info Command
40         {{(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},
45         // Get SOL Configuration Parameters
46         {{(static_cast<uint32_t>(message::PayloadType::IPMI) << 16) |
47           static_cast<uint16_t>(::command::NetFns::TRANSPORT) | 0x22},
48          &getConfParams,
49          session::Privilege::USER,
50          false},
51     };
52 
53     for (const auto& iter : commands)
54     {
55         std::get<::command::Table&>(singletonPool)
56             .registerCommand(iter.command,
57                              std::make_unique<::command::NetIpmidEntry>(
58                                  iter.command, iter.functor, iter.privilege,
59                                  iter.sessionless));
60     }
61 }
62 
63 } // namespace command
64 
65 } // namespace sol
66