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> |
Patrick Venture | 189d44e | 2018-07-09 12:30:59 -0700 | [diff] [blame] | 8 | #include <xyz/openbmc_project/Network/SystemConfiguration/server.hpp> |
Ratan Gupta | 82e1ef9 | 2017-06-15 08:39:15 +0530 | [diff] [blame] | 9 | |
Patrick Williams | 89d734b | 2023-05-10 07:50:25 -0500 | [diff] [blame] | 10 | #include <string> |
| 11 | |
Ratan Gupta | 82e1ef9 | 2017-06-15 08:39:15 +0530 | [diff] [blame] | 12 | namespace phosphor |
| 13 | { |
| 14 | namespace network |
| 15 | { |
| 16 | |
| 17 | using SystemConfigIntf = |
| 18 | sdbusplus::xyz::openbmc_project::Network::server::SystemConfiguration; |
| 19 | |
Patrick Williams | c38b071 | 2022-07-22 19:26:54 -0500 | [diff] [blame] | 20 | using Iface = sdbusplus::server::object_t<SystemConfigIntf>; |
Ratan Gupta | 82e1ef9 | 2017-06-15 08:39:15 +0530 | [diff] [blame] | 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 | { |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 31 | public: |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 32 | SystemConfiguration(SystemConfiguration&&) = delete; |
| 33 | SystemConfiguration& operator=(SystemConfiguration&&) = delete; |
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 | */ |
William A. Kennington III | 9ede1b7 | 2022-11-21 01:59:28 -0800 | [diff] [blame] | 40 | SystemConfiguration(stdplus::PinnedRef<sdbusplus::bus_t> bus, |
| 41 | stdplus::const_zstring objPath); |
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 | private: |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 49 | /** @brief Persistent sdbusplus DBus bus connection. */ |
William A. Kennington III | 9ede1b7 | 2022-11-21 01:59:28 -0800 | [diff] [blame] | 50 | stdplus::PinnedRef<sdbusplus::bus_t> bus; |
William A. Kennington III | 40c29b5 | 2022-11-16 17:48:10 -0800 | [diff] [blame] | 51 | |
| 52 | /** @brief Monitor for hostname changes */ |
| 53 | sdbusplus::bus::match_t hostnamePropMatch; |
Ratan Gupta | 82e1ef9 | 2017-06-15 08:39:15 +0530 | [diff] [blame] | 54 | }; |
| 55 | |
| 56 | } // namespace network |
| 57 | } // namespace phosphor |