Matt Spinler | c8705e2 | 2019-09-11 12:36:07 -0500 | [diff] [blame] | 1 | #include "data_interface.hpp" |
Matt Spinler | 99c2b40 | 2019-05-23 14:29:16 -0500 | [diff] [blame] | 2 | #include "elog_entry.hpp" |
| 3 | #include "extensions.hpp" |
Matt Spinler | 4e8078c | 2019-07-09 13:22:32 -0500 | [diff] [blame] | 4 | #include "manager.hpp" |
Matt Spinler | 99c2b40 | 2019-05-23 14:29:16 -0500 | [diff] [blame] | 5 | |
| 6 | namespace openpower |
| 7 | { |
| 8 | namespace pels |
| 9 | { |
| 10 | |
| 11 | using namespace phosphor::logging; |
| 12 | |
Matt Spinler | 4e8078c | 2019-07-09 13:22:32 -0500 | [diff] [blame] | 13 | std::unique_ptr<Manager> manager; |
| 14 | |
Matt Spinler | 99c2b40 | 2019-05-23 14:29:16 -0500 | [diff] [blame] | 15 | DISABLE_LOG_ENTRY_CAPS(); |
| 16 | |
| 17 | void pelStartup(internal::Manager& logManager) |
| 18 | { |
Matt Spinler | c8705e2 | 2019-09-11 12:36:07 -0500 | [diff] [blame] | 19 | std::unique_ptr<DataInterfaceBase> dataIface = |
| 20 | std::make_unique<DataInterface>(logManager.getBus()); |
| 21 | |
| 22 | manager = std::make_unique<Manager>(logManager, std::move(dataIface)); |
Matt Spinler | 99c2b40 | 2019-05-23 14:29:16 -0500 | [diff] [blame] | 23 | } |
| 24 | |
| 25 | REGISTER_EXTENSION_FUNCTION(pelStartup); |
| 26 | |
| 27 | void pelCreate(const std::string& message, uint32_t id, uint64_t timestamp, |
| 28 | Entry::Level severity, const AdditionalDataArg& additionalData, |
| 29 | const AssociationEndpointsArg& assocs) |
| 30 | { |
Matt Spinler | 4e8078c | 2019-07-09 13:22:32 -0500 | [diff] [blame] | 31 | manager->create(message, id, timestamp, severity, additionalData, assocs); |
Matt Spinler | 99c2b40 | 2019-05-23 14:29:16 -0500 | [diff] [blame] | 32 | } |
| 33 | |
| 34 | REGISTER_EXTENSION_FUNCTION(pelCreate); |
| 35 | |
| 36 | void pelDelete(uint32_t id) |
| 37 | { |
Matt Spinler | 4e8078c | 2019-07-09 13:22:32 -0500 | [diff] [blame] | 38 | return manager->erase(id); |
Matt Spinler | 99c2b40 | 2019-05-23 14:29:16 -0500 | [diff] [blame] | 39 | } |
| 40 | |
| 41 | REGISTER_EXTENSION_FUNCTION(pelDelete); |
| 42 | |
| 43 | void pelDeleteProhibited(uint32_t id, bool& prohibited) |
| 44 | { |
Matt Spinler | 4e8078c | 2019-07-09 13:22:32 -0500 | [diff] [blame] | 45 | prohibited = manager->isDeleteProhibited(id); |
Matt Spinler | 99c2b40 | 2019-05-23 14:29:16 -0500 | [diff] [blame] | 46 | } |
| 47 | |
| 48 | REGISTER_EXTENSION_FUNCTION(pelDeleteProhibited); |
| 49 | |
| 50 | } // namespace pels |
| 51 | } // namespace openpower |