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> |
William A. Kennington III | 40c29b5 | 2022-11-16 17:48:10 -0800 | [diff] [blame] | 4 | #include <sdbusplus/bus/match.hpp> |
Ratan Gupta | 82e1ef9 | 2017-06-15 08:39:15 +0530 | [diff] [blame] | 5 | #include <sdbusplus/server/object.hpp> |
William A. Kennington III | 9ede1b7 | 2022-11-21 01:59:28 -0800 | [diff] [blame] | 6 | #include <stdplus/pinned.hpp> |
William A. Kennington III | be3bd2f | 2022-10-11 14:11:27 -0700 | [diff] [blame] | 7 | #include <stdplus/zstring.hpp> |
Ratan Gupta | 82e1ef9 | 2017-06-15 08:39:15 +0530 | [diff] [blame] | 8 | #include <string> |
Patrick Venture | 189d44e | 2018-07-09 12:30:59 -0700 | [diff] [blame] | 9 | #include <xyz/openbmc_project/Network/SystemConfiguration/server.hpp> |
Ratan Gupta | 82e1ef9 | 2017-06-15 08:39:15 +0530 | [diff] [blame] | 10 | |
| 11 | namespace phosphor |
| 12 | { |
| 13 | namespace network |
| 14 | { |
| 15 | |
| 16 | using SystemConfigIntf = |
| 17 | sdbusplus::xyz::openbmc_project::Network::server::SystemConfiguration; |
| 18 | |
Patrick Williams | c38b071 | 2022-07-22 19:26:54 -0500 | [diff] [blame] | 19 | using Iface = sdbusplus::server::object_t<SystemConfigIntf>; |
Ratan Gupta | 82e1ef9 | 2017-06-15 08:39:15 +0530 | [diff] [blame] | 20 | |
| 21 | class Manager; // forward declaration of network manager. |
| 22 | |
| 23 | /** @class SystemConfiguration |
| 24 | * @brief Network system configuration. |
| 25 | * @details A concrete implementation for the |
| 26 | * xyz.openbmc_project.Network.SystemConfiguration DBus API. |
| 27 | */ |
| 28 | class SystemConfiguration : public Iface |
| 29 | { |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 30 | public: |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 31 | SystemConfiguration(SystemConfiguration&&) = delete; |
| 32 | SystemConfiguration& operator=(SystemConfiguration&&) = delete; |
Ratan Gupta | 82e1ef9 | 2017-06-15 08:39:15 +0530 | [diff] [blame] | 33 | |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 34 | /** @brief Constructor to put object onto bus at a dbus path. |
| 35 | * @param[in] bus - Bus to attach to. |
| 36 | * @param[in] objPath - Path to attach at. |
| 37 | * @param[in] parent - Parent object. |
| 38 | */ |
William A. Kennington III | 9ede1b7 | 2022-11-21 01:59:28 -0800 | [diff] [blame] | 39 | SystemConfiguration(stdplus::PinnedRef<sdbusplus::bus_t> bus, |
| 40 | stdplus::const_zstring objPath); |
Ratan Gupta | 82e1ef9 | 2017-06-15 08:39:15 +0530 | [diff] [blame] | 41 | |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 42 | /** @brief set the hostname of the system. |
| 43 | * @param[in] name - host name of the system. |
| 44 | */ |
| 45 | std::string hostName(std::string name) override; |
Ratan Gupta | 82e1ef9 | 2017-06-15 08:39:15 +0530 | [diff] [blame] | 46 | |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 47 | private: |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 48 | /** @brief Persistent sdbusplus DBus bus connection. */ |
William A. Kennington III | 9ede1b7 | 2022-11-21 01:59:28 -0800 | [diff] [blame] | 49 | stdplus::PinnedRef<sdbusplus::bus_t> bus; |
William A. Kennington III | 40c29b5 | 2022-11-16 17:48:10 -0800 | [diff] [blame] | 50 | |
| 51 | /** @brief Monitor for hostname changes */ |
| 52 | sdbusplus::bus::match_t hostnamePropMatch; |
Ratan Gupta | 82e1ef9 | 2017-06-15 08:39:15 +0530 | [diff] [blame] | 53 | }; |
| 54 | |
| 55 | } // namespace network |
| 56 | } // namespace phosphor |