blob: 3ebe6470fc472c41832590139ff3fe7c11983d63 [file] [log] [blame]
Ratan Gupta82e1ef92017-06-15 08:39:15 +05301#pragma once
2
3#include "xyz/openbmc_project/Network/SystemConfiguration/server.hpp"
4
5#include <sdbusplus/bus.hpp>
6#include <sdbusplus/server/object.hpp>
7
8#include <string>
9
10namespace phosphor
11{
12namespace network
13{
14
15using SystemConfigIntf =
16 sdbusplus::xyz::openbmc_project::Network::server::SystemConfiguration;
17
18using Iface =
19 sdbusplus::server::object::object<SystemConfigIntf>;
20
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{
30 public:
31 SystemConfiguration() = default;
32 SystemConfiguration(const SystemConfiguration&) = delete;
33 SystemConfiguration& operator=(const SystemConfiguration&) = delete;
34 SystemConfiguration(SystemConfiguration&&) = delete;
35 SystemConfiguration& operator=(SystemConfiguration&&) = delete;
36 virtual ~SystemConfiguration() = default;
37
38 /** @brief Constructor to put object onto bus at a dbus path.
39 * @param[in] bus - Bus to attach to.
40 * @param[in] objPath - Path to attach at.
41 * @param[in] parent - Parent object.
42 */
43 SystemConfiguration(sdbusplus::bus::bus& bus,
44 const std::string& objPath,
45 Manager& parent);
46
47 /** @brief set the hostname of the system.
48 * @param[in] name - host name of the system.
49 */
50 std::string hostName(std::string name) override;
51
52 /** @brief set the default gateway of the system.
53 * @param[in] gateway - default gateway of the system.
54 */
55 std::string defaultGateway(std::string gateway) override;
56
57 using SystemConfigIntf::defaultGateway;
58
59 private:
60
61 /** @brief get the hostname from the system by doing
62 * dbus call to hostnamed service.
63 */
64 std::string getHostNameFromSystem() const;
65
66 /** @brief Persistent sdbusplus DBus bus connection. */
67 sdbusplus::bus::bus& bus;
68
69 /** @brief Network Manager object. */
70 Manager& manager;
71
72};
73
74} // namespace network
75} // namespace phosphor