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