1 #include "command/sol_cmds.hpp"
2 #include "command/payload_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     {
17         // SOL Payload Handler
18         {
19             {(static_cast<uint32_t>(message::PayloadType::SOL) << 16)},
20             &payloadHandler, session::Privilege::HIGHEST_MATCHING,
21             false
22         },
23         // Activate Payload Command
24         {
25             {
26                 (static_cast<uint32_t>(message::PayloadType::IPMI) << 16) |
27                 static_cast<uint16_t>(::command::NetFns::APP) | 0x48
28             },
29             &activatePayload, session::Privilege::USER, false
30         },
31         // Deactivate Payload Command
32         {
33             {
34                 (static_cast<uint32_t>(message::PayloadType::IPMI) << 16) |
35                 static_cast<uint16_t>(::command::NetFns::APP) | 0x49
36             },
37             &deactivatePayload, session::Privilege::USER, false
38         },
39         // Get Payload Activation Status
40         {
41             {
42                 (static_cast<uint32_t>(message::PayloadType::IPMI) << 16) |
43                 static_cast<uint16_t>(::command::NetFns::APP) | 0x4A
44             },
45             &getPayloadStatus, session::Privilege::USER, false
46         },
47     };
48 
49     for (const auto& iter : commands)
50     {
51         std::get<::command::Table&>(singletonPool).registerCommand(
52             iter.command, std::make_unique<::command::NetIpmidEntry>
53             (iter.command, iter.functor, iter.privilege, iter.sessionless));
54     }
55 }
56 
57 } // namespace command
58 
59 } // namespace sol
60