blob: 59a93c196ca6ac9a505f8cd48392c7e46b6ef70d [file] [log] [blame]
Matt Spinlerc8705e22019-09-11 12:36:07 -05001#include "data_interface.hpp"
Matt Spinler99c2b402019-05-23 14:29:16 -05002#include "elog_entry.hpp"
3#include "extensions.hpp"
Matt Spinler4e8078c2019-07-09 13:22:32 -05004#include "manager.hpp"
Matt Spinler99c2b402019-05-23 14:29:16 -05005
6namespace openpower
7{
8namespace pels
9{
10
11using namespace phosphor::logging;
12
Matt Spinler4e8078c2019-07-09 13:22:32 -050013std::unique_ptr<Manager> manager;
14
Matt Spinler99c2b402019-05-23 14:29:16 -050015DISABLE_LOG_ENTRY_CAPS();
16
17void pelStartup(internal::Manager& logManager)
18{
Matt Spinlerc8705e22019-09-11 12:36:07 -050019 std::unique_ptr<DataInterfaceBase> dataIface =
20 std::make_unique<DataInterface>(logManager.getBus());
21
22 manager = std::make_unique<Manager>(logManager, std::move(dataIface));
Matt Spinler99c2b402019-05-23 14:29:16 -050023}
24
25REGISTER_EXTENSION_FUNCTION(pelStartup);
26
27void pelCreate(const std::string& message, uint32_t id, uint64_t timestamp,
28 Entry::Level severity, const AdditionalDataArg& additionalData,
29 const AssociationEndpointsArg& assocs)
30{
Matt Spinler4e8078c2019-07-09 13:22:32 -050031 manager->create(message, id, timestamp, severity, additionalData, assocs);
Matt Spinler99c2b402019-05-23 14:29:16 -050032}
33
34REGISTER_EXTENSION_FUNCTION(pelCreate);
35
36void pelDelete(uint32_t id)
37{
Matt Spinler4e8078c2019-07-09 13:22:32 -050038 return manager->erase(id);
Matt Spinler99c2b402019-05-23 14:29:16 -050039}
40
41REGISTER_EXTENSION_FUNCTION(pelDelete);
42
43void pelDeleteProhibited(uint32_t id, bool& prohibited)
44{
Matt Spinler4e8078c2019-07-09 13:22:32 -050045 prohibited = manager->isDeleteProhibited(id);
Matt Spinler99c2b402019-05-23 14:29:16 -050046}
47
48REGISTER_EXTENSION_FUNCTION(pelDeleteProhibited);
49
50} // namespace pels
51} // namespace openpower