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 | |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 16 | using Iface = sdbusplus::server::object::object<SystemConfigIntf>; |
Ratan Gupta | 82e1ef9 | 2017-06-15 08:39:15 +0530 | [diff] [blame] | 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 | { |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 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; |
Ratan Gupta | 82e1ef9 | 2017-06-15 08:39:15 +0530 | [diff] [blame] | 34 | |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 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); |
Ratan Gupta | 82e1ef9 | 2017-06-15 08:39:15 +0530 | [diff] [blame] | 42 | |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 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; |
Ratan Gupta | 82e1ef9 | 2017-06-15 08:39:15 +0530 | [diff] [blame] | 47 | |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 48 | /** @brief set the default gateway of the system. |
| 49 | * @param[in] gateway - default gateway of the system. |
| 50 | */ |
| 51 | std::string defaultGateway(std::string gateway) override; |
Ratan Gupta | 82e1ef9 | 2017-06-15 08:39:15 +0530 | [diff] [blame] | 52 | |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 53 | using SystemConfigIntf::defaultGateway; |
Ratan Gupta | 82e1ef9 | 2017-06-15 08:39:15 +0530 | [diff] [blame] | 54 | |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 55 | private: |
| 56 | /** @brief get the hostname from the system by doing |
| 57 | * dbus call to hostnamed service. |
| 58 | */ |
| 59 | std::string getHostNameFromSystem() const; |
Ratan Gupta | 82e1ef9 | 2017-06-15 08:39:15 +0530 | [diff] [blame] | 60 | |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 61 | /** @brief Persistent sdbusplus DBus bus connection. */ |
| 62 | sdbusplus::bus::bus& bus; |
Ratan Gupta | 82e1ef9 | 2017-06-15 08:39:15 +0530 | [diff] [blame] | 63 | |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 64 | /** @brief Network Manager object. */ |
| 65 | Manager& manager; |
Ratan Gupta | 82e1ef9 | 2017-06-15 08:39:15 +0530 | [diff] [blame] | 66 | }; |
| 67 | |
| 68 | } // namespace network |
| 69 | } // namespace phosphor |