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