Gilbert Chen | 44524a5 | 2022-02-14 12:12:25 +0000 | [diff] [blame] | 1 | #include "config.h" |
| 2 | |
Tom Joseph | fb3bc06 | 2021-08-17 07:48:11 -0700 | [diff] [blame] | 3 | #include "mctp_endpoint_discovery.hpp" |
| 4 | |
Tom Joseph | fb3bc06 | 2021-08-17 07:48:11 -0700 | [diff] [blame] | 5 | #include "common/types.hpp" |
| 6 | #include "common/utils.hpp" |
| 7 | |
Thu Nguyen | 9027497 | 2024-07-17 07:02:16 +0000 | [diff] [blame] | 8 | #include <linux/mctp.h> |
| 9 | |
Gilbert Chen | 44524a5 | 2022-02-14 12:12:25 +0000 | [diff] [blame] | 10 | #include <phosphor-logging/lg2.hpp> |
| 11 | |
Tom Joseph | fb3bc06 | 2021-08-17 07:48:11 -0700 | [diff] [blame] | 12 | #include <algorithm> |
Gilbert Chen | 44524a5 | 2022-02-14 12:12:25 +0000 | [diff] [blame] | 13 | #include <fstream> |
| 14 | #include <iostream> |
Tom Joseph | fb3bc06 | 2021-08-17 07:48:11 -0700 | [diff] [blame] | 15 | #include <map> |
| 16 | #include <string> |
| 17 | #include <string_view> |
| 18 | #include <vector> |
| 19 | |
Gilbert Chen | 44524a5 | 2022-02-14 12:12:25 +0000 | [diff] [blame] | 20 | using namespace sdbusplus::bus::match::rules; |
| 21 | |
| 22 | PHOSPHOR_LOG2_USING; |
| 23 | |
Tom Joseph | fb3bc06 | 2021-08-17 07:48:11 -0700 | [diff] [blame] | 24 | namespace pldm |
| 25 | { |
Gilbert Chen | 44524a5 | 2022-02-14 12:12:25 +0000 | [diff] [blame] | 26 | MctpDiscovery::MctpDiscovery( |
Patrick Williams | ba741d5 | 2024-05-08 02:32:10 -0500 | [diff] [blame] | 27 | sdbusplus::bus_t& bus, |
Gilbert Chen | 44524a5 | 2022-02-14 12:12:25 +0000 | [diff] [blame] | 28 | std::initializer_list<MctpDiscoveryHandlerIntf*> list) : |
Patrick Williams | 16c2a0a | 2024-08-16 15:20:59 -0400 | [diff] [blame] | 29 | bus(bus), mctpEndpointAddedSignal( |
| 30 | bus, interfacesAdded(MCTPPath), |
| 31 | std::bind_front(&MctpDiscovery::discoverEndpoints, this)), |
Gilbert Chen | 44524a5 | 2022-02-14 12:12:25 +0000 | [diff] [blame] | 32 | mctpEndpointRemovedSignal( |
| 33 | bus, interfacesRemoved(MCTPPath), |
| 34 | std::bind_front(&MctpDiscovery::removeEndpoints, this)), |
Chau Ly | 75e0042 | 2024-03-19 12:33:08 +0000 | [diff] [blame] | 35 | mctpEndpointPropChangedSignal( |
| 36 | bus, propertiesChangedNamespace(MCTPPath, MCTPInterfaceCC), |
| 37 | std::bind_front(&MctpDiscovery::propertiesChangedCb, this)), |
Gilbert Chen | 44524a5 | 2022-02-14 12:12:25 +0000 | [diff] [blame] | 38 | handlers(list) |
Tom Joseph | fb3bc06 | 2021-08-17 07:48:11 -0700 | [diff] [blame] | 39 | { |
Chau Ly | 75e0042 | 2024-03-19 12:33:08 +0000 | [diff] [blame] | 40 | std::map<MctpInfo, Availability> currentMctpInfoMap; |
| 41 | getMctpInfos(currentMctpInfoMap); |
| 42 | for (const auto& mapIt : currentMctpInfoMap) |
| 43 | { |
| 44 | if (mapIt.second) |
| 45 | { |
| 46 | // Only add the available endpoints to the terminus |
| 47 | // Let the propertiesChanged signal tells us when it comes back |
| 48 | // to Available again |
| 49 | addToExistingMctpInfos(MctpInfos(1, mapIt.first)); |
| 50 | } |
| 51 | } |
Gilbert Chen | 44524a5 | 2022-02-14 12:12:25 +0000 | [diff] [blame] | 52 | handleMctpEndpoints(existingMctpInfos); |
| 53 | } |
Tom Joseph | fb3bc06 | 2021-08-17 07:48:11 -0700 | [diff] [blame] | 54 | |
Chau Ly | 75e0042 | 2024-03-19 12:33:08 +0000 | [diff] [blame] | 55 | void MctpDiscovery::getMctpInfos(std::map<MctpInfo, Availability>& mctpInfoMap) |
Gilbert Chen | 44524a5 | 2022-02-14 12:12:25 +0000 | [diff] [blame] | 56 | { |
| 57 | // Find all implementations of the MCTP Endpoint interface |
| 58 | pldm::utils::GetSubTreeResponse mapperResponse; |
Tom Joseph | fb3bc06 | 2021-08-17 07:48:11 -0700 | [diff] [blame] | 59 | try |
| 60 | { |
Gilbert Chen | 44524a5 | 2022-02-14 12:12:25 +0000 | [diff] [blame] | 61 | mapperResponse = pldm::utils::DBusHandler().getSubtree( |
| 62 | MCTPPath, 0, std::vector<std::string>({MCTPInterface})); |
Tom Joseph | fb3bc06 | 2021-08-17 07:48:11 -0700 | [diff] [blame] | 63 | } |
Gilbert Chen | 44524a5 | 2022-02-14 12:12:25 +0000 | [diff] [blame] | 64 | catch (const sdbusplus::exception_t& e) |
Tom Joseph | fb3bc06 | 2021-08-17 07:48:11 -0700 | [diff] [blame] | 65 | { |
Riya Dixit | 087a751 | 2024-04-06 14:28:08 -0500 | [diff] [blame] | 66 | error( |
| 67 | "Failed to getSubtree call at path '{PATH}' and interface '{INTERFACE}', error - {ERROR} ", |
| 68 | "ERROR", e, "PATH", MCTPPath, "INTERFACE", MCTPInterface); |
Tom Joseph | fb3bc06 | 2021-08-17 07:48:11 -0700 | [diff] [blame] | 69 | return; |
| 70 | } |
| 71 | |
Gilbert Chen | 44524a5 | 2022-02-14 12:12:25 +0000 | [diff] [blame] | 72 | for (const auto& [path, services] : mapperResponse) |
Tom Joseph | fb3bc06 | 2021-08-17 07:48:11 -0700 | [diff] [blame] | 73 | { |
Gilbert Chen | 44524a5 | 2022-02-14 12:12:25 +0000 | [diff] [blame] | 74 | for (const auto& serviceIter : services) |
Tom Joseph | fb3bc06 | 2021-08-17 07:48:11 -0700 | [diff] [blame] | 75 | { |
Gilbert Chen | 44524a5 | 2022-02-14 12:12:25 +0000 | [diff] [blame] | 76 | const std::string& service = serviceIter.first; |
Thu Nguyen | 9027497 | 2024-07-17 07:02:16 +0000 | [diff] [blame] | 77 | const MctpEndpointProps& epProps = |
| 78 | getMctpEndpointProps(service, path); |
| 79 | const UUID& uuid = getEndpointUUIDProp(service, path); |
Chau Ly | 75e0042 | 2024-03-19 12:33:08 +0000 | [diff] [blame] | 80 | const Availability& availability = |
| 81 | getEndpointConnectivityProp(path); |
Thu Nguyen | 9027497 | 2024-07-17 07:02:16 +0000 | [diff] [blame] | 82 | auto types = std::get<MCTPMsgTypes>(epProps); |
| 83 | if (std::find(types.begin(), types.end(), mctpTypePLDM) != |
| 84 | types.end()) |
Tom Joseph | fb3bc06 | 2021-08-17 07:48:11 -0700 | [diff] [blame] | 85 | { |
Chau Ly | 75e0042 | 2024-03-19 12:33:08 +0000 | [diff] [blame] | 86 | mctpInfoMap[MctpInfo(std::get<eid>(epProps), uuid, "", |
| 87 | std::get<NetworkId>(epProps))] = |
| 88 | availability; |
Gilbert Chen | 44524a5 | 2022-02-14 12:12:25 +0000 | [diff] [blame] | 89 | } |
Tom Joseph | fb3bc06 | 2021-08-17 07:48:11 -0700 | [diff] [blame] | 90 | } |
| 91 | } |
Tom Joseph | fb3bc06 | 2021-08-17 07:48:11 -0700 | [diff] [blame] | 92 | } |
| 93 | |
Thu Nguyen | 9027497 | 2024-07-17 07:02:16 +0000 | [diff] [blame] | 94 | MctpEndpointProps MctpDiscovery::getMctpEndpointProps( |
| 95 | const std::string& service, const std::string& path) |
| 96 | { |
| 97 | try |
| 98 | { |
| 99 | auto properties = pldm::utils::DBusHandler().getDbusPropertiesVariant( |
| 100 | service.c_str(), path.c_str(), MCTPInterface); |
| 101 | |
| 102 | if (properties.contains("NetworkId") && properties.contains("EID") && |
| 103 | properties.contains("SupportedMessageTypes")) |
| 104 | { |
| 105 | auto networkId = std::get<NetworkId>(properties.at("NetworkId")); |
| 106 | auto eid = std::get<mctp_eid_t>(properties.at("EID")); |
| 107 | auto types = std::get<std::vector<uint8_t>>( |
| 108 | properties.at("SupportedMessageTypes")); |
| 109 | return MctpEndpointProps(networkId, eid, types); |
| 110 | } |
| 111 | } |
| 112 | catch (const sdbusplus::exception_t& e) |
| 113 | { |
| 114 | error( |
| 115 | "Error reading MCTP Endpoint property at path '{PATH}' and service '{SERVICE}', error - {ERROR}", |
| 116 | "SERVICE", service, "PATH", path, "ERROR", e); |
| 117 | return MctpEndpointProps(0, MCTP_ADDR_ANY, {}); |
| 118 | } |
| 119 | |
| 120 | return MctpEndpointProps(0, MCTP_ADDR_ANY, {}); |
| 121 | } |
| 122 | |
| 123 | UUID MctpDiscovery::getEndpointUUIDProp(const std::string& service, |
| 124 | const std::string& path) |
| 125 | { |
| 126 | try |
| 127 | { |
| 128 | auto properties = pldm::utils::DBusHandler().getDbusPropertiesVariant( |
| 129 | service.c_str(), path.c_str(), EndpointUUID); |
| 130 | |
| 131 | if (properties.contains("UUID")) |
| 132 | { |
| 133 | return std::get<UUID>(properties.at("UUID")); |
| 134 | } |
| 135 | } |
| 136 | catch (const sdbusplus::exception_t& e) |
| 137 | { |
| 138 | error( |
| 139 | "Error reading Endpoint UUID property at path '{PATH}' and service '{SERVICE}', error - {ERROR}", |
| 140 | "SERVICE", service, "PATH", path, "ERROR", e); |
| 141 | return static_cast<UUID>(emptyUUID); |
| 142 | } |
| 143 | |
| 144 | return static_cast<UUID>(emptyUUID); |
| 145 | } |
| 146 | |
Chau Ly | 75e0042 | 2024-03-19 12:33:08 +0000 | [diff] [blame] | 147 | Availability MctpDiscovery::getEndpointConnectivityProp(const std::string& path) |
| 148 | { |
| 149 | Availability available = false; |
| 150 | try |
| 151 | { |
| 152 | pldm::utils::PropertyValue propertyValue = |
| 153 | pldm::utils::DBusHandler().getDbusPropertyVariant( |
| 154 | path.c_str(), MCTPConnectivityProp, MCTPInterfaceCC); |
| 155 | if (std::get<std::string>(propertyValue) == "Available") |
| 156 | { |
| 157 | available = true; |
| 158 | } |
| 159 | } |
| 160 | catch (const sdbusplus::exception_t& e) |
| 161 | { |
| 162 | error( |
| 163 | "Error reading Endpoint Connectivity property at path '{PATH}', error - {ERROR}", |
| 164 | "PATH", path, "ERROR", e); |
| 165 | } |
| 166 | |
| 167 | return available; |
| 168 | } |
| 169 | |
Gilbert Chen | 44524a5 | 2022-02-14 12:12:25 +0000 | [diff] [blame] | 170 | void MctpDiscovery::getAddedMctpInfos(sdbusplus::message_t& msg, |
| 171 | MctpInfos& mctpInfos) |
Tom Joseph | fb3bc06 | 2021-08-17 07:48:11 -0700 | [diff] [blame] | 172 | { |
Gilbert Chen | 44524a5 | 2022-02-14 12:12:25 +0000 | [diff] [blame] | 173 | using ObjectPath = sdbusplus::message::object_path; |
| 174 | ObjectPath objPath; |
| 175 | using Property = std::string; |
| 176 | using PropertyMap = std::map<Property, dbus::Value>; |
| 177 | std::map<std::string, PropertyMap> interfaces; |
Thu Nguyen | 9027497 | 2024-07-17 07:02:16 +0000 | [diff] [blame] | 178 | std::string uuid = emptyUUID; |
Tom Joseph | fb3bc06 | 2021-08-17 07:48:11 -0700 | [diff] [blame] | 179 | |
Gilbert Chen | 44524a5 | 2022-02-14 12:12:25 +0000 | [diff] [blame] | 180 | try |
| 181 | { |
| 182 | msg.read(objPath, interfaces); |
| 183 | } |
| 184 | catch (const sdbusplus::exception_t& e) |
| 185 | { |
Riya Dixit | 087a751 | 2024-04-06 14:28:08 -0500 | [diff] [blame] | 186 | error( |
| 187 | "Error reading MCTP Endpoint added interface message, error - {ERROR}", |
| 188 | "ERROR", e); |
Gilbert Chen | 44524a5 | 2022-02-14 12:12:25 +0000 | [diff] [blame] | 189 | return; |
| 190 | } |
Chau Ly | 75e0042 | 2024-03-19 12:33:08 +0000 | [diff] [blame] | 191 | const Availability& availability = getEndpointConnectivityProp(objPath.str); |
Tom Joseph | fb3bc06 | 2021-08-17 07:48:11 -0700 | [diff] [blame] | 192 | |
Thu Nguyen | 9027497 | 2024-07-17 07:02:16 +0000 | [diff] [blame] | 193 | /* Get UUID */ |
| 194 | try |
| 195 | { |
| 196 | auto service = pldm::utils::DBusHandler().getService( |
| 197 | objPath.str.c_str(), EndpointUUID); |
| 198 | uuid = getEndpointUUIDProp(service, objPath.str); |
| 199 | } |
| 200 | catch (const sdbusplus::exception_t& e) |
| 201 | { |
| 202 | error("Error getting Endpoint UUID D-Bus interface, error - {ERROR}", |
| 203 | "ERROR", e); |
| 204 | } |
| 205 | |
Tom Joseph | fb3bc06 | 2021-08-17 07:48:11 -0700 | [diff] [blame] | 206 | for (const auto& [intfName, properties] : interfaces) |
| 207 | { |
Gilbert Chen | 44524a5 | 2022-02-14 12:12:25 +0000 | [diff] [blame] | 208 | if (intfName == MCTPInterface) |
Tom Joseph | fb3bc06 | 2021-08-17 07:48:11 -0700 | [diff] [blame] | 209 | { |
Gilbert Chen | 44524a5 | 2022-02-14 12:12:25 +0000 | [diff] [blame] | 210 | if (properties.contains("NetworkId") && |
| 211 | properties.contains("EID") && |
Tom Joseph | fb3bc06 | 2021-08-17 07:48:11 -0700 | [diff] [blame] | 212 | properties.contains("SupportedMessageTypes")) |
| 213 | { |
Gilbert Chen | 44524a5 | 2022-02-14 12:12:25 +0000 | [diff] [blame] | 214 | auto networkId = |
| 215 | std::get<NetworkId>(properties.at("NetworkId")); |
Dung Cao | 66794d0 | 2023-10-25 04:06:23 +0000 | [diff] [blame] | 216 | auto eid = std::get<mctp_eid_t>(properties.at("EID")); |
Tom Joseph | fb3bc06 | 2021-08-17 07:48:11 -0700 | [diff] [blame] | 217 | auto types = std::get<std::vector<uint8_t>>( |
| 218 | properties.at("SupportedMessageTypes")); |
Chau Ly | 75e0042 | 2024-03-19 12:33:08 +0000 | [diff] [blame] | 219 | |
| 220 | if (!availability) |
| 221 | { |
| 222 | // Log an error message here, but still add it to the |
| 223 | // terminus |
| 224 | error( |
| 225 | "mctpd added a DEGRADED endpoint {EID} networkId {NET} to D-Bus", |
| 226 | "NET", networkId, "EID", static_cast<unsigned>(eid)); |
| 227 | } |
Tom Joseph | fb3bc06 | 2021-08-17 07:48:11 -0700 | [diff] [blame] | 228 | if (std::find(types.begin(), types.end(), mctpTypePLDM) != |
| 229 | types.end()) |
| 230 | { |
Riya Dixit | 087a751 | 2024-04-06 14:28:08 -0500 | [diff] [blame] | 231 | info( |
Thu Nguyen | 9027497 | 2024-07-17 07:02:16 +0000 | [diff] [blame] | 232 | "Adding Endpoint networkId '{NETWORK}' and EID '{EID}' UUID '{UUID}'", |
| 233 | "NETWORK", networkId, "EID", eid, "UUID", uuid); |
| 234 | mctpInfos.emplace_back(MctpInfo(eid, uuid, "", networkId)); |
Tom Joseph | fb3bc06 | 2021-08-17 07:48:11 -0700 | [diff] [blame] | 235 | } |
| 236 | } |
| 237 | } |
| 238 | } |
Gilbert Chen | 44524a5 | 2022-02-14 12:12:25 +0000 | [diff] [blame] | 239 | } |
Tom Joseph | fb3bc06 | 2021-08-17 07:48:11 -0700 | [diff] [blame] | 240 | |
Gilbert Chen | 44524a5 | 2022-02-14 12:12:25 +0000 | [diff] [blame] | 241 | void MctpDiscovery::addToExistingMctpInfos(const MctpInfos& addedInfos) |
| 242 | { |
| 243 | for (const auto& mctpInfo : addedInfos) |
Tom Joseph | fb3bc06 | 2021-08-17 07:48:11 -0700 | [diff] [blame] | 244 | { |
Gilbert Chen | 44524a5 | 2022-02-14 12:12:25 +0000 | [diff] [blame] | 245 | if (std::find(existingMctpInfos.begin(), existingMctpInfos.end(), |
| 246 | mctpInfo) == existingMctpInfos.end()) |
| 247 | { |
| 248 | existingMctpInfos.emplace_back(mctpInfo); |
| 249 | } |
| 250 | } |
| 251 | } |
| 252 | |
| 253 | void MctpDiscovery::removeFromExistingMctpInfos(MctpInfos& mctpInfos, |
| 254 | MctpInfos& removedInfos) |
| 255 | { |
| 256 | for (const auto& mctpInfo : existingMctpInfos) |
| 257 | { |
| 258 | if (std::find(mctpInfos.begin(), mctpInfos.end(), mctpInfo) == |
| 259 | mctpInfos.end()) |
| 260 | { |
| 261 | removedInfos.emplace_back(mctpInfo); |
| 262 | } |
| 263 | } |
| 264 | for (const auto& mctpInfo : removedInfos) |
| 265 | { |
Riya Dixit | 087a751 | 2024-04-06 14:28:08 -0500 | [diff] [blame] | 266 | info("Removing Endpoint networkId '{NETWORK}' and EID '{EID}'", |
Riya Dixit | 1e5c81e | 2024-05-03 07:54:00 -0500 | [diff] [blame] | 267 | "NETWORK", std::get<3>(mctpInfo), "EID", std::get<0>(mctpInfo)); |
Gilbert Chen | 44524a5 | 2022-02-14 12:12:25 +0000 | [diff] [blame] | 268 | existingMctpInfos.erase(std::remove(existingMctpInfos.begin(), |
| 269 | existingMctpInfos.end(), mctpInfo), |
| 270 | existingMctpInfos.end()); |
| 271 | } |
| 272 | } |
| 273 | |
Chau Ly | 75e0042 | 2024-03-19 12:33:08 +0000 | [diff] [blame] | 274 | void MctpDiscovery::propertiesChangedCb(sdbusplus::message_t& msg) |
| 275 | { |
| 276 | using Interface = std::string; |
| 277 | using Property = std::string; |
| 278 | using Value = std::string; |
| 279 | using Properties = std::map<Property, std::variant<Value>>; |
| 280 | |
| 281 | Interface interface; |
| 282 | Properties properties; |
| 283 | std::string objPath{}; |
| 284 | std::string service{}; |
| 285 | |
| 286 | try |
| 287 | { |
| 288 | msg.read(interface, properties); |
| 289 | objPath = msg.get_path(); |
| 290 | } |
| 291 | catch (const sdbusplus::exception_t& e) |
| 292 | { |
| 293 | error( |
| 294 | "Error handling Connectivity property changed message, error - {ERROR}", |
| 295 | "ERROR", e); |
| 296 | return; |
| 297 | } |
| 298 | |
| 299 | for (const auto& [key, valueVariant] : properties) |
| 300 | { |
| 301 | Value propVal = std::get<std::string>(valueVariant); |
| 302 | auto availability = (propVal == "Available") ? true : false; |
| 303 | |
| 304 | if (key == MCTPConnectivityProp) |
| 305 | { |
| 306 | service = pldm::utils::DBusHandler().getService(objPath.c_str(), |
| 307 | MCTPInterface); |
| 308 | const MctpEndpointProps& epProps = |
| 309 | getMctpEndpointProps(service, objPath); |
| 310 | |
| 311 | auto types = std::get<MCTPMsgTypes>(epProps); |
| 312 | if (!std::ranges::contains(types, mctpTypePLDM)) |
| 313 | { |
| 314 | return; |
| 315 | } |
| 316 | const UUID& uuid = getEndpointUUIDProp(service, objPath); |
| 317 | |
| 318 | MctpInfo mctpInfo(std::get<eid>(epProps), uuid, "", |
| 319 | std::get<NetworkId>(epProps)); |
| 320 | if (!std::ranges::contains(existingMctpInfos, mctpInfo)) |
| 321 | { |
| 322 | if (availability) |
| 323 | { |
| 324 | // The endpoint not in existingMctpInfos and is |
| 325 | // available Add it to existingMctpInfos |
| 326 | info( |
| 327 | "Adding Endpoint networkId {NETWORK} ID {EID} by propertiesChanged signal", |
| 328 | "NETWORK", std::get<3>(mctpInfo), "EID", |
| 329 | unsigned(std::get<0>(mctpInfo))); |
| 330 | addToExistingMctpInfos(MctpInfos(1, mctpInfo)); |
| 331 | handleMctpEndpoints(MctpInfos(1, mctpInfo)); |
| 332 | } |
| 333 | } |
| 334 | else |
| 335 | { |
| 336 | // The endpoint already in existingMctpInfos |
| 337 | updateMctpEndpointAvailability(mctpInfo, availability); |
| 338 | } |
| 339 | } |
| 340 | } |
| 341 | } |
| 342 | |
Gilbert Chen | 44524a5 | 2022-02-14 12:12:25 +0000 | [diff] [blame] | 343 | void MctpDiscovery::discoverEndpoints(sdbusplus::message_t& msg) |
| 344 | { |
| 345 | MctpInfos addedInfos; |
| 346 | getAddedMctpInfos(msg, addedInfos); |
| 347 | addToExistingMctpInfos(addedInfos); |
| 348 | handleMctpEndpoints(addedInfos); |
| 349 | } |
| 350 | |
| 351 | void MctpDiscovery::removeEndpoints(sdbusplus::message_t&) |
| 352 | { |
| 353 | MctpInfos mctpInfos; |
| 354 | MctpInfos removedInfos; |
Chau Ly | 75e0042 | 2024-03-19 12:33:08 +0000 | [diff] [blame] | 355 | std::map<MctpInfo, Availability> currentMctpInfoMap; |
| 356 | getMctpInfos(currentMctpInfoMap); |
| 357 | for (const auto& mapIt : currentMctpInfoMap) |
| 358 | { |
| 359 | mctpInfos.push_back(mapIt.first); |
| 360 | } |
Gilbert Chen | 44524a5 | 2022-02-14 12:12:25 +0000 | [diff] [blame] | 361 | removeFromExistingMctpInfos(mctpInfos, removedInfos); |
| 362 | handleRemovedMctpEndpoints(removedInfos); |
| 363 | } |
| 364 | |
| 365 | void MctpDiscovery::handleMctpEndpoints(const MctpInfos& mctpInfos) |
| 366 | { |
| 367 | for (const auto& handler : handlers) |
| 368 | { |
| 369 | if (handler) |
| 370 | { |
| 371 | handler->handleMctpEndpoints(mctpInfos); |
| 372 | } |
| 373 | } |
| 374 | } |
| 375 | |
| 376 | void MctpDiscovery::handleRemovedMctpEndpoints(const MctpInfos& mctpInfos) |
| 377 | { |
| 378 | for (const auto& handler : handlers) |
| 379 | { |
| 380 | if (handler) |
| 381 | { |
| 382 | handler->handleRemovedMctpEndpoints(mctpInfos); |
| 383 | } |
Tom Joseph | fb3bc06 | 2021-08-17 07:48:11 -0700 | [diff] [blame] | 384 | } |
| 385 | } |
| 386 | |
Chau Ly | 75e0042 | 2024-03-19 12:33:08 +0000 | [diff] [blame] | 387 | void MctpDiscovery::updateMctpEndpointAvailability(const MctpInfo& mctpInfo, |
| 388 | Availability availability) |
| 389 | { |
| 390 | for (const auto& handler : handlers) |
| 391 | { |
| 392 | if (handler) |
| 393 | { |
| 394 | handler->updateMctpEndpointAvailability(mctpInfo, availability); |
| 395 | } |
| 396 | } |
| 397 | } |
| 398 | |
Andrew Jeffery | 27a022c | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 399 | } // namespace pldm |