blob: efb61500effea7cade875cff9eaa3c4dc221f55a [file] [log] [blame]
Claire Weinan919f71c2022-03-01 19:02:07 -08001#pragma once
2
3#include "dump_entry.hpp"
4
5#include <sdbusplus/bus.hpp>
6#include <sdbusplus/server/object.hpp>
7#include <xyz/openbmc_project/Object/Delete/server.hpp>
8#include <xyz/openbmc_project/Time/EpochTime/server.hpp>
9
10#include <filesystem>
11
12namespace phosphor
13{
14namespace dump
15{
16namespace faultlog
17{
18template <typename T>
Patrick Williams9b18bf22022-07-22 19:26:55 -050019using ServerObject = typename sdbusplus::server::object_t<T>;
Claire Weinan919f71c2022-03-01 19:02:07 -080020
Patrick Williams9b18bf22022-07-22 19:26:55 -050021using EntryIfaces = sdbusplus::server::object_t<>;
Claire Weinan919f71c2022-03-01 19:02:07 -080022
23class Manager;
24
25/** @class Entry
26 * @brief OpenBMC Fault Log Dump Entry implementation.
27 */
28class Entry : virtual public EntryIfaces, virtual public phosphor::dump::Entry
29{
30 public:
31 Entry() = delete;
32 Entry(const Entry&) = delete;
33 Entry& operator=(const Entry&) = delete;
34 Entry(Entry&&) = delete;
35 Entry& operator=(Entry&&) = delete;
36 ~Entry() = default;
37
38 /** @brief Constructor for the Dump Entry Object
39 * @param[in] bus - Bus to attach to.
40 * @param[in] objPath - Object path to attach to
41 * @param[in] dumpId - Dump id.
42 * @param[in] timeStamp - Dump creation timestamp
43 * in microseconds since the epoch.
44 * @param[in] fileSize - Dump file size in bytes.
45 * @param[in] file - Full path of dump file.
46 * @param[in] status - status of the dump.
Asmitha Karunanithi74a1f392021-10-27 03:23:59 -050047 * @param[in] originatorId - Id of the originator of the dump
48 * @param[in] originatorType - Originator type
Claire Weinan919f71c2022-03-01 19:02:07 -080049 * @param[in] parent - The dump entry's parent.
50 */
Patrick Williams9b18bf22022-07-22 19:26:55 -050051 Entry(sdbusplus::bus_t& bus, const std::string& objPath, uint32_t dumpId,
Claire Weinan919f71c2022-03-01 19:02:07 -080052 uint64_t timeStamp, uint64_t fileSize,
53 const std::filesystem::path& file,
Asmitha Karunanithi74a1f392021-10-27 03:23:59 -050054 phosphor::dump::OperationStatus status, std::string originatorId,
55 originatorTypes originatorType, phosphor::dump::Manager& parent) :
Claire Weinan919f71c2022-03-01 19:02:07 -080056 EntryIfaces(bus, objPath.c_str(), EntryIfaces::action::defer_emit),
57 phosphor::dump::Entry(bus, objPath.c_str(), dumpId, timeStamp, fileSize,
Asmitha Karunanithi74a1f392021-10-27 03:23:59 -050058 status, originatorId, originatorType, parent),
Claire Weinan919f71c2022-03-01 19:02:07 -080059 file(file)
60 {
61 // Emit deferred signal.
62 this->phosphor::dump::faultlog::EntryIfaces::emit_object_added();
63 }
64
65 /** @brief Delete this d-bus object.
66 */
67 void delete_() override;
68
69 private:
70 /** @Dump file path */
71 std::filesystem::path file;
72};
73
74} // namespace faultlog
75} // namespace dump
76} // namespace phosphor