1 #pragma once 2 #include <sdbusplus/bus.hpp> 3 #include <sdbusplus/server/object.hpp> 4 #include <stdplus/pinned.hpp> 5 #include <stdplus/zstring.hpp> 6 #include <xyz/openbmc_project/Network/DHCPConfiguration/server.hpp> 7 8 namespace phosphor 9 { 10 namespace network 11 { 12 13 class Manager; // forward declaration of network manager. 14 15 namespace dhcp 16 { 17 18 using ConfigIntf = 19 sdbusplus::xyz::openbmc_project::Network::server::DHCPConfiguration; 20 21 using Iface = sdbusplus::server::object_t<ConfigIntf>; 22 23 /** @class Configuration 24 * @brief DHCP configuration. 25 * @details A concrete implementation for the 26 * xyz.openbmc_project.Network.DHCP DBus interface. 27 */ 28 class Configuration : public Iface 29 { 30 public: 31 /** @brief Constructor to put object onto bus at a dbus path. 32 * @param[in] bus - Bus to attach to. 33 * @param[in] objPath - Path to attach at. 34 * @param[in] parent - Parent object. 35 */ 36 Configuration(sdbusplus::bus_t& bus, stdplus::const_zstring objPath, 37 stdplus::PinnedRef<Manager> parent); 38 39 /** @brief If true then DNS servers received from the DHCP server 40 * will be used and take precedence over any statically 41 * configured ones. 42 * @param[in] value - true if DNS server needed from DHCP server 43 * else false. 44 */ 45 bool dnsEnabled(bool value) override; 46 47 /** @brief If true then NTP servers received from the DHCP server 48 will be used by systemd-timesyncd. 49 * @param[in] value - true if NTP server needed from DHCP server 50 * else false. 51 */ 52 bool ntpEnabled(bool value) override; 53 54 /** @brief If true then Hostname received from the DHCP server will 55 * be set as the hostname of the system 56 * @param[in] value - true if hostname needed from the DHCP server 57 * else false. 58 * 59 */ 60 bool hostNameEnabled(bool value) override; 61 62 /** @brief if true then it will cause an Option 12 field, i.e machine's 63 * hostname, will be included in the DHCP packet. 64 * @param[in] value - true if machine's host name needs to be included 65 * in the DHCP packet. 66 */ 67 bool sendHostNameEnabled(bool value) override; 68 69 /* @brief Network Manager needed the below function to know the 70 * value of the properties (ntpEnabled,dnsEnabled,hostnameEnabled 71 sendHostNameEnabled). 72 * 73 */ 74 using ConfigIntf::dnsEnabled; 75 using ConfigIntf::hostNameEnabled; 76 using ConfigIntf::ntpEnabled; 77 using ConfigIntf::sendHostNameEnabled; 78 79 private: 80 /** @brief Network Manager object. */ 81 stdplus::PinnedRef<Manager> manager; 82 }; 83 84 } // namespace dhcp 85 } // namespace network 86 } // namespace phosphor 87