Brad Bishop | 49aefb3 | 2016-10-19 11:54:14 -0400 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Brad Bishop | 67b788d | 2016-11-29 13:09:01 -0500 | [diff] [blame] | 3 | #include "events.hpp" |
Brad Bishop | c1f4798 | 2017-02-09 01:27:38 -0500 | [diff] [blame] | 4 | #include "functor.hpp" |
Deepak Kodihalli | 6620e98 | 2017-08-05 13:09:54 -0500 | [diff] [blame] | 5 | #include "serialize.hpp" |
Patrick Venture | a680d1e | 2018-10-14 13:34:26 -0700 | [diff] [blame] | 6 | #include "types.hpp" |
| 7 | |
| 8 | #include <map> |
| 9 | #include <memory> |
| 10 | #include <sdbusplus/server.hpp> |
| 11 | #include <string> |
| 12 | #include <vector> |
| 13 | #include <xyz/openbmc_project/Inventory/Manager/server.hpp> |
Brad Bishop | 49aefb3 | 2016-10-19 11:54:14 -0400 | [diff] [blame] | 14 | |
| 15 | namespace phosphor |
| 16 | { |
| 17 | namespace inventory |
| 18 | { |
| 19 | namespace manager |
| 20 | { |
Brad Bishop | 451f8d9 | 2016-11-21 14:15:19 -0500 | [diff] [blame] | 21 | |
Patrick Venture | a680d1e | 2018-10-14 13:34:26 -0700 | [diff] [blame] | 22 | template <typename T> |
| 23 | using ServerObject = T; |
Brad Bishop | 451f8d9 | 2016-11-21 14:15:19 -0500 | [diff] [blame] | 24 | |
| 25 | using ManagerIface = |
Brad Bishop | 9aa5e2f | 2017-01-15 19:45:40 -0500 | [diff] [blame] | 26 | sdbusplus::xyz::openbmc_project::Inventory::server::Manager; |
Brad Bishop | 451f8d9 | 2016-11-21 14:15:19 -0500 | [diff] [blame] | 27 | |
Brad Bishop | 79ccaf7 | 2017-01-22 16:00:50 -0500 | [diff] [blame] | 28 | /** @struct PropertiesVariant |
| 29 | * @brief Wrapper for sdbusplus PropertiesVariant. |
| 30 | * |
| 31 | * A wrapper is useful since MakeInterface is instantiated with 'int' |
| 32 | * to deduce the return type of its methods, which does not depend |
| 33 | * on T. |
| 34 | * |
| 35 | * @tparam T - The sdbusplus server binding type. |
| 36 | */ |
Patrick Venture | a680d1e | 2018-10-14 13:34:26 -0700 | [diff] [blame] | 37 | template <typename T, typename Enable = void> |
| 38 | struct PropertiesVariant |
Brad Bishop | 615b2a8 | 2018-03-29 10:32:41 -0400 | [diff] [blame] | 39 | { |
| 40 | }; |
Brad Bishop | 79ccaf7 | 2017-01-22 16:00:50 -0500 | [diff] [blame] | 41 | |
| 42 | template <typename T> |
Brad Bishop | 615b2a8 | 2018-03-29 10:32:41 -0400 | [diff] [blame] | 43 | struct PropertiesVariant< |
| 44 | T, typename std::enable_if<std::is_object<T>::value>::type> |
Brad Bishop | 79ccaf7 | 2017-01-22 16:00:50 -0500 | [diff] [blame] | 45 | { |
| 46 | using Type = typename T::PropertiesVariant; |
| 47 | }; |
| 48 | |
| 49 | template <typename T> |
| 50 | using PropertiesVariantType = typename PropertiesVariant<T>::Type; |
| 51 | |
Patrick Venture | a680d1e | 2018-10-14 13:34:26 -0700 | [diff] [blame] | 52 | template <typename T, typename U = int> |
| 53 | struct HasProperties : std::false_type |
Marri Devender Rao | fa23d70 | 2017-09-02 04:43:42 -0500 | [diff] [blame] | 54 | { |
| 55 | }; |
| 56 | |
| 57 | template <typename T> |
Brad Bishop | 615b2a8 | 2018-03-29 10:32:41 -0400 | [diff] [blame] | 58 | struct HasProperties< |
| 59 | T, decltype((void)std::declval<typename T::PropertiesVariant>(), 0)> |
| 60 | : std::true_type |
Marri Devender Rao | fa23d70 | 2017-09-02 04:43:42 -0500 | [diff] [blame] | 61 | { |
| 62 | }; |
| 63 | |
| 64 | template <typename T, std::enable_if_t<HasProperties<T>::value, bool> = true> |
Brad Bishop | 615b2a8 | 2018-03-29 10:32:41 -0400 | [diff] [blame] | 65 | any_ns::any propMake(sdbusplus::bus::bus& bus, const char* path, |
| 66 | const Interface& props) |
Marri Devender Rao | fa23d70 | 2017-09-02 04:43:42 -0500 | [diff] [blame] | 67 | { |
Brad Bishop | 615b2a8 | 2018-03-29 10:32:41 -0400 | [diff] [blame] | 68 | using InterfaceVariant = std::map<std::string, PropertiesVariantType<T>>; |
Marri Devender Rao | fa23d70 | 2017-09-02 04:43:42 -0500 | [diff] [blame] | 69 | |
| 70 | InterfaceVariant v; |
| 71 | for (const auto& p : props) |
| 72 | { |
Brad Bishop | 615b2a8 | 2018-03-29 10:32:41 -0400 | [diff] [blame] | 73 | v.emplace(p.first, convertVariant<PropertiesVariantType<T>>(p.second)); |
Marri Devender Rao | fa23d70 | 2017-09-02 04:43:42 -0500 | [diff] [blame] | 74 | } |
| 75 | |
| 76 | return any_ns::any(std::make_shared<T>(bus, path, v)); |
| 77 | } |
| 78 | |
| 79 | template <typename T, std::enable_if_t<!HasProperties<T>::value, bool> = false> |
Brad Bishop | 615b2a8 | 2018-03-29 10:32:41 -0400 | [diff] [blame] | 80 | any_ns::any propMake(sdbusplus::bus::bus& bus, const char* path, |
| 81 | const Interface& props) |
Marri Devender Rao | fa23d70 | 2017-09-02 04:43:42 -0500 | [diff] [blame] | 82 | { |
| 83 | return any_ns::any(std::make_shared<T>(bus, path)); |
| 84 | } |
| 85 | |
| 86 | template <typename T, std::enable_if_t<HasProperties<T>::value, bool> = true> |
| 87 | void propAssign(const Interface& props, any_ns::any& holder) |
| 88 | { |
Brad Bishop | 615b2a8 | 2018-03-29 10:32:41 -0400 | [diff] [blame] | 89 | auto& iface = *any_ns::any_cast<std::shared_ptr<T>&>(holder); |
Marri Devender Rao | fa23d70 | 2017-09-02 04:43:42 -0500 | [diff] [blame] | 90 | for (const auto& p : props) |
| 91 | { |
| 92 | iface.setPropertyByName( |
| 93 | p.first, convertVariant<PropertiesVariantType<T>>(p.second)); |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | template <typename T, std::enable_if_t<!HasProperties<T>::value, bool> = false> |
| 98 | void propAssign(const Interface& props, any_ns::any& holder) |
| 99 | { |
| 100 | } |
| 101 | |
| 102 | template <typename T, std::enable_if_t<HasProperties<T>::value, bool> = true> |
Brad Bishop | 615b2a8 | 2018-03-29 10:32:41 -0400 | [diff] [blame] | 103 | void propSerialize(const std::string& path, const std::string& iface, |
| 104 | const any_ns::any& holder) |
Marri Devender Rao | fa23d70 | 2017-09-02 04:43:42 -0500 | [diff] [blame] | 105 | { |
Brad Bishop | 615b2a8 | 2018-03-29 10:32:41 -0400 | [diff] [blame] | 106 | const auto& object = *any_ns::any_cast<const std::shared_ptr<T>&>(holder); |
Marri Devender Rao | fa23d70 | 2017-09-02 04:43:42 -0500 | [diff] [blame] | 107 | cereal::serialize(path, iface, object); |
| 108 | } |
| 109 | |
| 110 | template <typename T, std::enable_if_t<!HasProperties<T>::value, bool> = false> |
Brad Bishop | 615b2a8 | 2018-03-29 10:32:41 -0400 | [diff] [blame] | 111 | void propSerialize(const std::string& path, const std::string& iface, |
| 112 | const any_ns::any& holder) |
Marri Devender Rao | fa23d70 | 2017-09-02 04:43:42 -0500 | [diff] [blame] | 113 | { |
| 114 | cereal::serialize(path, iface); |
| 115 | } |
| 116 | |
| 117 | template <typename T, std::enable_if_t<HasProperties<T>::value, bool> = true> |
Brad Bishop | 615b2a8 | 2018-03-29 10:32:41 -0400 | [diff] [blame] | 118 | void propDeSerialize(const std::string& path, const std::string& iface, |
| 119 | any_ns::any& holder) |
Marri Devender Rao | fa23d70 | 2017-09-02 04:43:42 -0500 | [diff] [blame] | 120 | { |
Brad Bishop | 615b2a8 | 2018-03-29 10:32:41 -0400 | [diff] [blame] | 121 | auto& object = *any_ns::any_cast<std::shared_ptr<T>&>(holder); |
Marri Devender Rao | fa23d70 | 2017-09-02 04:43:42 -0500 | [diff] [blame] | 122 | cereal::deserialize(path, iface, object); |
| 123 | } |
| 124 | |
| 125 | template <typename T, std::enable_if_t<!HasProperties<T>::value, bool> = false> |
Brad Bishop | 615b2a8 | 2018-03-29 10:32:41 -0400 | [diff] [blame] | 126 | void propDeSerialize(const std::string& path, const std::string& iface, |
| 127 | any_ns::any& holder) |
Marri Devender Rao | fa23d70 | 2017-09-02 04:43:42 -0500 | [diff] [blame] | 128 | { |
| 129 | } |
| 130 | |
Brad Bishop | 65ffffa | 2016-11-29 12:31:31 -0500 | [diff] [blame] | 131 | /** @struct MakeInterface |
| 132 | * @brief Adapt an sdbusplus interface proxy. |
| 133 | * |
| 134 | * Template instances are builder functions that create |
| 135 | * adapted sdbusplus interface proxy interface objects. |
| 136 | * |
| 137 | * @tparam T - The type of the interface being adapted. |
| 138 | */ |
Brad Bishop | 79ccaf7 | 2017-01-22 16:00:50 -0500 | [diff] [blame] | 139 | |
Patrick Venture | a680d1e | 2018-10-14 13:34:26 -0700 | [diff] [blame] | 140 | template <typename T> |
| 141 | struct MakeInterface |
Brad Bishop | 65ffffa | 2016-11-29 12:31:31 -0500 | [diff] [blame] | 142 | { |
Brad Bishop | 615b2a8 | 2018-03-29 10:32:41 -0400 | [diff] [blame] | 143 | static any_ns::any make(sdbusplus::bus::bus& bus, const char* path, |
| 144 | const Interface& props) |
Brad Bishop | 65ffffa | 2016-11-29 12:31:31 -0500 | [diff] [blame] | 145 | { |
Marri Devender Rao | fa23d70 | 2017-09-02 04:43:42 -0500 | [diff] [blame] | 146 | return propMake<T>(bus, path, props); |
Brad Bishop | 65ffffa | 2016-11-29 12:31:31 -0500 | [diff] [blame] | 147 | } |
Brad Bishop | 79ccaf7 | 2017-01-22 16:00:50 -0500 | [diff] [blame] | 148 | |
| 149 | static void assign(const Interface& props, any_ns::any& holder) |
| 150 | { |
Marri Devender Rao | fa23d70 | 2017-09-02 04:43:42 -0500 | [diff] [blame] | 151 | propAssign<T>(props, holder); |
Brad Bishop | 79ccaf7 | 2017-01-22 16:00:50 -0500 | [diff] [blame] | 152 | } |
Deepak Kodihalli | 6620e98 | 2017-08-05 13:09:54 -0500 | [diff] [blame] | 153 | |
Brad Bishop | 615b2a8 | 2018-03-29 10:32:41 -0400 | [diff] [blame] | 154 | static void serialize(const std::string& path, const std::string& iface, |
| 155 | const any_ns::any& holder) |
Deepak Kodihalli | 6620e98 | 2017-08-05 13:09:54 -0500 | [diff] [blame] | 156 | { |
Marri Devender Rao | fa23d70 | 2017-09-02 04:43:42 -0500 | [diff] [blame] | 157 | propSerialize<T>(path, iface, holder); |
Deepak Kodihalli | 6620e98 | 2017-08-05 13:09:54 -0500 | [diff] [blame] | 158 | } |
Deepak Kodihalli | b28990f | 2017-08-08 07:19:34 -0500 | [diff] [blame] | 159 | |
Brad Bishop | 615b2a8 | 2018-03-29 10:32:41 -0400 | [diff] [blame] | 160 | static void deserialize(const std::string& path, const std::string& iface, |
| 161 | any_ns::any& holder) |
Deepak Kodihalli | b28990f | 2017-08-08 07:19:34 -0500 | [diff] [blame] | 162 | { |
Marri Devender Rao | fa23d70 | 2017-09-02 04:43:42 -0500 | [diff] [blame] | 163 | propDeSerialize<T>(path, iface, holder); |
Deepak Kodihalli | b28990f | 2017-08-08 07:19:34 -0500 | [diff] [blame] | 164 | } |
Brad Bishop | 65ffffa | 2016-11-29 12:31:31 -0500 | [diff] [blame] | 165 | }; |
Brad Bishop | 49aefb3 | 2016-10-19 11:54:14 -0400 | [diff] [blame] | 166 | |
| 167 | /** @class Manager |
| 168 | * @brief OpenBMC inventory manager implementation. |
| 169 | * |
| 170 | * A concrete implementation for the xyz.openbmc_project.Inventory.Manager |
| 171 | * DBus API. |
| 172 | */ |
Brad Bishop | 615b2a8 | 2018-03-29 10:32:41 -0400 | [diff] [blame] | 173 | class Manager final : public ServerObject<ManagerIface> |
Brad Bishop | 49aefb3 | 2016-10-19 11:54:14 -0400 | [diff] [blame] | 174 | { |
Brad Bishop | 615b2a8 | 2018-03-29 10:32:41 -0400 | [diff] [blame] | 175 | public: |
| 176 | Manager() = delete; |
| 177 | Manager(const Manager&) = delete; |
| 178 | Manager& operator=(const Manager&) = delete; |
| 179 | Manager(Manager&&) = default; |
| 180 | Manager& operator=(Manager&&) = default; |
| 181 | ~Manager() = default; |
Brad Bishop | 49aefb3 | 2016-10-19 11:54:14 -0400 | [diff] [blame] | 182 | |
Brad Bishop | 615b2a8 | 2018-03-29 10:32:41 -0400 | [diff] [blame] | 183 | /** @brief Construct an inventory manager. |
| 184 | * |
| 185 | * @param[in] bus - An sdbusplus bus connection. |
| 186 | * @param[in] busname - The DBus busname to own. |
| 187 | * @param[in] root - The DBus path on which to implement |
| 188 | * an inventory manager. |
| 189 | * @param[in] iface - The DBus inventory interface to implement. |
| 190 | */ |
| 191 | Manager(sdbusplus::bus::bus&&, const char*, const char*, const char*); |
Brad Bishop | 49aefb3 | 2016-10-19 11:54:14 -0400 | [diff] [blame] | 192 | |
Brad Bishop | 615b2a8 | 2018-03-29 10:32:41 -0400 | [diff] [blame] | 193 | using EventInfo = |
| 194 | std::tuple<std::vector<EventBasePtr>, std::vector<Action>>; |
Brad Bishop | 49aefb3 | 2016-10-19 11:54:14 -0400 | [diff] [blame] | 195 | |
Brad Bishop | 615b2a8 | 2018-03-29 10:32:41 -0400 | [diff] [blame] | 196 | /** @brief Start processing DBus messages. */ |
| 197 | void run() noexcept; |
Brad Bishop | 49aefb3 | 2016-10-19 11:54:14 -0400 | [diff] [blame] | 198 | |
Brad Bishop | 615b2a8 | 2018-03-29 10:32:41 -0400 | [diff] [blame] | 199 | /** @brief Provided for testing only. */ |
| 200 | void shutdown() noexcept; |
Brad Bishop | 49aefb3 | 2016-10-19 11:54:14 -0400 | [diff] [blame] | 201 | |
Brad Bishop | 615b2a8 | 2018-03-29 10:32:41 -0400 | [diff] [blame] | 202 | /** @brief sd_bus Notify method implementation callback. */ |
| 203 | void |
| 204 | notify(std::map<sdbusplus::message::object_path, Object> objs) override; |
Brad Bishop | 49aefb3 | 2016-10-19 11:54:14 -0400 | [diff] [blame] | 205 | |
Brad Bishop | 615b2a8 | 2018-03-29 10:32:41 -0400 | [diff] [blame] | 206 | /** @brief Event processing entry point. */ |
| 207 | void handleEvent(sdbusplus::message::message&, const Event& event, |
| 208 | const EventInfo& info); |
Brad Bishop | 49aefb3 | 2016-10-19 11:54:14 -0400 | [diff] [blame] | 209 | |
Brad Bishop | 615b2a8 | 2018-03-29 10:32:41 -0400 | [diff] [blame] | 210 | /** @brief Drop one or more objects from DBus. */ |
| 211 | void destroyObjects(const std::vector<const char*>& paths); |
Brad Bishop | 656a7d0 | 2016-10-19 22:20:02 -0400 | [diff] [blame] | 212 | |
Brad Bishop | 615b2a8 | 2018-03-29 10:32:41 -0400 | [diff] [blame] | 213 | /** @brief Add objects to DBus. */ |
| 214 | void createObjects( |
| 215 | const std::map<sdbusplus::message::object_path, Object>& objs); |
Brad Bishop | eb68a68 | 2017-01-22 00:58:54 -0500 | [diff] [blame] | 216 | |
Brad Bishop | 615b2a8 | 2018-03-29 10:32:41 -0400 | [diff] [blame] | 217 | /** @brief Add or update objects on DBus. */ |
| 218 | void updateObjects( |
| 219 | const std::map<sdbusplus::message::object_path, Object>& objs, |
| 220 | bool restoreFromCache = false); |
Deepak Kodihalli | b28990f | 2017-08-08 07:19:34 -0500 | [diff] [blame] | 221 | |
Brad Bishop | 615b2a8 | 2018-03-29 10:32:41 -0400 | [diff] [blame] | 222 | /** @brief Restore persistent inventory items */ |
| 223 | void restore(); |
Brad Bishop | 79ccaf7 | 2017-01-22 16:00:50 -0500 | [diff] [blame] | 224 | |
Brad Bishop | 615b2a8 | 2018-03-29 10:32:41 -0400 | [diff] [blame] | 225 | /** @brief Invoke an sdbusplus server binding method. |
| 226 | * |
| 227 | * Invoke the requested method with a reference to the requested |
| 228 | * sdbusplus server binding interface as a parameter. |
| 229 | * |
| 230 | * @tparam T - The sdbusplus server binding interface type. |
| 231 | * @tparam U - The type of the sdbusplus server binding member. |
| 232 | * @tparam Args - Argument types of the binding member. |
| 233 | * |
| 234 | * @param[in] path - The DBus path on which the method should |
| 235 | * be invoked. |
| 236 | * @param[in] interface - The DBus interface hosting the method. |
| 237 | * @param[in] member - Pointer to sdbusplus server binding member. |
| 238 | * @param[in] args - Arguments to forward to the binding member. |
| 239 | * |
| 240 | * @returns - The return/value type of the binding method being |
| 241 | * called. |
| 242 | */ |
| 243 | template <typename T, typename U, typename... Args> |
| 244 | decltype(auto) invokeMethod(const char* path, const char* interface, |
| 245 | U&& member, Args&&... args) |
| 246 | { |
| 247 | auto& iface = getInterface<T>(path, interface); |
| 248 | return (iface.*member)(std::forward<Args>(args)...); |
| 249 | } |
Brad Bishop | da649b1 | 2016-11-30 14:35:02 -0500 | [diff] [blame] | 250 | |
Brad Bishop | 615b2a8 | 2018-03-29 10:32:41 -0400 | [diff] [blame] | 251 | using SigArgs = std::vector<std::unique_ptr< |
| 252 | std::tuple<Manager*, const DbusSignal*, const EventInfo*>>>; |
| 253 | using SigArg = SigArgs::value_type::element_type; |
Brad Bishop | 49aefb3 | 2016-10-19 11:54:14 -0400 | [diff] [blame] | 254 | |
Brad Bishop | 615b2a8 | 2018-03-29 10:32:41 -0400 | [diff] [blame] | 255 | private: |
| 256 | using InterfaceComposite = std::map<std::string, any_ns::any>; |
| 257 | using ObjectReferences = std::map<std::string, InterfaceComposite>; |
| 258 | using Events = std::vector<EventInfo>; |
Brad Bishop | 90c30bc | 2017-01-22 16:40:47 -0500 | [diff] [blame] | 259 | |
Brad Bishop | 615b2a8 | 2018-03-29 10:32:41 -0400 | [diff] [blame] | 260 | // The int instantiations are safe since the signature of these |
| 261 | // functions don't change from one instantiation to the next. |
| 262 | using MakerType = std::add_pointer_t<decltype(MakeInterface<int>::make)>; |
| 263 | using AssignerType = |
| 264 | std::add_pointer_t<decltype(MakeInterface<int>::assign)>; |
| 265 | using SerializerType = |
| 266 | std::add_pointer_t<decltype(MakeInterface<int>::serialize)>; |
| 267 | using DeserializerType = |
| 268 | std::add_pointer_t<decltype(MakeInterface<int>::deserialize)>; |
| 269 | using Makers = |
| 270 | std::map<std::string, std::tuple<MakerType, AssignerType, |
| 271 | SerializerType, DeserializerType>>; |
Brad Bishop | 49aefb3 | 2016-10-19 11:54:14 -0400 | [diff] [blame] | 272 | |
Brad Bishop | 615b2a8 | 2018-03-29 10:32:41 -0400 | [diff] [blame] | 273 | /** @brief Provides weak references to interface holders. |
| 274 | * |
| 275 | * Common code for all types for the templated getInterface |
| 276 | * methods. |
| 277 | * |
| 278 | * @param[in] path - The DBus path for which the interface |
| 279 | * holder instance should be provided. |
| 280 | * @param[in] interface - The DBus interface for which the |
| 281 | * holder instance should be provided. |
| 282 | * |
| 283 | * @returns A weak reference to the holder instance. |
| 284 | */ |
| 285 | const any_ns::any& getInterfaceHolder(const char*, const char*) const; |
| 286 | any_ns::any& getInterfaceHolder(const char*, const char*); |
Brad Bishop | b83a21e | 2016-11-30 13:43:37 -0500 | [diff] [blame] | 287 | |
Brad Bishop | 615b2a8 | 2018-03-29 10:32:41 -0400 | [diff] [blame] | 288 | /** @brief Provides weak references to interface holders. |
| 289 | * |
| 290 | * @tparam T - The sdbusplus server binding interface type. |
| 291 | * |
| 292 | * @param[in] path - The DBus path for which the interface |
| 293 | * should be provided. |
| 294 | * @param[in] interface - The DBus interface to obtain. |
| 295 | * |
| 296 | * @returns A weak reference to the interface holder. |
| 297 | */ |
| 298 | template <typename T> |
| 299 | auto& getInterface(const char* path, const char* interface) |
| 300 | { |
| 301 | auto& holder = getInterfaceHolder(path, interface); |
| 302 | return *any_ns::any_cast<std::shared_ptr<T>&>(holder); |
| 303 | } |
| 304 | template <typename T> |
| 305 | auto& getInterface(const char* path, const char* interface) const |
| 306 | { |
| 307 | auto& holder = getInterfaceHolder(path, interface); |
| 308 | return *any_ns::any_cast<T>(holder); |
| 309 | } |
Brad Bishop | b83a21e | 2016-11-30 13:43:37 -0500 | [diff] [blame] | 310 | |
Brad Bishop | 615b2a8 | 2018-03-29 10:32:41 -0400 | [diff] [blame] | 311 | /** @brief Add or update interfaces on DBus. */ |
| 312 | void updateInterfaces(const sdbusplus::message::object_path& path, |
| 313 | const Object& interfaces, |
| 314 | ObjectReferences::iterator pos, |
| 315 | bool emitSignals = true, |
| 316 | bool restoreFromCache = false); |
Brad Bishop | 79ccaf7 | 2017-01-22 16:00:50 -0500 | [diff] [blame] | 317 | |
Brad Bishop | 615b2a8 | 2018-03-29 10:32:41 -0400 | [diff] [blame] | 318 | /** @brief Provided for testing only. */ |
| 319 | volatile bool _shutdown; |
Brad Bishop | 49aefb3 | 2016-10-19 11:54:14 -0400 | [diff] [blame] | 320 | |
Brad Bishop | 615b2a8 | 2018-03-29 10:32:41 -0400 | [diff] [blame] | 321 | /** @brief Path prefix applied to any relative paths. */ |
| 322 | const char* _root; |
Brad Bishop | 49aefb3 | 2016-10-19 11:54:14 -0400 | [diff] [blame] | 323 | |
Brad Bishop | 615b2a8 | 2018-03-29 10:32:41 -0400 | [diff] [blame] | 324 | /** @brief A container of sdbusplus server interface references. */ |
| 325 | ObjectReferences _refs; |
Brad Bishop | 49aefb3 | 2016-10-19 11:54:14 -0400 | [diff] [blame] | 326 | |
Brad Bishop | 615b2a8 | 2018-03-29 10:32:41 -0400 | [diff] [blame] | 327 | /** @brief A container contexts for signal callbacks. */ |
| 328 | SigArgs _sigargs; |
Brad Bishop | 49aefb3 | 2016-10-19 11:54:14 -0400 | [diff] [blame] | 329 | |
Brad Bishop | 615b2a8 | 2018-03-29 10:32:41 -0400 | [diff] [blame] | 330 | /** @brief A container of sdbusplus signal matches. */ |
| 331 | std::vector<sdbusplus::bus::match_t> _matches; |
Brad Bishop | 49aefb3 | 2016-10-19 11:54:14 -0400 | [diff] [blame] | 332 | |
Brad Bishop | 615b2a8 | 2018-03-29 10:32:41 -0400 | [diff] [blame] | 333 | /** @brief Persistent sdbusplus DBus bus connection. */ |
| 334 | sdbusplus::bus::bus _bus; |
Brad Bishop | 49aefb3 | 2016-10-19 11:54:14 -0400 | [diff] [blame] | 335 | |
Brad Bishop | 615b2a8 | 2018-03-29 10:32:41 -0400 | [diff] [blame] | 336 | /** @brief sdbusplus org.freedesktop.DBus.ObjectManager reference. */ |
| 337 | sdbusplus::server::manager::manager _manager; |
Brad Bishop | 49aefb3 | 2016-10-19 11:54:14 -0400 | [diff] [blame] | 338 | |
Brad Bishop | 615b2a8 | 2018-03-29 10:32:41 -0400 | [diff] [blame] | 339 | /** @brief A container of pimgen generated events and responses. */ |
| 340 | static const Events _events; |
Brad Bishop | 5fbaa7f | 2016-10-31 10:42:41 -0500 | [diff] [blame] | 341 | |
Brad Bishop | 615b2a8 | 2018-03-29 10:32:41 -0400 | [diff] [blame] | 342 | /** @brief A container of pimgen generated factory methods. */ |
| 343 | static const Makers _makers; |
Brad Bishop | 49aefb3 | 2016-10-19 11:54:14 -0400 | [diff] [blame] | 344 | }; |
| 345 | |
| 346 | } // namespace manager |
| 347 | } // namespace inventory |
| 348 | } // namespace phosphor |
| 349 | |
| 350 | // vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 |