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