blob: e28d496579c2669b494fab84cd6874383eb00165 [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
16using Iface =
17 sdbusplus::server::object::object<SystemConfigIntf>;
18
19class Manager; // forward declaration of network manager.
20
21/** @class SystemConfiguration
22 * @brief Network system configuration.
23 * @details A concrete implementation for the
24 * xyz.openbmc_project.Network.SystemConfiguration DBus API.
25 */
26class SystemConfiguration : public Iface
27{
28 public:
29 SystemConfiguration() = default;
30 SystemConfiguration(const SystemConfiguration&) = delete;
31 SystemConfiguration& operator=(const SystemConfiguration&) = delete;
32 SystemConfiguration(SystemConfiguration&&) = delete;
33 SystemConfiguration& operator=(SystemConfiguration&&) = delete;
34 virtual ~SystemConfiguration() = default;
35
36 /** @brief Constructor to put object onto bus at a dbus path.
37 * @param[in] bus - Bus to attach to.
38 * @param[in] objPath - Path to attach at.
39 * @param[in] parent - Parent object.
40 */
41 SystemConfiguration(sdbusplus::bus::bus& bus,
42 const std::string& objPath,
43 Manager& parent);
44
45 /** @brief set the hostname of the system.
46 * @param[in] name - host name of the system.
47 */
48 std::string hostName(std::string name) override;
49
50 /** @brief set the default gateway of the system.
51 * @param[in] gateway - default gateway of the system.
52 */
53 std::string defaultGateway(std::string gateway) override;
54
55 using SystemConfigIntf::defaultGateway;
56
57 private:
58
59 /** @brief get the hostname from the system by doing
60 * dbus call to hostnamed service.
61 */
62 std::string getHostNameFromSystem() const;
63
64 /** @brief Persistent sdbusplus DBus bus connection. */
65 sdbusplus::bus::bus& bus;
66
67 /** @brief Network Manager object. */
68 Manager& manager;
69
70};
71
72} // namespace network
73} // namespace phosphor