1 #pragma once
2 
3 #include "fw-update/manager.hpp"
4 
5 #include <sdbusplus/bus/match.hpp>
6 
7 namespace pldm
8 {
9 
10 constexpr auto MCTPService = "xyz.openbmc_project.MCTP";
11 constexpr auto MCTPPath = "/xyz/openbmc_project/mctp";
12 
13 class MctpDiscovery
14 {
15   public:
16     MctpDiscovery() = delete;
17     MctpDiscovery(const MctpDiscovery&) = delete;
18     MctpDiscovery(MctpDiscovery&&) = delete;
19     MctpDiscovery& operator=(const MctpDiscovery&) = delete;
20     MctpDiscovery& operator=(MctpDiscovery&&) = delete;
21     ~MctpDiscovery() = default;
22 
23     /** @brief Constructs the MCTP Discovery object to handle discovery of
24      *         MCTP enabled devices
25      *
26      *  @param[in] bus - reference to systemd bus
27      *  @param[in] fwManager - pointer to the firmware manager
28      */
29     explicit MctpDiscovery(sdbusplus::bus_t& bus,
30                            fw_update::Manager* fwManager);
31 
32   private:
33     /** @brief reference to the systemd bus */
34     sdbusplus::bus_t& bus;
35 
36     fw_update::Manager* fwManager;
37 
38     /** @brief Used to watch for new MCTP endpoints */
39     sdbusplus::bus::match_t mctpEndpointSignal;
40 
41     void dicoverEndpoints(sdbusplus::message_t& msg);
42 
43     static constexpr uint8_t mctpTypePLDM = 1;
44 
45     static constexpr std::string_view mctpEndpointIntfName{
46         "xyz.openbmc_project.MCTP.Endpoint"};
47 };
48 
49 } // namespace pldm
50