blob: 9e76dcaf6d14b70117238bb7ef201d59f77f9bd7 [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>
4#include <sdbusplus/server/object.hpp>
Ratan Gupta82e1ef92017-06-15 08:39:15 +05305#include <string>
Patrick Venture189d44e2018-07-09 12:30:59 -07006#include <xyz/openbmc_project/Network/SystemConfiguration/server.hpp>
Ratan Gupta82e1ef92017-06-15 08:39:15 +05307
8namespace phosphor
9{
10namespace network
11{
12
13using SystemConfigIntf =
14 sdbusplus::xyz::openbmc_project::Network::server::SystemConfiguration;
15
Gunnar Mills57d9c502018-09-14 14:42:34 -050016using Iface = sdbusplus::server::object::object<SystemConfigIntf>;
Ratan Gupta82e1ef92017-06-15 08:39:15 +053017
18class Manager; // forward declaration of network manager.
19
20/** @class SystemConfiguration
21 * @brief Network system configuration.
22 * @details A concrete implementation for the
23 * xyz.openbmc_project.Network.SystemConfiguration DBus API.
24 */
25class SystemConfiguration : public Iface
26{
Gunnar Mills57d9c502018-09-14 14:42:34 -050027 public:
28 SystemConfiguration() = default;
29 SystemConfiguration(const SystemConfiguration&) = delete;
30 SystemConfiguration& operator=(const SystemConfiguration&) = delete;
31 SystemConfiguration(SystemConfiguration&&) = delete;
32 SystemConfiguration& operator=(SystemConfiguration&&) = delete;
33 virtual ~SystemConfiguration() = default;
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 */
40 SystemConfiguration(sdbusplus::bus::bus& bus, const std::string& objPath,
41 Manager& parent);
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 /** @brief set the default gateway of the system.
49 * @param[in] gateway - default gateway of the system.
50 */
51 std::string defaultGateway(std::string gateway) override;
Ratan Gupta82e1ef92017-06-15 08:39:15 +053052
Gunnar Mills57d9c502018-09-14 14:42:34 -050053 using SystemConfigIntf::defaultGateway;
Ratan Gupta82e1ef92017-06-15 08:39:15 +053054
Gunnar Mills57d9c502018-09-14 14:42:34 -050055 private:
56 /** @brief get the hostname from the system by doing
57 * dbus call to hostnamed service.
58 */
59 std::string getHostNameFromSystem() const;
Ratan Gupta82e1ef92017-06-15 08:39:15 +053060
Gunnar Mills57d9c502018-09-14 14:42:34 -050061 /** @brief Persistent sdbusplus DBus bus connection. */
62 sdbusplus::bus::bus& bus;
Ratan Gupta82e1ef92017-06-15 08:39:15 +053063
Gunnar Mills57d9c502018-09-14 14:42:34 -050064 /** @brief Network Manager object. */
65 Manager& manager;
Ratan Gupta82e1ef92017-06-15 08:39:15 +053066};
67
68} // namespace network
69} // namespace phosphor