blob: de3a6bdd1b35ed1b90f335aedd0fbe6537cd8716 [file] [log] [blame]
Tom Josephfb3bc062021-08-17 07:48:11 -07001#pragma once
2
3#include "fw-update/manager.hpp"
4
5#include <sdbusplus/bus/match.hpp>
6
7namespace pldm
8{
9
Riya Dixit754041d2024-02-20 06:15:49 -060010constexpr auto MCTPService = "xyz.openbmc_project.MCTP";
11constexpr auto MCTPPath = "/xyz/openbmc_project/mctp";
12
Tom Josephfb3bc062021-08-17 07:48:11 -070013class 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 */
Patrick Williams84b790c2022-07-22 19:26:56 -050029 explicit MctpDiscovery(sdbusplus::bus_t& bus,
Tom Josephfb3bc062021-08-17 07:48:11 -070030 fw_update::Manager* fwManager);
31
32 private:
33 /** @brief reference to the systemd bus */
Patrick Williams84b790c2022-07-22 19:26:56 -050034 sdbusplus::bus_t& bus;
Tom Josephfb3bc062021-08-17 07:48:11 -070035
36 fw_update::Manager* fwManager;
37
38 /** @brief Used to watch for new MCTP endpoints */
39 sdbusplus::bus::match_t mctpEndpointSignal;
40
Patrick Williams84b790c2022-07-22 19:26:56 -050041 void dicoverEndpoints(sdbusplus::message_t& msg);
Tom Josephfb3bc062021-08-17 07:48:11 -070042
43 static constexpr uint8_t mctpTypePLDM = 1;
44
45 static constexpr std::string_view mctpEndpointIntfName{
46 "xyz.openbmc_project.MCTP.Endpoint"};
47};
48
Patrick Williams6da4f912023-05-10 07:50:53 -050049} // namespace pldm