Gunnar Mills | e91d321 | 2017-04-19 15:42:47 -0500 | [diff] [blame] | 1 | #pragma once |
Gunnar Mills | 3027bba | 2017-04-27 15:49:03 -0500 | [diff] [blame] | 2 | #include "version.hpp" |
Gunnar Mills | e91d321 | 2017-04-19 15:42:47 -0500 | [diff] [blame] | 3 | |
Gunnar Mills | b0ce996 | 2018-09-07 13:39:10 -0500 | [diff] [blame] | 4 | #include <sdbusplus/server.hpp> |
Adriana Kobylak | 58aa750 | 2020-06-08 11:12:11 -0500 | [diff] [blame] | 5 | |
Andrew Geissler | 9155b71 | 2020-05-16 13:04:44 -0500 | [diff] [blame] | 6 | #include <string> |
Gunnar Mills | b0ce996 | 2018-09-07 13:39:10 -0500 | [diff] [blame] | 7 | |
Gunnar Mills | e91d321 | 2017-04-19 15:42:47 -0500 | [diff] [blame] | 8 | namespace phosphor |
| 9 | { |
| 10 | namespace software |
| 11 | { |
| 12 | namespace manager |
| 13 | { |
| 14 | |
Gunnar Mills | 3027bba | 2017-04-27 15:49:03 -0500 | [diff] [blame] | 15 | /** @class Manager |
| 16 | * @brief Contains a map of Version dbus objects. |
| 17 | * @details The software image manager class that contains the Version dbus |
| 18 | * objects and their version ids. |
Gunnar Mills | e91d321 | 2017-04-19 15:42:47 -0500 | [diff] [blame] | 19 | */ |
Gunnar Mills | 3027bba | 2017-04-27 15:49:03 -0500 | [diff] [blame] | 20 | class Manager |
| 21 | { |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 22 | public: |
| 23 | /** @brief Constructs Manager Class |
| 24 | * |
| 25 | * @param[in] bus - The Dbus bus object |
| 26 | */ |
Lei YU | 0cd6d84 | 2021-12-27 11:56:02 +0800 | [diff] [blame^] | 27 | explicit Manager(sdbusplus::bus::bus& bus) : bus(bus){}; |
Gunnar Mills | e91d321 | 2017-04-19 15:42:47 -0500 | [diff] [blame] | 28 | |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 29 | /** |
| 30 | * @brief Verify and untar the tarball. Verify the manifest file. |
| 31 | * Create and populate the version and filepath interfaces. |
| 32 | * |
| 33 | * @param[in] tarballFilePath - Tarball path. |
| 34 | * @param[out] result - 0 if successful. |
| 35 | */ |
| 36 | int processImage(const std::string& tarballFilePath); |
Gunnar Mills | 3027bba | 2017-04-27 15:49:03 -0500 | [diff] [blame] | 37 | |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 38 | /** |
| 39 | * @brief Erase specified entry d-bus object |
| 40 | * and deletes the image file. |
| 41 | * |
| 42 | * @param[in] entryId - unique identifier of the entry |
| 43 | */ |
| 44 | void erase(std::string entryId); |
Leonel Gonzalez | 50d559c | 2017-07-07 14:38:25 -0500 | [diff] [blame] | 45 | |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 46 | private: |
| 47 | /** @brief Persistent map of Version dbus objects and their |
| 48 | * version id */ |
| 49 | std::map<std::string, std::unique_ptr<Version>> versions; |
Gunnar Mills | 3027bba | 2017-04-27 15:49:03 -0500 | [diff] [blame] | 50 | |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 51 | /** @brief Persistent sdbusplus DBus bus connection. */ |
| 52 | sdbusplus::bus::bus& bus; |
Gunnar Mills | 3027bba | 2017-04-27 15:49:03 -0500 | [diff] [blame] | 53 | |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 54 | /** |
| 55 | * @brief Untar the tarball. |
| 56 | * |
| 57 | * @param[in] tarballFilePath - Tarball path. |
| 58 | * @param[in] extractDirPath - Dir path to extract tarball ball to. |
| 59 | * @param[out] result - 0 if successful. |
| 60 | */ |
| 61 | static int unTar(const std::string& tarballFilePath, |
| 62 | const std::string& extractDirPath); |
Gunnar Mills | 3027bba | 2017-04-27 15:49:03 -0500 | [diff] [blame] | 63 | }; |
Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 64 | |
Gunnar Mills | e91d321 | 2017-04-19 15:42:47 -0500 | [diff] [blame] | 65 | } // namespace manager |
| 66 | } // namespace software |
| 67 | } // namespace phosphor |