blob: 8f79bac5e34523af16e0a8abd5634687cbab3f4b [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 III9ede1b72022-11-21 01:59:28 -08006#include <stdplus/pinned.hpp>
William A. Kennington IIIbe3bd2f2022-10-11 14:11:27 -07007#include <stdplus/zstring.hpp>
Patrick Venture189d44e2018-07-09 12:30:59 -07008#include <xyz/openbmc_project/Network/SystemConfiguration/server.hpp>
Ratan Gupta82e1ef92017-06-15 08:39:15 +05309
Patrick Williams89d734b2023-05-10 07:50:25 -050010#include <string>
11
Ratan Gupta82e1ef92017-06-15 08:39:15 +053012namespace phosphor
13{
14namespace network
15{
16
17using SystemConfigIntf =
18 sdbusplus::xyz::openbmc_project::Network::server::SystemConfiguration;
19
Patrick Williamsc38b0712022-07-22 19:26:54 -050020using Iface = sdbusplus::server::object_t<SystemConfigIntf>;
Ratan Gupta82e1ef92017-06-15 08:39:15 +053021
22class 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 */
29class SystemConfiguration : public Iface
30{
Gunnar Mills57d9c502018-09-14 14:42:34 -050031 public:
Gunnar Mills57d9c502018-09-14 14:42:34 -050032 SystemConfiguration(SystemConfiguration&&) = delete;
33 SystemConfiguration& operator=(SystemConfiguration&&) = delete;
Ratan Gupta82e1ef92017-06-15 08:39:15 +053034
Gunnar Mills57d9c502018-09-14 14:42:34 -050035 /** @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 III9ede1b72022-11-21 01:59:28 -080040 SystemConfiguration(stdplus::PinnedRef<sdbusplus::bus_t> bus,
41 stdplus::const_zstring objPath);
Ratan Gupta82e1ef92017-06-15 08:39:15 +053042
Gunnar Mills57d9c502018-09-14 14:42:34 -050043 /** @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 Gupta82e1ef92017-06-15 08:39:15 +053047
Gunnar Mills57d9c502018-09-14 14:42:34 -050048 private:
Gunnar Mills57d9c502018-09-14 14:42:34 -050049 /** @brief Persistent sdbusplus DBus bus connection. */
William A. Kennington III9ede1b72022-11-21 01:59:28 -080050 stdplus::PinnedRef<sdbusplus::bus_t> bus;
William A. Kennington III40c29b52022-11-16 17:48:10 -080051
52 /** @brief Monitor for hostname changes */
53 sdbusplus::bus::match_t hostnamePropMatch;
Ratan Gupta82e1ef92017-06-15 08:39:15 +053054};
55
56} // namespace network
57} // namespace phosphor