blob: 2b4281d0c7a92875f9cf349889f3448d6d911c83 [file] [log] [blame]
Adriana Kobylak8f7941e2016-11-14 14:46:23 -06001#pragma once
2
3#include <sdbusplus/server.hpp>
4#include "xyz/openbmc_project/Logging/Internal/Manager/server.hpp"
5
6namespace phosphor
7{
8namespace logging
9{
10namespace details
11{
12
13template <typename T>
14using ServerObject = typename sdbusplus::server::object::object<T>;
15
16using ManagerIface =
17 sdbusplus::xyz::openbmc_project::Logging::Internal::server::Manager;
18
19} // namespace details
20
21/** @class Manager
22 * @brief OpenBMC logging manager implementation.
23 * @details A concrete implementation for the
24 * xyz.openbmc_project.Logging.Internal.Manager DBus API.
25 */
26class Manager final :
27 public details::ServerObject<details::ManagerIface>
28{
29 public:
30 Manager() = delete;
31 Manager(const Manager&) = delete;
32 Manager& operator=(const Manager&) = delete;
33 Manager(Manager&&) = default;
34 Manager& operator=(Manager&&) = default;
35 ~Manager() = default;
36
37 /** @brief Constructor for the Log Manager object
38 * @param[in] bus - DBus bus to attach to.
39 * @param[in] busname - Name of DBus bus to own.
40 * @param[in] obj - Object path to attach to.
41 */
42 Manager(sdbusplus::bus::bus&& bus,
43 const char* busname,
44 const char* obj);
45
46 /** @brief Start processing DBus messages. */
47 void run() noexcept;
48
49 /*
50 * @fn commit()
51 * @brief sd_bus Commit method implementation callback.
52 * @details Create an error/event log based on transaction id and
53 * error message.
54 * @param[in] transactionId - Unique identifier of the journal entries
55 * to be committed.
56 * @param[in] errMsg - The error exception message associated with the
57 * error log to be committed.
58 */
59 void commit(uint64_t transactionId, std::string errMsg) override;
60
61 private:
62 /** @brief Persistent sdbusplus DBus bus connection. */
63 sdbusplus::bus::bus _bus;
64
65 /** @brief sdbusplus org.freedesktop.DBus.ObjectManager reference. */
66 sdbusplus::server::manager::manager _manager;
67};
68
69} // namespace logging
70} // namespace phosphor