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         // Set SOL Configuration Parameters
48         {
49             {
50                 (static_cast<uint32_t>(message::PayloadType::IPMI) << 16) |
51                 static_cast<uint16_t>(::command::NetFns::TRANSPORT) | 0x21
52             },
53             &setConfParams, session::Privilege::ADMIN, false
54         },
55         // Get SOL Configuration Parameters
56         {
57             {
58                 (static_cast<uint32_t>(message::PayloadType::IPMI) << 16) |
59                 static_cast<uint16_t>(::command::NetFns::TRANSPORT) | 0x22
60             },
61             &getConfParams, session::Privilege::USER, false
62         },
63     };
64 
65     for (const auto& iter : commands)
66     {
67         std::get<::command::Table&>(singletonPool).registerCommand(
68             iter.command, std::make_unique<::command::NetIpmidEntry>
69             (iter.command, iter.functor, iter.privilege, iter.sessionless));
70     }
71 }
72 
73 } // namespace command
74 
75 } // namespace sol
76