1 #pragma once
2 
3 #include <sdbusplus/bus.hpp>
4 #include <sdbusplus/bus/match.hpp>
5 #include <sdbusplus/server/object.hpp>
6 #include <stdplus/pinned.hpp>
7 #include <stdplus/zstring.hpp>
8 #include <xyz/openbmc_project/Network/SystemConfiguration/server.hpp>
9 
10 #include <string>
11 
12 namespace phosphor
13 {
14 namespace network
15 {
16 
17 using SystemConfigIntf =
18     sdbusplus::xyz::openbmc_project::Network::server::SystemConfiguration;
19 
20 using Iface = sdbusplus::server::object_t<SystemConfigIntf>;
21 
22 class Manager; // forward declaration of network manager.
23 
24 /** @class SystemConfiguration
25  *  @brief Network system configuration.
26  *  @details A concrete implementation for the
27  *  xyz.openbmc_project.Network.SystemConfiguration DBus API.
28  */
29 class SystemConfiguration : public Iface
30 {
31   public:
32     SystemConfiguration(SystemConfiguration&&) = delete;
33     SystemConfiguration& operator=(SystemConfiguration&&) = delete;
34 
35     /** @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      */
40     SystemConfiguration(stdplus::PinnedRef<sdbusplus::bus_t> bus,
41                         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 Persistent sdbusplus DBus bus connection. */
50     stdplus::PinnedRef<sdbusplus::bus_t> bus;
51 
52     /** @brief Monitor for hostname changes */
53     sdbusplus::bus::match_t hostnamePropMatch;
54 };
55 
56 } // namespace network
57 } // namespace phosphor
58