diff options
author | Adriana Kobylak <anoo@us.ibm.com> | 2016-11-14 14:46:23 -0600 |
---|---|---|
committer | Patrick Williams <patrick@stwcx.xyz> | 2016-12-08 17:48:49 +0000 |
commit | 8f7941edf6843109d3da69900976b04b42d78aa4 (patch) | |
tree | 6b06f1b525f065772f75a2b0c0aa2d3fe99d36ed /log_manager.hpp | |
parent | 88eb10904410567b290242daa338e5e3c13d0502 (diff) | |
download | phosphor-logging-8f7941edf6843109d3da69900976b04b42d78aa4.tar.gz phosphor-logging-8f7941edf6843109d3da69900976b04b42d78aa4.zip |
log_manager: Use sdbus++
Change-Id: Id2ad6a75b6ee3f7226c7cfd274dba24de89f9363
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
Diffstat (limited to 'log_manager.hpp')
-rw-r--r-- | log_manager.hpp | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/log_manager.hpp b/log_manager.hpp new file mode 100644 index 0000000..2b4281d --- /dev/null +++ b/log_manager.hpp @@ -0,0 +1,70 @@ +#pragma once + +#include <sdbusplus/server.hpp> +#include "xyz/openbmc_project/Logging/Internal/Manager/server.hpp" + +namespace phosphor +{ +namespace logging +{ +namespace details +{ + +template <typename T> +using ServerObject = typename sdbusplus::server::object::object<T>; + +using ManagerIface = + sdbusplus::xyz::openbmc_project::Logging::Internal::server::Manager; + +} // namespace details + +/** @class Manager + * @brief OpenBMC logging manager implementation. + * @details A concrete implementation for the + * xyz.openbmc_project.Logging.Internal.Manager DBus API. + */ +class Manager final : + public details::ServerObject<details::ManagerIface> +{ + public: + Manager() = delete; + Manager(const Manager&) = delete; + Manager& operator=(const Manager&) = delete; + Manager(Manager&&) = default; + Manager& operator=(Manager&&) = default; + ~Manager() = default; + + /** @brief Constructor for the Log Manager object + * @param[in] bus - DBus bus to attach to. + * @param[in] busname - Name of DBus bus to own. + * @param[in] obj - Object path to attach to. + */ + Manager(sdbusplus::bus::bus&& bus, + const char* busname, + const char* obj); + + /** @brief Start processing DBus messages. */ + void run() noexcept; + + /* + * @fn commit() + * @brief sd_bus Commit method implementation callback. + * @details Create an error/event log based on transaction id and + * error message. + * @param[in] transactionId - Unique identifier of the journal entries + * to be committed. + * @param[in] errMsg - The error exception message associated with the + * error log to be committed. + */ + void commit(uint64_t transactionId, std::string errMsg) override; + + private: + /** @brief Persistent sdbusplus DBus bus connection. */ + sdbusplus::bus::bus _bus; + + /** @brief sdbusplus org.freedesktop.DBus.ObjectManager reference. */ + sdbusplus::server::manager::manager _manager; +}; + +} // namespace logging +} // namespace phosphor |