blob: b3d91d3400d441679271ebe8ef52d666562c298f [file] [log] [blame]
Ratan Gupta82e1ef92017-06-15 08:39:15 +05301#pragma once
2
Ratan Gupta82e1ef92017-06-15 08:39:15 +05303#include <sdbusplus/bus.hpp>
William A. Kennington III40c29b52022-11-16 17:48:10 -08004#include <sdbusplus/bus/match.hpp>
Ratan Gupta82e1ef92017-06-15 08:39:15 +05305#include <sdbusplus/server/object.hpp>
William A. Kennington IIIbe3bd2f2022-10-11 14:11:27 -07006#include <stdplus/zstring.hpp>
Ratan Gupta82e1ef92017-06-15 08:39:15 +05307#include <string>
Patrick Venture189d44e2018-07-09 12:30:59 -07008#include <xyz/openbmc_project/Network/SystemConfiguration/server.hpp>
Ratan Gupta82e1ef92017-06-15 08:39:15 +05309
10namespace phosphor
11{
12namespace network
13{
14
15using SystemConfigIntf =
16 sdbusplus::xyz::openbmc_project::Network::server::SystemConfiguration;
17
Patrick Williamsc38b0712022-07-22 19:26:54 -050018using Iface = sdbusplus::server::object_t<SystemConfigIntf>;
Ratan Gupta82e1ef92017-06-15 08:39:15 +053019
20class Manager; // forward declaration of network manager.
21
22/** @class SystemConfiguration
23 * @brief Network system configuration.
24 * @details A concrete implementation for the
25 * xyz.openbmc_project.Network.SystemConfiguration DBus API.
26 */
27class SystemConfiguration : public Iface
28{
Gunnar Mills57d9c502018-09-14 14:42:34 -050029 public:
30 SystemConfiguration() = default;
31 SystemConfiguration(const SystemConfiguration&) = delete;
32 SystemConfiguration& operator=(const SystemConfiguration&) = delete;
33 SystemConfiguration(SystemConfiguration&&) = delete;
34 SystemConfiguration& operator=(SystemConfiguration&&) = delete;
35 virtual ~SystemConfiguration() = default;
Ratan Gupta82e1ef92017-06-15 08:39:15 +053036
Gunnar Mills57d9c502018-09-14 14:42:34 -050037 /** @brief Constructor to put object onto bus at a dbus path.
38 * @param[in] bus - Bus to attach to.
39 * @param[in] objPath - Path to attach at.
40 * @param[in] parent - Parent object.
41 */
William A. Kennington IIIbe3bd2f2022-10-11 14:11:27 -070042 SystemConfiguration(sdbusplus::bus_t& bus, stdplus::const_zstring objPath);
Ratan Gupta82e1ef92017-06-15 08:39:15 +053043
Gunnar Mills57d9c502018-09-14 14:42:34 -050044 /** @brief set the hostname of the system.
45 * @param[in] name - host name of the system.
46 */
47 std::string hostName(std::string name) override;
Ratan Gupta82e1ef92017-06-15 08:39:15 +053048
Gunnar Mills57d9c502018-09-14 14:42:34 -050049 private:
Gunnar Mills57d9c502018-09-14 14:42:34 -050050 /** @brief Persistent sdbusplus DBus bus connection. */
Patrick Williamsc38b0712022-07-22 19:26:54 -050051 sdbusplus::bus_t& bus;
William A. Kennington III40c29b52022-11-16 17:48:10 -080052
53 /** @brief Monitor for hostname changes */
54 sdbusplus::bus::match_t hostnamePropMatch;
Ratan Gupta82e1ef92017-06-15 08:39:15 +053055};
56
57} // namespace network
58} // namespace phosphor