Ratan Gupta | 935bc33 | 2017-07-11 17:47:14 +0530 | [diff] [blame] | 1 | #include "config.h" |
| 2 | #include "dhcp_configuration.hpp" |
| 3 | #include "network_manager.hpp" |
| 4 | |
| 5 | namespace phosphor |
| 6 | { |
| 7 | namespace network |
| 8 | { |
| 9 | namespace dhcp |
| 10 | { |
| 11 | |
Nagaraju Goruganti | e8fca1d | 2018-02-05 20:32:45 -0600 | [diff] [blame] | 12 | bool Configuration::sendHostNameEnabled(bool value) |
| 13 | { |
| 14 | if (value == sendHostNameEnabled()) |
| 15 | { |
| 16 | return value; |
| 17 | } |
| 18 | |
| 19 | auto name = ConfigIntf::sendHostNameEnabled(value); |
| 20 | manager.writeToConfigurationFile(); |
| 21 | |
| 22 | return name; |
| 23 | } |
| 24 | |
Ratan Gupta | 935bc33 | 2017-07-11 17:47:14 +0530 | [diff] [blame] | 25 | bool Configuration::hostNameEnabled(bool value) |
| 26 | { |
| 27 | if (value == hostNameEnabled()) |
| 28 | { |
| 29 | return value; |
| 30 | } |
| 31 | |
| 32 | auto name = ConfigIntf::hostNameEnabled(value); |
| 33 | manager.writeToConfigurationFile(); |
| 34 | restartSystemdUnit(phosphor::network::networkdService); |
| 35 | |
| 36 | return name; |
| 37 | } |
| 38 | |
| 39 | bool Configuration::nTPEnabled(bool value) |
| 40 | { |
| 41 | if (value == nTPEnabled()) |
| 42 | { |
| 43 | return value; |
| 44 | } |
| 45 | |
| 46 | auto ntp = ConfigIntf::nTPEnabled(value); |
| 47 | manager.writeToConfigurationFile(); |
| 48 | restartSystemdUnit(phosphor::network::networkdService); |
| 49 | restartSystemdUnit(phosphor::network::timeSynchdService); |
| 50 | |
| 51 | return ntp; |
| 52 | } |
| 53 | |
| 54 | |
| 55 | bool Configuration::dNSEnabled(bool value) |
| 56 | { |
| 57 | if (value == dNSEnabled()) |
| 58 | { |
| 59 | return value; |
| 60 | } |
| 61 | |
| 62 | auto dns = ConfigIntf::dNSEnabled(value); |
| 63 | manager.writeToConfigurationFile(); |
| 64 | restartSystemdUnit(phosphor::network::networkdService); |
| 65 | |
| 66 | return dns; |
| 67 | } |
| 68 | |
| 69 | }// namespace dhcp |
| 70 | }// namespace network |
| 71 | }// namespace phosphor |