blob: 8f7e7eb194edceb678af94b6d99b64c954966031 [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
10class 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 */
Patrick Williams84b790c2022-07-22 19:26:56 -050026 explicit MctpDiscovery(sdbusplus::bus_t& bus,
Tom Josephfb3bc062021-08-17 07:48:11 -070027 fw_update::Manager* fwManager);
28
29 private:
30 /** @brief reference to the systemd bus */
Patrick Williams84b790c2022-07-22 19:26:56 -050031 sdbusplus::bus_t& bus;
Tom Josephfb3bc062021-08-17 07:48:11 -070032
33 fw_update::Manager* fwManager;
34
35 /** @brief Used to watch for new MCTP endpoints */
36 sdbusplus::bus::match_t mctpEndpointSignal;
37
Patrick Williams84b790c2022-07-22 19:26:56 -050038 void dicoverEndpoints(sdbusplus::message_t& msg);
Tom Josephfb3bc062021-08-17 07:48:11 -070039
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