blob: f5289cefd8cf987e60dc7e616277949806696536 [file] [log] [blame]
Ratan Gupta82e1ef92017-06-15 08:39:15 +05301#pragma once
2
Ratan Gupta82e1ef92017-06-15 08:39:15 +05303#include <sdbusplus/bus.hpp>
4#include <sdbusplus/server/object.hpp>
Ratan Gupta82e1ef92017-06-15 08:39:15 +05305#include <string>
Patrick Venture189d44e2018-07-09 12:30:59 -07006#include <xyz/openbmc_project/Network/SystemConfiguration/server.hpp>
Ratan Gupta82e1ef92017-06-15 08:39:15 +05307
8namespace phosphor
9{
10namespace network
11{
12
13using SystemConfigIntf =
14 sdbusplus::xyz::openbmc_project::Network::server::SystemConfiguration;
15
Patrick Williamsc38b0712022-07-22 19:26:54 -050016using Iface = sdbusplus::server::object_t<SystemConfigIntf>;
Ratan Gupta82e1ef92017-06-15 08:39:15 +053017
18class Manager; // forward declaration of network manager.
19
20/** @class SystemConfiguration
21 * @brief Network system configuration.
22 * @details A concrete implementation for the
23 * xyz.openbmc_project.Network.SystemConfiguration DBus API.
24 */
25class SystemConfiguration : public Iface
26{
Gunnar Mills57d9c502018-09-14 14:42:34 -050027 public:
28 SystemConfiguration() = default;
29 SystemConfiguration(const SystemConfiguration&) = delete;
30 SystemConfiguration& operator=(const SystemConfiguration&) = delete;
31 SystemConfiguration(SystemConfiguration&&) = delete;
32 SystemConfiguration& operator=(SystemConfiguration&&) = delete;
33 virtual ~SystemConfiguration() = default;
Ratan Gupta82e1ef92017-06-15 08:39:15 +053034
Gunnar Mills57d9c502018-09-14 14:42:34 -050035 /** @brief Constructor to put object onto bus at a dbus path.
36 * @param[in] bus - Bus to attach to.
37 * @param[in] objPath - Path to attach at.
38 * @param[in] parent - Parent object.
39 */
Patrick Williamsc38b0712022-07-22 19:26:54 -050040 SystemConfiguration(sdbusplus::bus_t& bus, const std::string& objPath);
Ratan Gupta82e1ef92017-06-15 08:39:15 +053041
Gunnar Mills57d9c502018-09-14 14:42:34 -050042 /** @brief set the hostname of the system.
43 * @param[in] name - host name of the system.
44 */
45 std::string hostName(std::string name) override;
Ratan Gupta82e1ef92017-06-15 08:39:15 +053046
Gunnar Mills57d9c502018-09-14 14:42:34 -050047 private:
48 /** @brief get the hostname from the system by doing
49 * dbus call to hostnamed service.
50 */
51 std::string getHostNameFromSystem() const;
Ratan Gupta82e1ef92017-06-15 08:39:15 +053052
Gunnar Mills57d9c502018-09-14 14:42:34 -050053 /** @brief Persistent sdbusplus DBus bus connection. */
Patrick Williamsc38b0712022-07-22 19:26:54 -050054 sdbusplus::bus_t& bus;
Ratan Gupta82e1ef92017-06-15 08:39:15 +053055};
56
57} // namespace network
58} // namespace phosphor