blob: 6bbb83f2f39babc91588f62db455eb647d4951a7 [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>
William A. Kennington IIIbe3bd2f2022-10-11 14:11:27 -07005#include <stdplus/zstring.hpp>
Ratan Gupta82e1ef92017-06-15 08:39:15 +05306#include <string>
Patrick Venture189d44e2018-07-09 12:30:59 -07007#include <xyz/openbmc_project/Network/SystemConfiguration/server.hpp>
Ratan Gupta82e1ef92017-06-15 08:39:15 +05308
9namespace phosphor
10{
11namespace network
12{
13
14using SystemConfigIntf =
15 sdbusplus::xyz::openbmc_project::Network::server::SystemConfiguration;
16
Patrick Williamsc38b0712022-07-22 19:26:54 -050017using Iface = sdbusplus::server::object_t<SystemConfigIntf>;
Ratan Gupta82e1ef92017-06-15 08:39:15 +053018
19class 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 */
26class SystemConfiguration : public Iface
27{
Gunnar Mills57d9c502018-09-14 14:42:34 -050028 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 Gupta82e1ef92017-06-15 08:39:15 +053035
Gunnar Mills57d9c502018-09-14 14:42:34 -050036 /** @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 IIIbe3bd2f2022-10-11 14:11:27 -070041 SystemConfiguration(sdbusplus::bus_t& bus, stdplus::const_zstring objPath);
Ratan Gupta82e1ef92017-06-15 08:39:15 +053042
Gunnar Mills57d9c502018-09-14 14:42:34 -050043 /** @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 Gupta82e1ef92017-06-15 08:39:15 +053047
Gunnar Mills57d9c502018-09-14 14:42:34 -050048 private:
49 /** @brief get the hostname from the system by doing
50 * dbus call to hostnamed service.
51 */
52 std::string getHostNameFromSystem() const;
Ratan Gupta82e1ef92017-06-15 08:39:15 +053053
Gunnar Mills57d9c502018-09-14 14:42:34 -050054 /** @brief Persistent sdbusplus DBus bus connection. */
Patrick Williamsc38b0712022-07-22 19:26:54 -050055 sdbusplus::bus_t& bus;
Ratan Gupta82e1ef92017-06-15 08:39:15 +053056};
57
58} // namespace network
59} // namespace phosphor