Ratan Gupta | 82e1ef9 | 2017-06-15 08:39:15 +0530 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Ratan Gupta | 82e1ef9 | 2017-06-15 08:39:15 +0530 | [diff] [blame] | 3 | #include <sdbusplus/bus.hpp> |
| 4 | #include <sdbusplus/server/object.hpp> |
William A. Kennington III | be3bd2f | 2022-10-11 14:11:27 -0700 | [diff] [blame] | 5 | #include <stdplus/zstring.hpp> |
Ratan Gupta | 82e1ef9 | 2017-06-15 08:39:15 +0530 | [diff] [blame] | 6 | #include <string> |
Patrick Venture | 189d44e | 2018-07-09 12:30:59 -0700 | [diff] [blame] | 7 | #include <xyz/openbmc_project/Network/SystemConfiguration/server.hpp> |
Ratan Gupta | 82e1ef9 | 2017-06-15 08:39:15 +0530 | [diff] [blame] | 8 | |
| 9 | namespace phosphor |
| 10 | { |
| 11 | namespace network |
| 12 | { |
| 13 | |
| 14 | using SystemConfigIntf = |
| 15 | sdbusplus::xyz::openbmc_project::Network::server::SystemConfiguration; |
| 16 | |
Patrick Williams | c38b071 | 2022-07-22 19:26:54 -0500 | [diff] [blame] | 17 | using Iface = sdbusplus::server::object_t<SystemConfigIntf>; |
Ratan Gupta | 82e1ef9 | 2017-06-15 08:39:15 +0530 | [diff] [blame] | 18 | |
| 19 | class Manager; // forward declaration of network manager. |
| 20 | |
| 21 | /** @class SystemConfiguration |
| 22 | * @brief Network system configuration. |
| 23 | * @details A concrete implementation for the |
| 24 | * xyz.openbmc_project.Network.SystemConfiguration DBus API. |
| 25 | */ |
| 26 | class SystemConfiguration : public Iface |
| 27 | { |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 28 | public: |
| 29 | SystemConfiguration() = default; |
| 30 | SystemConfiguration(const SystemConfiguration&) = delete; |
| 31 | SystemConfiguration& operator=(const SystemConfiguration&) = delete; |
| 32 | SystemConfiguration(SystemConfiguration&&) = delete; |
| 33 | SystemConfiguration& operator=(SystemConfiguration&&) = delete; |
| 34 | virtual ~SystemConfiguration() = default; |
Ratan Gupta | 82e1ef9 | 2017-06-15 08:39:15 +0530 | [diff] [blame] | 35 | |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 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 | */ |
William A. Kennington III | be3bd2f | 2022-10-11 14:11:27 -0700 | [diff] [blame] | 41 | SystemConfiguration(sdbusplus::bus_t& bus, stdplus::const_zstring objPath); |
Ratan Gupta | 82e1ef9 | 2017-06-15 08:39:15 +0530 | [diff] [blame] | 42 | |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 43 | /** @brief set the hostname of the system. |
| 44 | * @param[in] name - host name of the system. |
| 45 | */ |
| 46 | std::string hostName(std::string name) override; |
Ratan Gupta | 82e1ef9 | 2017-06-15 08:39:15 +0530 | [diff] [blame] | 47 | |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 48 | private: |
| 49 | /** @brief get the hostname from the system by doing |
| 50 | * dbus call to hostnamed service. |
| 51 | */ |
| 52 | std::string getHostNameFromSystem() const; |
Ratan Gupta | 82e1ef9 | 2017-06-15 08:39:15 +0530 | [diff] [blame] | 53 | |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 54 | /** @brief Persistent sdbusplus DBus bus connection. */ |
Patrick Williams | c38b071 | 2022-07-22 19:26:54 -0500 | [diff] [blame] | 55 | sdbusplus::bus_t& bus; |
Ratan Gupta | 82e1ef9 | 2017-06-15 08:39:15 +0530 | [diff] [blame] | 56 | }; |
| 57 | |
| 58 | } // namespace network |
| 59 | } // namespace phosphor |