1 #pragma once
2 
3 #include "dump_manager.hpp"
4 #include "dump_utils.hpp"
5 #include "xyz/openbmc_project/Dump/NewDump/server.hpp"
6 
7 #include <sdbusplus/bus.hpp>
8 #include <sdbusplus/server/object.hpp>
9 #include <xyz/openbmc_project/Dump/Create/server.hpp>
10 
11 namespace openpower
12 {
13 namespace dump
14 {
15 namespace system
16 {
17 
18 constexpr uint32_t INVALID_SOURCE_ID = 0xFFFFFFFF;
19 using NotifyIface = sdbusplus::server::object::object<
20     sdbusplus::xyz::openbmc_project::Dump::server::Create,
21     sdbusplus::xyz::openbmc_project::Dump::server::NewDump>;
22 
23 /** @class Manager
24  *  @brief System Dump  manager implementation.
25  *  @details A concrete implementation for the
26  *  xyz.openbmc_project.Dump.Notify DBus API
27  */
28 class Manager :
29     virtual public NotifyIface,
30     virtual public phosphor::dump::Manager
31 {
32   public:
33     Manager() = delete;
34     Manager(const Manager&) = default;
35     Manager& operator=(const Manager&) = delete;
36     Manager(Manager&&) = delete;
37     Manager& operator=(Manager&&) = delete;
38     virtual ~Manager() = default;
39 
40     /** @brief Constructor to put object onto bus at a dbus path.
41      *  @param[in] bus - Bus to attach to.
42      *  @param[in] event - Dump manager sd_event loop.
43      *  @param[in] path - Path to attach at.
44      *  @param[in] baseEntryPath - Base path of the dump entry.
45      */
46     Manager(sdbusplus::bus::bus& bus, const char* path,
47             const std::string& baseEntryPath) :
48         NotifyIface(bus, path),
49         phosphor::dump::Manager(bus, path, baseEntryPath)
50     {}
51 
52     void restore() override
53     {
54         // TODO #2597  Implement the restore to restore the dump entries
55         // after the service restart.
56     }
57 
58     /** @brief Notify the system dump manager about creation of a new dump.
59      *  @param[in] dumpId - Id from the source of the dump.
60      *  @param[in] size - Size of the dump.
61      */
62     void notify(uint32_t dumpId, uint64_t size) override;
63 
64     /** @brief Implementation for CreateDump
65      *  Method to create a new system dump entry when user
66      *  requests for a new system dump.
67      *
68      *  @return object_path - The path to the new dump entry.
69      */
70     sdbusplus::message::object_path
71         createDump(std::map<std::string, std::string> params) override;
72 };
73 
74 } // namespace system
75 } // namespace dump
76 } // namespace openpower
77