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         // Set SOL Configuration Parameters
46         {{(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},
51         // Get SOL Configuration Parameters
52         {{(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},
57     };
58 
59     for (const auto& iter : commands)
60     {
61         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));
66     }
67 }
68 
69 } // namespace command
70 
71 } // namespace sol
72