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