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