1 #pragma once
2 
3 #include <sdbusplus/bus.hpp>
4 #include <sdbusplus/bus/match.hpp>
5 #include <sdbusplus/server/object.hpp>
6 #include <stdplus/zstring.hpp>
7 #include <string>
8 #include <xyz/openbmc_project/Network/SystemConfiguration/server.hpp>
9 
10 namespace phosphor
11 {
12 namespace network
13 {
14 
15 using SystemConfigIntf =
16     sdbusplus::xyz::openbmc_project::Network::server::SystemConfiguration;
17 
18 using Iface = sdbusplus::server::object_t<SystemConfigIntf>;
19 
20 class Manager; // forward declaration of network manager.
21 
22 /** @class SystemConfiguration
23  *  @brief Network system configuration.
24  *  @details A concrete implementation for the
25  *  xyz.openbmc_project.Network.SystemConfiguration DBus API.
26  */
27 class SystemConfiguration : public Iface
28 {
29   public:
30     SystemConfiguration() = default;
31     SystemConfiguration(const SystemConfiguration&) = delete;
32     SystemConfiguration& operator=(const SystemConfiguration&) = delete;
33     SystemConfiguration(SystemConfiguration&&) = delete;
34     SystemConfiguration& operator=(SystemConfiguration&&) = delete;
35     virtual ~SystemConfiguration() = default;
36 
37     /** @brief Constructor to put object onto bus at a dbus path.
38      *  @param[in] bus - Bus to attach to.
39      *  @param[in] objPath - Path to attach at.
40      *  @param[in] parent - Parent object.
41      */
42     SystemConfiguration(sdbusplus::bus_t& bus, stdplus::const_zstring objPath);
43 
44     /** @brief set the hostname of the system.
45      *  @param[in] name - host name of the system.
46      */
47     std::string hostName(std::string name) override;
48 
49   private:
50     /** @brief Persistent sdbusplus DBus bus connection. */
51     sdbusplus::bus_t& bus;
52 
53     /** @brief Monitor for hostname changes */
54     sdbusplus::bus::match_t hostnamePropMatch;
55 };
56 
57 } // namespace network
58 } // namespace phosphor
59