1 #pragma once
2 
3 #include <sdbusplus/bus.hpp>
4 #include <sdbusplus/server/object.hpp>
5 #include <stdplus/zstring.hpp>
6 #include <string>
7 #include <xyz/openbmc_project/Network/SystemConfiguration/server.hpp>
8 
9 namespace phosphor
10 {
11 namespace network
12 {
13 
14 using SystemConfigIntf =
15     sdbusplus::xyz::openbmc_project::Network::server::SystemConfiguration;
16 
17 using Iface = sdbusplus::server::object_t<SystemConfigIntf>;
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 {
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;
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      */
41     SystemConfiguration(sdbusplus::bus_t& bus, stdplus::const_zstring objPath);
42 
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;
47 
48   private:
49     /** @brief get the hostname from the system by doing
50      *         dbus call to hostnamed service.
51      */
52     std::string getHostNameFromSystem() const;
53 
54     /** @brief Persistent sdbusplus DBus bus connection. */
55     sdbusplus::bus_t& bus;
56 };
57 
58 } // namespace network
59 } // namespace phosphor
60