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 | |
| 12 | bool Configuration::hostNameEnabled(bool value) |
| 13 | { |
| 14 | if (value == hostNameEnabled()) |
| 15 | { |
| 16 | return value; |
| 17 | } |
| 18 | |
| 19 | auto name = ConfigIntf::hostNameEnabled(value); |
| 20 | manager.writeToConfigurationFile(); |
| 21 | restartSystemdUnit(phosphor::network::networkdService); |
| 22 | |
| 23 | return name; |
| 24 | } |
| 25 | |
| 26 | bool Configuration::nTPEnabled(bool value) |
| 27 | { |
| 28 | if (value == nTPEnabled()) |
| 29 | { |
| 30 | return value; |
| 31 | } |
| 32 | |
| 33 | auto ntp = ConfigIntf::nTPEnabled(value); |
| 34 | manager.writeToConfigurationFile(); |
| 35 | restartSystemdUnit(phosphor::network::networkdService); |
| 36 | restartSystemdUnit(phosphor::network::timeSynchdService); |
| 37 | |
| 38 | return ntp; |
| 39 | } |
| 40 | |
| 41 | |
| 42 | bool Configuration::dNSEnabled(bool value) |
| 43 | { |
| 44 | if (value == dNSEnabled()) |
| 45 | { |
| 46 | return value; |
| 47 | } |
| 48 | |
| 49 | auto dns = ConfigIntf::dNSEnabled(value); |
| 50 | manager.writeToConfigurationFile(); |
| 51 | restartSystemdUnit(phosphor::network::networkdService); |
| 52 | |
| 53 | return dns; |
| 54 | } |
| 55 | |
| 56 | }// namespace dhcp |
| 57 | }// namespace network |
| 58 | }// namespace phosphor |