diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rwxr-xr-x | Makefile.am | 9 | ||||
-rwxr-xr-x | configure.ac | 5 | ||||
-rw-r--r-- | download_manager.cpp | 19 | ||||
-rw-r--r-- | download_manager.hpp | 46 | ||||
-rw-r--r-- | download_manager_main.cpp | 24 |
6 files changed, 103 insertions, 1 deletions
@@ -42,6 +42,7 @@ Makefile.in /config.log /config.status /phosphor-version-software-manager +/phosphor-download-manager Makefile .deps *-libtool diff --git a/Makefile.am b/Makefile.am index 1527ac8..92a318e 100755 --- a/Makefile.am +++ b/Makefile.am @@ -1,14 +1,21 @@ AM_DEFAULT_SOURCE_EXT = .cpp sbin_PROGRAMS = \ - phosphor-version-software-manager + phosphor-version-software-manager \ + phosphor-download-manager phosphor_version_software_manager_SOURCES = \ version_software_manager.cpp \ version_software_manager_main.cpp +phosphor_download_manager_SOURCES = \ + download_manager.cpp \ + download_manager_main.cpp + generic_cxxflags = $(SYSTEMD_CFLAGS) $(PHOSPHOR_DBUS_INTERFACES_CFLAGS) $(SDBUSPLUS_CFLAGS) generic_ldflags = $(SYSTEMD_LIBS) $(PHOSPHOR_DBUS_INTERFACES_LIBS) $(SDBUSPLUS_LIBS) phosphor_version_software_manager_CXXFLAGS = $(generic_cxxflags) phosphor_version_software_manager_LDFLAGS = $(generic_ldflags) +phosphor_download_manager_CXXFLAGS = $(generic_cxxflags) +phosphor_download_manager_LDFLAGS = $(generic_ldflags) diff --git a/configure.ac b/configure.ac index 6b2a5e1..af227ae 100755 --- a/configure.ac +++ b/configure.ac @@ -32,6 +32,11 @@ AC_ARG_VAR(SOFTWARE_OBJPATH, [The version software manager Dbus root]) AS_IF([test "x$SOFTWARE_OBJPATH" == "x"], [SOFTWARE_OBJPATH="/xyz/openbmc_project/software"]) AC_DEFINE_UNQUOTED([SOFTWARE_OBJPATH], ["$SOFTWARE_OBJPATH"], [The version software manager Dbus root]) +AC_ARG_VAR(DOWNLOAD_BUSNAME, [The Dbus busname to own]) +AS_IF([test "x$DOWNLOAD_BUSNAME" == "x"], + [DOWNLOAD_BUSNAME="xyz.openbmc_project.Software.Download"]) +AC_DEFINE_UNQUOTED([DOWNLOAD_BUSNAME], ["$DOWNLOAD_BUSNAME"], [The DBus busname to own]) + # Check for header files. AC_CHECK_HEADER(systemd/sd-bus.h, ,[AC_MSG_ERROR([Could not find systemd/sd-bus.h...systemd developement package required])]) AC_CHECK_HEADER(sdbusplus/server.hpp, ,[AC_MSG_ERROR([Could not find sdbusplus/server.hpp...openbmc/sdbusplus package required])]) diff --git a/download_manager.cpp b/download_manager.cpp new file mode 100644 index 0000000..c4c2cd3 --- /dev/null +++ b/download_manager.cpp @@ -0,0 +1,19 @@ +#include "download_manager.hpp" + +namespace phosphor +{ +namespace software +{ +namespace manager +{ + +void Download::downloadViaTFTP(const std::string fileName, + const std::string serverAddress) +{ + return; +} + +} // namespace manager +} // namespace software +} // namespace phosphor + diff --git a/download_manager.hpp b/download_manager.hpp new file mode 100644 index 0000000..b78dc4b --- /dev/null +++ b/download_manager.hpp @@ -0,0 +1,46 @@ +#pragma once + +#include <sdbusplus/bus.hpp> +#include "xyz/openbmc_project/Common/TFTP/server.hpp" + +namespace phosphor +{ +namespace software +{ +namespace manager +{ + +using DownloadInherit = sdbusplus::server::object::object< + sdbusplus::xyz::openbmc_project::Common::server::TFTP>; + +/** @class Download + * @brief OpenBMC download software management implementation. + * @details A concrete implementation for xyz.openbmc_project.Common.TFTP + * DBus API. + */ +class Download : public DownloadInherit +{ + public: + /** @brief Constructs Download Software Manager + * + * @param[in] bus - The Dbus bus object + * @param[in] objPath - The Dbus object path + */ + Download(sdbusplus::bus::bus& bus, + const std::string& objPath) : DownloadInherit( + bus, (objPath).c_str()) {}; + + /** + * @brief Download the specified image via TFTP + * + * @param[in] fileName - The name of the file to transfer. + * @param[in] serverAddress - The TFTP Server IP Address. + **/ + void downloadViaTFTP(const std::string fileName, + const std::string serverAddress) override; +}; + +} // namespace manager +} // namespace software +} // namespace phosphor + diff --git a/download_manager_main.cpp b/download_manager_main.cpp new file mode 100644 index 0000000..e32e8c8 --- /dev/null +++ b/download_manager_main.cpp @@ -0,0 +1,24 @@ +#include <sdbusplus/bus.hpp> +#include "config.h" +#include "download_manager.hpp" + +int main(int argc, char* argv[]) +{ + auto bus = sdbusplus::bus::new_default(); + + // Add sdbusplus ObjectManager. + sdbusplus::server::manager::manager objManager(bus, + SOFTWARE_OBJPATH); + + phosphor::software::manager::Download manager(bus, + SOFTWARE_OBJPATH); + + bus.request_name(DOWNLOAD_BUSNAME); + + while (true) + { + bus.process_discard(); + bus.wait(); + } + return 0; +} |