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