Ratan Gupta | 82e1ef9 | 2017-06-15 08:39:15 +0530 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Ratan Gupta | 82e1ef9 | 2017-06-15 08:39:15 +0530 | [diff] [blame] | 3 | #include <sdbusplus/bus.hpp> |
| 4 | #include <sdbusplus/server/object.hpp> |
Ratan Gupta | 82e1ef9 | 2017-06-15 08:39:15 +0530 | [diff] [blame] | 5 | #include <string> |
Patrick Venture | 189d44e | 2018-07-09 12:30:59 -0700 | [diff] [blame] | 6 | #include <xyz/openbmc_project/Network/SystemConfiguration/server.hpp> |
Ratan Gupta | 82e1ef9 | 2017-06-15 08:39:15 +0530 | [diff] [blame] | 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 = |
| 17 | sdbusplus::server::object::object<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::bus& bus, |
| 42 | const std::string& objPath, |
| 43 | Manager& parent); |
| 44 | |
| 45 | /** @brief set the hostname of the system. |
| 46 | * @param[in] name - host name of the system. |
| 47 | */ |
| 48 | std::string hostName(std::string name) override; |
| 49 | |
| 50 | /** @brief set the default gateway of the system. |
| 51 | * @param[in] gateway - default gateway of the system. |
| 52 | */ |
| 53 | std::string defaultGateway(std::string gateway) override; |
| 54 | |
| 55 | using SystemConfigIntf::defaultGateway; |
| 56 | |
| 57 | private: |
| 58 | |
| 59 | /** @brief get the hostname from the system by doing |
| 60 | * dbus call to hostnamed service. |
| 61 | */ |
| 62 | std::string getHostNameFromSystem() const; |
| 63 | |
| 64 | /** @brief Persistent sdbusplus DBus bus connection. */ |
| 65 | sdbusplus::bus::bus& bus; |
| 66 | |
| 67 | /** @brief Network Manager object. */ |
| 68 | Manager& manager; |
| 69 | |
| 70 | }; |
| 71 | |
| 72 | } // namespace network |
| 73 | } // namespace phosphor |