blob: ac44539d048796e01ad46b863a61395aeb1743e7 [file] [log] [blame]
Gunnar Millse91d3212017-04-19 15:42:47 -05001#pragma once
Gunnar Mills3027bba2017-04-27 15:49:03 -05002#include "version.hpp"
Gunnar Millse91d3212017-04-19 15:42:47 -05003
4namespace phosphor
5{
6namespace software
7{
8namespace manager
9{
10
Gunnar Mills3027bba2017-04-27 15:49:03 -050011/** @class Manager
12 * @brief Contains a map of Version dbus objects.
13 * @details The software image manager class that contains the Version dbus
14 * objects and their version ids.
Gunnar Millse91d3212017-04-19 15:42:47 -050015 */
Gunnar Mills3027bba2017-04-27 15:49:03 -050016class Manager
17{
18 public:
19 /** @brief Constructs Manager Class
20 *
21 * @param[in] bus - The Dbus bus object
22 */
23 Manager(sdbusplus::bus::bus& bus) : bus(bus) {};
Gunnar Millse91d3212017-04-19 15:42:47 -050024
Gunnar Mills3027bba2017-04-27 15:49:03 -050025 /**
26 * @brief Verify and untar the tarball. Verify the manifest file.
27 * Create and populate the version and filepath interfaces.
28 *
29 * @param[in] tarballFilePath - Tarball path.
30 * @param[out] result - 0 if successful.
31 */
32 int processImage(const std::string& tarballFilePath);
33
34 private:
35 /** @brief Persistent map of Version dbus objects and their
36 * version id */
37 std::map<std::string, std::unique_ptr<Version>> versions;
38
39 /** @brief Persistent sdbusplus DBus bus connection. */
40 sdbusplus::bus::bus& bus;
41
42 /**
43 * @brief Untar the tarball.
44 *
45 * @param[in] tarballFilePath - Tarball path.
46 * @param[in] extractDirPath - Dir path to extract tarball ball to.
47 * @param[out] result - 0 if successful.
48 */
49 static int unTar(const std::string& tarballFilePath,
50 const std::string& extractDirPath);
51
52};
Gunnar Mills19e4ce52017-04-27 11:24:19 -050053
Gunnar Millse91d3212017-04-19 15:42:47 -050054} // namespace manager
55} // namespace software
56} // namespace phosphor