1 #pragma once
2 
3 #include <sdbusplus/bus.hpp>
4 #include <sdbusplus/server/object.hpp>
5 #include <string>
6 #include <xyz/openbmc_project/Network/SystemConfiguration/server.hpp>
7 
8 namespace phosphor
9 {
10 namespace network
11 {
12 
13 using SystemConfigIntf =
14     sdbusplus::xyz::openbmc_project::Network::server::SystemConfiguration;
15 
16 using Iface = sdbusplus::server::object::object<SystemConfigIntf>;
17 
18 class 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  */
25 class SystemConfiguration : public Iface
26 {
27   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;
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(sdbusplus::bus::bus& bus, const std::string& objPath,
41                         Manager& parent);
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     /** @brief set the default v4 gateway of the system.
49      *  @param[in] gateway - default v4 gateway of the system.
50      */
51     std::string defaultGateway(std::string gateway) override;
52 
53     using SystemConfigIntf::defaultGateway;
54 
55     /** @brief set the default v6 gateway of the system.
56      *  @param[in] gateway - default v6 gateway of the system.
57      */
58     std::string defaultGateway6(std::string gateway) override;
59 
60     using SystemConfigIntf::defaultGateway6;
61 
62   private:
63     /** @brief get the hostname from the system by doing
64      *         dbus call to hostnamed service.
65      */
66     std::string getHostNameFromSystem() const;
67 
68     /** @brief Persistent sdbusplus DBus bus connection. */
69     sdbusplus::bus::bus& bus;
70 
71     /** @brief Network Manager object. */
72     Manager& manager;
73 };
74 
75 } // namespace network
76 } // namespace phosphor
77