// SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: Copyright OpenBMC Authors // SPDX-FileCopyrightText: Copyright 2018 Intel Corporation #pragma once #include "boost_formatters.hpp" #include "dbus_singleton.hpp" #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace dbus { namespace utility { // clang-format off using DbusVariantType = std::variant< std::vector>, std::vector, std::vector, std::string, int64_t, uint64_t, double, int32_t, uint32_t, int16_t, uint16_t, uint8_t, bool, std::vector, std::vector, sdbusplus::message::object_path, std::tuple>>, std::vector, std::vector>, std::vector>>, std::vector>, std::vector>, std::string, std::string, uint64_t>>, std::vector>, std::vector>, std::vector> >; // clang-format on using DBusPropertiesMap = std::vector>; using DBusInterfacesMap = std::vector>; using ManagedObjectType = std::vector>; // Map of service name to list of interfaces using MapperServiceMap = std::vector>>; // Map of object paths to MapperServiceMaps using MapperGetSubTreeResponse = std::vector>; using MapperGetObject = std::vector>>; using MapperGetAncestorsResponse = std::vector< std::pair>>>>; using MapperGetSubTreePathsResponse = std::vector; using MapperEndPoints = std::vector; void escapePathForDbus(std::string& path); void logError(const boost::system::error_code& ec); // gets the string N strings deep into a path // i.e. /0th/1st/2nd/3rd bool getNthStringFromPath(const std::string& path, int index, std::string& result); void getAllProperties(const std::string& service, const std::string& objectPath, const std::string& interface, std::function&& callback); template void getProperty(const std::string& service, const std::string& objectPath, const std::string& interface, const std::string& propertyName, std::function&& callback) { sdbusplus::asio::getProperty( *crow::connections::systemBus, service, objectPath, interface, propertyName, std::move(callback)); } template void getProperty(sdbusplus::asio::connection& /*conn*/, const std::string& service, const std::string& objectPath, const std::string& interface, const std::string& propertyName, std::function&& callback) { getProperty(service, objectPath, interface, propertyName, std::move(callback)); } void getAllProperties(sdbusplus::asio::connection& /*conn*/, const std::string& service, const std::string& objectPath, const std::string& interface, std::function&& callback); void checkDbusPathExists(const std::string& path, std::function&& callback); void getSubTree( const std::string& path, int32_t depth, std::span interfaces, std::function&& callback); void getSubTreePaths( const std::string& path, int32_t depth, std::span interfaces, std::function&& callback); void getAssociatedSubTree( const sdbusplus::message::object_path& associatedPath, const sdbusplus::message::object_path& path, int32_t depth, std::span interfaces, std::function&& callback); void getAssociatedSubTreePaths( const sdbusplus::message::object_path& associatedPath, const sdbusplus::message::object_path& path, int32_t depth, std::span interfaces, std::function&& callback); void getAssociatedSubTreeById( const std::string& id, const std::string& path, std::span subtreeInterfaces, std::string_view association, std::span endpointInterfaces, std::function&& callback); void getAssociatedSubTreePathsById( const std::string& id, const std::string& path, std::span subtreeInterfaces, std::string_view association, std::span endpointInterfaces, std::function&& callback); void getDbusObject(const std::string& path, std::span interfaces, std::function&& callback); void getAssociationEndPoints( const std::string& path, std::function&& callback); void getManagedObjects( const std::string& service, const sdbusplus::message::object_path& path, std::function&& callback); } // namespace utility } // namespace dbus