Vishwanatha Subbanna | f00182e | 2017-10-16 19:08:59 +0530 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include <experimental/filesystem> |
| 4 | |
| 5 | namespace phosphor |
| 6 | { |
| 7 | namespace network |
| 8 | { |
| 9 | namespace dns |
| 10 | { |
| 11 | namespace updater |
| 12 | { |
| 13 | |
| 14 | namespace fs = std::experimental::filesystem; |
| 15 | |
| 16 | constexpr auto RESOLV_CONF = "/etc/resolv.conf"; |
| 17 | |
| 18 | /** @brief Reads DNS entries supplied by DHCP and updates specified file |
| 19 | * |
| 20 | * @param[in] inFile - File having DNS entries supplied by DHCP |
| 21 | * @param[in] outFile - File to write the nameserver entries to |
| 22 | */ |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 23 | void updateDNSEntries(const fs::path& inFile, const fs::path& outFile); |
Vishwanatha Subbanna | f00182e | 2017-10-16 19:08:59 +0530 | [diff] [blame] | 24 | |
| 25 | /** @brief User callback handler invoked by inotify watcher |
| 26 | * |
| 27 | * Needed to enable production and test code so that the right |
| 28 | * callback functions could be implemented |
| 29 | * |
| 30 | * @param[in] inFile - File having DNS entries supplied by DHCP |
| 31 | */ |
| 32 | inline void processDNSEntries(const fs::path& inFile) |
| 33 | { |
Vishwanatha Subbanna | 18891c6 | 2017-10-17 15:22:46 +0530 | [diff] [blame] | 34 | return updateDNSEntries(inFile, RESOLV_CONF); |
Vishwanatha Subbanna | f00182e | 2017-10-16 19:08:59 +0530 | [diff] [blame] | 35 | } |
| 36 | |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 37 | } // namespace updater |
| 38 | } // namespace dns |
Vishwanatha Subbanna | f00182e | 2017-10-16 19:08:59 +0530 | [diff] [blame] | 39 | } // namespace network |
| 40 | } // namespace phosphor |