Adriana Kobylak | 8f7941e | 2016-11-14 14:46:23 -0600 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Adriana Kobylak | f477fe2 | 2017-01-06 11:56:41 -0600 | [diff] [blame] | 3 | #include <sdbusplus/bus.hpp> |
Adriana Kobylak | df995fa | 2017-01-08 15:14:02 -0600 | [diff] [blame] | 4 | #include "elog_entry.hpp" |
Adriana Kobylak | 8f7941e | 2016-11-14 14:46:23 -0600 | [diff] [blame] | 5 | #include "xyz/openbmc_project/Logging/Internal/Manager/server.hpp" |
| 6 | |
| 7 | namespace phosphor |
| 8 | { |
| 9 | namespace logging |
| 10 | { |
| 11 | namespace details |
| 12 | { |
| 13 | |
| 14 | template <typename T> |
| 15 | using ServerObject = typename sdbusplus::server::object::object<T>; |
| 16 | |
| 17 | using ManagerIface = |
| 18 | sdbusplus::xyz::openbmc_project::Logging::Internal::server::Manager; |
| 19 | |
| 20 | } // namespace details |
| 21 | |
| 22 | /** @class Manager |
| 23 | * @brief OpenBMC logging manager implementation. |
| 24 | * @details A concrete implementation for the |
| 25 | * xyz.openbmc_project.Logging.Internal.Manager DBus API. |
| 26 | */ |
Adriana Kobylak | f477fe2 | 2017-01-06 11:56:41 -0600 | [diff] [blame] | 27 | class Manager : public details::ServerObject<details::ManagerIface> |
Adriana Kobylak | 8f7941e | 2016-11-14 14:46:23 -0600 | [diff] [blame] | 28 | { |
| 29 | public: |
| 30 | Manager() = delete; |
| 31 | Manager(const Manager&) = delete; |
| 32 | Manager& operator=(const Manager&) = delete; |
Adriana Kobylak | f477fe2 | 2017-01-06 11:56:41 -0600 | [diff] [blame] | 33 | Manager(Manager&&) = delete; |
| 34 | Manager& operator=(Manager&&) = delete; |
| 35 | virtual ~Manager() = default; |
Adriana Kobylak | 8f7941e | 2016-11-14 14:46:23 -0600 | [diff] [blame] | 36 | |
Adriana Kobylak | f477fe2 | 2017-01-06 11:56:41 -0600 | [diff] [blame] | 37 | /** @brief Constructor to put object onto bus at a dbus path. |
| 38 | * @param[in] bus - Bus to attach to. |
| 39 | * @param[in] path - Path to attach at. |
Adriana Kobylak | 8f7941e | 2016-11-14 14:46:23 -0600 | [diff] [blame] | 40 | */ |
Adriana Kobylak | 4ea7f31 | 2017-01-10 12:52:34 -0600 | [diff] [blame] | 41 | Manager(sdbusplus::bus::bus& bus, const char* objPath) : |
| 42 | details::ServerObject<details::ManagerIface>(bus, objPath), |
| 43 | busLog(bus), |
| 44 | entryId(0) {}; |
Adriana Kobylak | 8f7941e | 2016-11-14 14:46:23 -0600 | [diff] [blame] | 45 | |
| 46 | /* |
| 47 | * @fn commit() |
| 48 | * @brief sd_bus Commit method implementation callback. |
| 49 | * @details Create an error/event log based on transaction id and |
| 50 | * error message. |
| 51 | * @param[in] transactionId - Unique identifier of the journal entries |
| 52 | * to be committed. |
| 53 | * @param[in] errMsg - The error exception message associated with the |
| 54 | * error log to be committed. |
| 55 | */ |
| 56 | void commit(uint64_t transactionId, std::string errMsg) override; |
Adriana Kobylak | df995fa | 2017-01-08 15:14:02 -0600 | [diff] [blame] | 57 | |
| 58 | |
| 59 | private: |
| 60 | /** @brief Persistent sdbusplus DBus bus connection. */ |
| 61 | sdbusplus::bus::bus& busLog; |
| 62 | |
| 63 | /** @brief Persistent map of Entry dbus objects and their ID */ |
| 64 | std::map<uint32_t, std::unique_ptr<Entry>> entries; |
Adriana Kobylak | 4ea7f31 | 2017-01-10 12:52:34 -0600 | [diff] [blame] | 65 | |
| 66 | /** @brief Id of last error log entry */ |
| 67 | uint32_t entryId; |
Adriana Kobylak | 8f7941e | 2016-11-14 14:46:23 -0600 | [diff] [blame] | 68 | }; |
| 69 | |
| 70 | } // namespace logging |
| 71 | } // namespace phosphor |