blob: 4eceec0ce6699a73e2b2cecb197317fbb8acf824 [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>
Ratan Gupta82e1ef92017-06-15 08:39:15 +05308#include <string>
Patrick Venture189d44e2018-07-09 12:30:59 -07009#include <xyz/openbmc_project/Network/SystemConfiguration/server.hpp>
Ratan Gupta82e1ef92017-06-15 08:39:15 +053010
11namespace phosphor
12{
13namespace network
14{
15
16using SystemConfigIntf =
17 sdbusplus::xyz::openbmc_project::Network::server::SystemConfiguration;
18
Patrick Williamsc38b0712022-07-22 19:26:54 -050019using Iface = sdbusplus::server::object_t<SystemConfigIntf>;
Ratan Gupta82e1ef92017-06-15 08:39:15 +053020
21class 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 */
28class SystemConfiguration : public Iface
29{
Gunnar Mills57d9c502018-09-14 14:42:34 -050030 public:
Gunnar Mills57d9c502018-09-14 14:42:34 -050031 SystemConfiguration(SystemConfiguration&&) = delete;
32 SystemConfiguration& operator=(SystemConfiguration&&) = delete;
Ratan Gupta82e1ef92017-06-15 08:39:15 +053033
Gunnar Mills57d9c502018-09-14 14:42:34 -050034 /** @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 III9ede1b72022-11-21 01:59:28 -080039 SystemConfiguration(stdplus::PinnedRef<sdbusplus::bus_t> bus,
40 stdplus::const_zstring objPath);
Ratan Gupta82e1ef92017-06-15 08:39:15 +053041
Gunnar Mills57d9c502018-09-14 14:42:34 -050042 /** @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 Gupta82e1ef92017-06-15 08:39:15 +053046
Gunnar Mills57d9c502018-09-14 14:42:34 -050047 private:
Gunnar Mills57d9c502018-09-14 14:42:34 -050048 /** @brief Persistent sdbusplus DBus bus connection. */
William A. Kennington III9ede1b72022-11-21 01:59:28 -080049 stdplus::PinnedRef<sdbusplus::bus_t> bus;
William A. Kennington III40c29b52022-11-16 17:48:10 -080050
51 /** @brief Monitor for hostname changes */
52 sdbusplus::bus::match_t hostnamePropMatch;
Ratan Gupta82e1ef92017-06-15 08:39:15 +053053};
54
55} // namespace network
56} // namespace phosphor