Asmitha Karunanithi | eb40f08 | 2021-07-22 06:13:04 -0500 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include "hyp_network_manager.hpp" |
| 4 | #include "system_configuration.hpp" |
| 5 | |
| 6 | #include <sdbusplus/bus.hpp> |
| 7 | #include <sdbusplus/server/object.hpp> |
| 8 | #include <string> |
| 9 | #include <xyz/openbmc_project/Network/SystemConfiguration/server.hpp> |
| 10 | |
| 11 | namespace phosphor |
| 12 | { |
| 13 | namespace network |
| 14 | { |
| 15 | |
| 16 | using SysConfigIntf = |
| 17 | sdbusplus::xyz::openbmc_project::Network::server::SystemConfiguration; |
| 18 | |
Patrick Williams | c38b071 | 2022-07-22 19:26:54 -0500 | [diff] [blame] | 19 | using Iface = sdbusplus::server::object_t<SysConfigIntf>; |
Asmitha Karunanithi | eb40f08 | 2021-07-22 06:13:04 -0500 | [diff] [blame] | 20 | |
| 21 | class HypNetworkMgr; // forward declaration of network manager. |
| 22 | |
| 23 | /** @class HypSysConfig |
| 24 | * @brief Network system configuration. |
| 25 | * @details A concrete implementation for the |
| 26 | * xyz.openbmc_project.Network.HypSysConfig DBus API. |
| 27 | */ |
| 28 | class HypSysConfig : public Iface |
| 29 | { |
| 30 | public: |
| 31 | HypSysConfig() = default; |
| 32 | HypSysConfig(const HypSysConfig&) = delete; |
| 33 | HypSysConfig& operator=(const HypSysConfig&) = delete; |
| 34 | HypSysConfig(HypSysConfig&&) = delete; |
| 35 | HypSysConfig& operator=(HypSysConfig&&) = delete; |
| 36 | virtual ~HypSysConfig() = default; |
| 37 | |
| 38 | /** @brief Constructor to put object onto bus at a dbus path. |
| 39 | * @param[in] bus - Bus to attach to. |
| 40 | * @param[in] objPath - Path to attach at. |
| 41 | * @param[in] parent - Parent object. |
| 42 | */ |
Patrick Williams | c38b071 | 2022-07-22 19:26:54 -0500 | [diff] [blame] | 43 | HypSysConfig(sdbusplus::bus_t& bus, const std::string& objPath, |
Asmitha Karunanithi | eb40f08 | 2021-07-22 06:13:04 -0500 | [diff] [blame] | 44 | HypNetworkMgr& parent) : |
| 45 | Iface(bus, objPath.c_str(), Iface::action::defer_emit), |
| 46 | bus(bus), manager(parent){}; |
| 47 | |
| 48 | /** @brief set the hostname of the system. |
| 49 | * @param[in] name - host name of the system. |
| 50 | */ |
| 51 | std::string hostName(std::string name) override; |
| 52 | |
| 53 | /** @brief get hostname from bios and set the data member |
| 54 | */ |
| 55 | void setHostName(); |
| 56 | |
| 57 | protected: |
| 58 | /** @brief get the hostname from the system by doing |
| 59 | * dbus call to hostnamed service. |
| 60 | */ |
| 61 | std::string getHostNameFromBios() const; |
| 62 | |
| 63 | /** @brief set the hostname set in dbus obj in the basebiostable |
| 64 | * @param[in] name - hostname that is set in dbus obj |
| 65 | */ |
| 66 | void setHostNameInBios(const std::string& name); |
| 67 | |
| 68 | /** @brief Persistent sdbusplus DBus bus connection. */ |
Patrick Williams | c38b071 | 2022-07-22 19:26:54 -0500 | [diff] [blame] | 69 | sdbusplus::bus_t& bus; |
Asmitha Karunanithi | eb40f08 | 2021-07-22 06:13:04 -0500 | [diff] [blame] | 70 | |
| 71 | /** @brief Hyp Network Manager object. */ |
| 72 | HypNetworkMgr& manager; |
| 73 | }; |
| 74 | |
| 75 | } // namespace network |
| 76 | } // namespace phosphor |