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